model.list: Create a list of all possible models from a set of covariates...

Description Usage Arguments Value Examples

Description

Create a list of all possible models from a set of covariates and a response variable. Generally, this function is only useful when the resulting object is passed to dev.expl.mgcv::dev.expl.calcs.

Usage

1
model.list(covariates, response)

Arguments

response

A string with the response variable followed by a ~ and the intercept (usually 1), e.g. "Mean_Abundance_perTrapnight~1"

regressors

Vector of strings representing each covariate in a gam model including k value and outter wraper (s, ti, te etc.)

Value

A list of formulas for all possible combinations of models and a matrix using logical values to describe which terms are included in each of the model formulas.

Examples

1
2
3
4
5
6
7
8
#from mgcv documentation
library(mgcv)
library(dev.expl.mgcv)
set.seed(2) ## simulate some data...
dat <- gamSim(1,n=400,dist="normal",scale=2)
b <- gam(y~1+x0+s(x0, k=4)+ti(x2, x3, k=4),data=dat)
model.list.output<-model.list(covariates = c("x0","s(x0, k=4)",
"ti(x2, x3, k=4)"), response="y~1")

nskaff/dev.expl.mgcv documentation built on May 20, 2019, 2:09 p.m.