ZI.Formulas: Develop formulas for Zero-Inflation models

View source: R/Index_functions.R

ZI.FormulasR Documentation

Develop formulas for Zero-Inflation models

Description

ZI.Formulas generates a character vector that can be used to represent formulas for use in individual zero-inflation model runs. The intent is to quickly generate a zero-inflation model formula that incorporates information from several potential covariates and the type of covariate utilized. The same or different co-variates can be included in the different sub-models

Usage

ZI.Formulas(Predictors, Response, offset = NULL, VarType, names, count.n)

Arguments

Predictors

numeric vector representing 'value' for each co-variate included in the model, where the definition of 'value' is different depending on the type of covariate in question. For discrete covariates, a value of 0 indicates that co-variate should not be included in the model; all other values indicate the variable will be included. For continuous covariates, a value of 0 indicates that co-variate should not be included in the model; positive values indicate the polynomial order for that co-variate.

Response

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

offset

character vector representing an "offset" variable to be used in the formula.

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.

names

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

count.n

integer representing the number of covariates included in the *count* sub-model of the overall zero-inflation model. If equal to (or greater) the length of *names* then all covariates are only included in the *count* sub-model. If less than the length of *names*, then those co-variates at positions greater than *count.n* are included in the zero-inflation sub-model.

Value

Character string representing a potential zero-inflation model formula which represents the proposed model structure defined by the function inputs.

See Also

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

Examples

data(iris)
form <- ZI.Formulas(Response = "Sepal.Length", Predictors = c(1, 2, 0, 3, 1,
0, 0, 0), names = rep(c("Petal.Length", "Petal.Width", "Sepal.Width",
"Species"), 2), VarType = rep(c(rep("C", 3), "F"), 2), count.n = 4)
form

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