multivariate_forecast Takes data frame or matrix of responses and dataframe of predictors and automates predictions

multivariate_forecast(
  response,
  predictors,
  model_type,
  n_forecast = 10,
  n_years_ahead = 1,
  max_vars = 3,
  formula = NULL
)

Arguments

response

A matrix or data frame of responses for the modeling (values to be forecast) containing a "time" column, "species" column, and "dev" column

predictors

A data frame of predictors used for forecasting recruitment

model_type

The type of model used to link predictors to forecasted recruitment. Can be "lm", "gam",

n_forecast

How many years to use as a holdout / test set

n_years_ahead

How many years ahead to forecast (defaults to 1) 1:n_vars variables, and then results are combined and sorted to remove duplicates

max_vars

The maximum number of variables to include as predictors; defaults to 3

formula

Optional formula for passing to gam(), glmmTMB(), randomForest(), etc.

Value

a list containing predictions and the variables used in making predictions