Learn R Programming

simITS (version 0.1.1)

make_fit_season_model: Make a fit_model that takes a seasonality component

Description

This method returns a function that will fit a model both with and without lagged outcomes.

Usage

make_fit_season_model(formula, no_lag = NULL)

Arguments

formula

Formula specifying seasonality. No outcome or month needed.

no_lag

Formula specifying additional variables to not lag (usually used due to colinearity of lagged outcomes, such as with a sin and cos component).

Value

A callable function that takes the arguments of dat, outcomename, and a lagless flag (see, e.g., the parameters listed in `fit_model_default()`).

Details

You hand it a formula object specifying the seasonality, e.g., " ~ Q2 + Q3 + Q4", if you have quarterly season effects. This method assumes you want models with a linear month component as well, and will add that and an intercept in automatically.

See Also

fit_model_default for the type of function this method will generate.

Examples

Run this code
# NOT RUN {
data( "newjersey")
modF = make_fit_season_model( ~ temperature )
newjersey = add_lagged_covariates( newjersey, "n.warrant", covariates = c("temperature") )
modF( newjersey, "n.warrant" )
# }

Run the code above in your browser using DataLab