R/makeFits_initial.R
makeFits_initial.Rd
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.
makeFits_initial(paths, amplitude, intercept)
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. |
A data frame containing the following components:
estimated amplitude
estimated intercept
delay of the data
period of the data
birth seasonality estimate
predicted minimum for the oxygen isotope variable
predicted maximum for the oxygen isotope variable
observed minimum for the oxygen isotope variable
observed minimum for the oxygen isotope variable
mean squared error corresponding to the model fit for every individual
Pearson's R^2 corresponding to the model fit for every individual
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.827734e+00 -7.647449 87.7098935 145.64104 0.60223335 -9.475183 #> 2 3.991127e+03 -3976.413482 3.9153567 14.77674 0.26496761 -7967.540201 #> 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.9913090 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.380319 17.7009496 33.13924 0.53413874 -9.842818 #> 11 3.799398e+00 -6.302004 12.6856187 33.51430 0.37851356 -10.101402 #> 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.8111855 25.27965 0.34854862 -11.019120 #> 15 4.322567e+00 -8.183361 0.8511138 30.41352 0.02798472 -12.505928 #> 16 3.119539e+00 -6.700140 3.8342339 35.44646 0.10816972 -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.35153515 -12.070331 #> 20 4.027442e+00 -7.389552 11.1089044 32.89129 0.33774607 -11.416994 #> 21 3.222196e+00 -6.548946 9.7099414 29.49495 0.32920688 -9.771141 #> 22 1.995941e-02 -4.397856 31.0258285 33.80784 0.91771111 -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.8197151 -9.28 -2.48 1.529117e+01 0.9686447 #> 2 14.7132377 -11.34 -0.09 2.676534e+07 -0.2328175 #> 3 -3.4134814 -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.5026067 -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.8607932 -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.3778962 -9.40 -1.41 9.161082e+00 -0.9222437 #> 23 -1.4896450 -8.81 -1.52 3.215473e-01 0.9790757 #> 24 -1.6651319 -10.14 -2.93 1.787485e-01 0.9841492