fit_curves: Creates vectorized predict functions from models.

Description Usage Arguments Value Examples

View source: R/fit_curves.R

Description

fit_curves Takes inputed models and create vectorized functions able to get the model predictionsfor any value inputed. Also outputs a table comparing models.

Usage

1
fit_curves(models, predict_formals = NULL, separator = "_")

Arguments

models

list. List with models that have methods for function 'predict'.

predict_formals

character. Names of variables necessary for predict function. If NULL, function will attempt to retrieve them from the model's formula.

separator

character. Character that separates variable names, years and scenarios.

Value

Returns a list with a table of statistics for model comparision, and a list for each model containing the original call, its output and a vectorized function that gets predictions for the model.

Examples

1
2
3
4
5
6
7
8
library(mgcv)

  fit_curves(models = list(tpc_size = gamm(performance ~ s(temp, bs = 'cs') + size,
                                           random = list(id = ~ 1),
                                           data = FulanusPhysiology),
                           tpc_no_size = gamm(performance ~ s(temp, bs = 'cs'),
                                              random = list(id = ~ 1),
                                              data = FulanusPhysiology)))

gabrielhoc/MapinguariLegacy documentation built on May 8, 2019, 9:54 p.m.