GAM.Formulas: Develop formulas for GAM models

View source: R/Index_functions.R

GAM.FormulasR Documentation

Develop formulas for GAM models

Description

GAM.Formulas generates a character vector that can be used to represent formulas for use in individual GAM model runs. The intent is to quickly generate a GAM model formula that incorporates information from several potential covariates, the type of covariate utilized, and the spline "basis" you specify.

Usage

GAM.Formulas(Response, names, VarType, basis = "cr")

Arguments

Response

Character string specifying the name of the response variable. This should match a specific column name in your data frame.

names

character vector representing the names of unique co-variates you want to include in your GAM model. These should match specific column names in your data frame.

VarType

character string denoting the type of co-variate (continuous ("C") or discrete ("F")) for each co-varaite listed in *predictors*. This character string must be the same length as the character string specified by *predictors*. If a value other than "C" or "F" is provided, the function will return an error.

basis

a two letter character string indicating the (penalized) smoothing basis to use (e.g., "tp" for thin plate regression spline, "cr" for cubic regression spline). see s and smooth.terms for more information.

Value

Character string representing a potential GAM model formulat which represents the proposed model structure defined by the function inputs.

See Also

Other Model Formulas: GLM.Formulas(), Model.Formulas(), ZI.Formulas()

Examples

data(iris)
form <- GAM.Formulas(Response = "Sepal.Length", names =
  c("Petal.Length", "Petal.Width", "Sepal.Width", "Species"), VarType =
  c(rep("C", 3), "F"), basis = "tp")
form

ballengerj/FishyR documentation built on June 17, 2022, 10:33 p.m.