Skip to contents

Performs the nonlinear least squares (NLS) regression method for the cosine model, with the given initial values for amplitude and intercept. It fits the NLS method as required, and then computes different quantities for the birth seasonality estimates corresponding to different individuals.

Usage

makeFits_initial(paths, amplitude, intercept)

Arguments

paths

A list of data frames, where each frame contains the data for one individual. Every data frame should have two columns with names 'distance' and 'oxygen'.

amplitude

Initial value for the amplitude parameter.

intercept

Initial value for the intercept parameter.

Value

A data frame containing the following components:

amplitude

estimated amplitude

intercept

estimated intercept

x0

delay of the data

X

period of the data

birth

birth seasonality estimate

predictedMin

predicted minimum for the oxygen isotope variable

predictedMax

predicted maximum for the oxygen isotope variable

observedMin

observed minimum for the oxygen isotope variable

observedMax

observed minimum for the oxygen isotope variable

MSE

mean squared error corresponding to the model fit for every individual

Pearson

Pearson's R^2 corresponding to the model fit for every individual

Examples

armenia_split = split(armenia,f = armenia$ID)
amp = seq(1,10,by=0.5)
int = seq(-25,0,by=0.5)
makeFits_initial(armenia_split,amp[1],int[1])
#> Warning: step factor 0.000488281 reduced below 'minFactor' of 0.000976562
#> Warning: step factor 0.000488281 reduced below 'minFactor' of 0.000976562
#> Warning: step factor 0.000488281 reduced below 'minFactor' of 0.000976562
#> Warning: step factor 0.000488281 reduced below 'minFactor' of 0.000976562
#>       amplitude    intercept          x0         X      birth predictedMin
#> 1  1.828067e+00    -7.647116  87.7122853 145.64583 0.60222997    -9.475183
#> 2  3.929605e+03 -3915.251530   6.8978771  15.00554 0.45968859 -7844.856043
#> 3  3.324663e+00    -6.738144   9.0470441  22.62968 0.39978671   -10.062807
#> 4  1.465846e+00    -8.480712 182.0684115 252.28524 0.72167682    -9.946558
#> 5  6.991007e-01    -4.026564   9.9913089  32.96119 0.30312347    -4.725665
#> 6  4.179477e+00    -5.118462  19.5194126  33.51153 0.58246853    -9.297939
#> 7  1.586247e+00    -9.522778   3.4181413  11.58800 0.29497240   -11.109025
#> 8  3.336780e+00    -6.145026  10.4120192  33.13019 0.31427588    -9.481806
#> 9  3.430782e+00    -6.294009   9.1120997  29.38081 0.31013778    -9.724791
#> 10 3.462499e+00    -6.380318  17.7009496  33.13923 0.53413876    -9.842817
#> 11 3.799398e+00    -6.302005  12.6856187  33.51431 0.37851351   -10.101403
#> 12 4.937785e+00    -7.423759  12.3397881  35.36799 0.34889703   -12.361544
#> 13 3.373132e+00    -5.604018  16.5363565  22.30952 0.74122408    -8.977150
#> 14 4.680810e+00    -6.338310   8.8111856  25.27965 0.34854862   -11.019120
#> 15 4.322568e+00    -8.183360   0.8511126  30.41352 0.02798468   -12.505928
#> 16 3.119539e+00    -6.700140   3.8342338  35.44646 0.10816971    -9.819679
#> 17 3.366478e+00    -6.120014  10.1234903  33.96789 0.29803119    -9.486492
#> 18 3.648866e+00    -5.760416  11.1946164  30.09531 0.37197209    -9.409282
#> 19 4.747568e+00    -7.322763  11.9597359  34.02145 0.35153513   -12.070332
#> 20 4.027442e+00    -7.389552  11.1089044  32.89129 0.33774607   -11.416994
#> 21 3.222195e+00    -6.548946   9.7099414  29.49495 0.32920690    -9.771141
#> 22 1.995807e-02    -4.397857  31.0259955  33.80817 0.91770703    -4.417815
#> 23 4.009349e+00    -5.498994  12.1927893  30.00243 0.40639335    -9.508344
#> 24 4.152821e+00    -5.817953  31.2650834  40.13792 0.77894133    -9.970773
#>    predictedMax observedMin observedMax          MSE    Pearson
#> 1    -5.8190496       -9.28       -2.48 1.529106e+01  0.9686448
#> 2    14.3529834      -11.34       -0.09 2.018789e+07  0.0510901
#> 3    -3.4134813       -9.52       -2.42 2.470694e-01  0.9752471
#> 4    -7.0148657      -10.18       -0.69 2.017519e+01  0.9046926
#> 5    -3.3274637       -4.65       -2.90 2.070901e-01  0.7365597
#> 6    -0.9389847      -10.07       -0.47 6.031176e-01  0.9716171
#> 7    -7.9365314      -12.30       -6.22 2.114833e+00  0.6120182
#> 8    -2.8082454       -9.37       -1.90 4.773146e-01  0.9559358
#> 9    -2.8632274       -9.69       -3.15 9.364418e-02  0.9924722
#> 10   -2.9178197       -9.36       -2.36 2.164370e-01  0.9775559
#> 11   -2.5026068       -7.88       -2.47 7.582879e-02  0.9897773
#> 12   -2.4859740      -11.52       -2.73 8.274287e-02  0.9954652
#> 13   -2.2308865       -9.66       -2.88 5.889335e-01  0.9545514
#> 14   -1.6575007       -8.04       -1.92 1.976594e-01  0.9833570
#> 15   -3.8607926      -12.33       -3.89 1.933057e-01  0.9889660
#> 16   -3.5806005       -9.58       -3.19 1.238112e-01  0.9879239
#> 17   -2.7535360       -9.41       -2.89 1.258966e-01  0.9893759
#> 18   -2.1115501       -9.51       -2.22 1.582954e-01  0.9882583
#> 19   -2.5751949      -10.29       -2.56 2.697012e-01  0.9795975
#> 20   -3.3621106      -11.45       -3.59 1.056773e-01  0.9933704
#> 21   -3.3267502       -8.41       -3.51 3.810623e-02  0.9933530
#> 22   -4.3778990       -9.40       -1.41 9.161076e+00 -0.9222432
#> 23   -1.4896450       -8.81       -1.52 3.215473e-01  0.9790757
#> 24   -1.6651319      -10.14       -2.93 1.787485e-01  0.9841492