paleocar_models_simple: Fit PaleoCAR models to a single predictand

View source: R/paleocar_models_simple.R

paleocar_models_simpleR Documentation

Fit PaleoCAR models to a single predictand

Description

This is the primary function for fitting PaleoCAR models to a single predictand using a uniform set of predictors (tree-ring chronologies). carscores are calculated for each predictor, and models are calculated by adding predictors stepwise to an ordinary least-squares linear model using the lm function. Model selection is performed by minizing corrected AIC. This occurs for every unique set of available predictors through time.

Usage

paleocar_models_simple(
  predictands,
  chronologies,
  calibration.years,
  prediction.years = NULL,
  verbose = F
)

Arguments

predictands

A numeric vector of the predictand (response) variable.

chronologies

A matrix of tree ring chronologies, indexed annually. Each chronology is a column. The first column must be labeled "YEAR" and is the calendar year.

calibration.years

An integer vector of years corresponding to the layers in the predictands brick.

prediction.years

An optional integer vector of years for the reconstruction. If missing, defaults to the total years present in chronologies.

verbose

Logical, display status messages during run.

Details

See paleocar_models for a batch algorithm that is more efficient (though more computationally complicated) than the algorithm provided here.

Value

A named list containing

  • models A data.table giving the fitted coefficients, LOOCV errors, and AICc values through time for each predictand.

  • predictand A numeric vector of the predictand, as provided.

  • predictor.matrix A matrix of predictors for calibration; chronologies cropped to calibration.years.

  • reconstruction.matrix A matrix of predictors for reconstruction; chronologies cropped to prediction.years, or all of chronologies if prediction.years==NULL.


bocinsky/PaleoCAR documentation built on Feb. 23, 2023, 12:14 p.m.