makeFits: Prepare results for cosine model fit.

Description Usage Arguments Value Examples

View source: R/makeFits.R

Description

This function performs the nonlinear least squares (NLS) regression method for the cosine model. It fits the NLS method as required, and then computes different quantities for the birth seasonality estimates corresponding to different individuals.

Usage

1
2
3
4
5
6
makeFits(
  paths,
  amplitude = NULL,
  intercept = NULL,
  method = c("OLS", "initial")
)

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 for the method="initial" method.

intercept

Initial value for the intercept parameter for the method="initial" method.

method

A character string giving the initialization for the nonlinear least squares regression. This must be either method="initial" or method="OLS". Default is method="OLS" method. method="initial" performs the nonlinear least squares (NLS) regression method for the cosine model without initializing parameter selections. It begins with the given initial values for amplitude and intercept. method="OLS" uses the least squares estimates (see Chazin et al. 2019) as the initial parameter selection.

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

1
2
3
4
5
armenia_split = split(armenia,f = armenia$ID)
amp = seq(1,10,by=0.5)
int = seq(-25,0,by=0.5)
makeFits(armenia_split,amp[1],int[1],method = "initial")
makeFits(armenia_split, method = "OLS")

SCEM documentation built on Sept. 5, 2021, 5:50 p.m.