fit_model: Fit the model for a given study id

Description Usage Arguments Value Examples

Description

fit_model fits the model for a given study id. The function first fits the model using REML with and without the AR1 auto-regressive term. It then compares the AIC of these two models. The best model is then refitted using ML and compared to a null model. All models are fitted using the package spaMM.

Usage

1
2
fit_model(data, formula_full = "~ 1", formula_null = "~ 1",
  resid_formula = "~ 1", prior_weights = NULL, ...)

Arguments

data

A dataframe containing per each study the time series of relevant variables (i.e. yearly climate values, yearly trait values or yearly selection differentials) to be analyzed.

formula_full

A character string indicating the formula for the full model to be fitted.

formula_null

A character string indicating the formula for the null model to be fitted.

resid_formula

A character string indicating the formula for the residual model to be fitted.

prior_weights

A numeric vector of prior weights.

...

Additional parameters for the function fitme.

Value

A list containing the best full fitted model and the result of anova.HLfit comparing this model and a null model.

Examples

1
2
3
4
5
6
7
dat_trials <- prepare_data(data = dat_Clim,
                           temperature = TRUE, precipitation = FALSE,
                           phenology = TRUE, morphology = TRUE)

test <- fit_model(data = dat_trials,
                  formula_full = 'Clim ~ year',
                  formula_null = 'Clim ~ 1')

radchukv/adRes documentation built on June 1, 2019, 7:05 p.m.