Model.Names: Provide Names for a Series of Models

View source: R/Index_functions.R

Model.NamesR Documentation

Provide Names for a Series of Models

Description

Model.Names generates a character vector that can be used to represent names of individual model runs. Intent is to quickly generate a set of unique model names that can be used to store specific model runs.

Usage

Model.Names(
  dat,
  names,
  model = "ZINB",
  structure = "ZINB",
  count.only = TRUE,
  count.n
)

Arguments

dat

vector used to indicate how individual variables in the models are included in a specific model run. Typically, this would represent a numeric vector the length of the maximum number of co-variates being considered during model development. In this vector, a value of 0 would represent that variable not being included in that particular model run. Generally, a value of 1 represents that a covariate (whether continuous or discrete) is included in the model. Any value >1 (e.g., 3) represents that the co-variate was included in the model as a continous variable and modeled using multiple polynomials to the order suggested by the number (e.g., 3 suggests we modeled the co-variate as a 3rd order polynomial).

names

character vector representing the maximum number of co-variates being considered during model development. For "two-stage' type models (e.g., zero-inflated models),their may be duplicate names as the same co-variate may be included in both stages of the model. In the "two-stage" scenario all co-variates included in the 1st stage should be supplied first, followed by all co-variates included in the 2nd stage.

model

character string denoting the type of model being specified. Currently, model can take 1 of 2 values: "ZINB" (default) or "GLM". If another value is provided for model, function will stop, reporting the error "An inappropriate value was provided for 'model'".

structure

value that represents the model structure (default = "ZINB"). The investigator is free to specify this in any way they deem appropriate.

count.only

logical indicating whether you are only modeling the 'count sub-model' of a zero-inflated model. If 'TRUE' (default), you are treating the 'zero-inflation sub-model' as an intercept only model. If 'FALSE' you are specifying you are modeling both the 'count' and 'zero-inflation' sub-models of a zero-inflated model using co-variates.

count.n

numeric value indicating the position of the last 'names' value that represents co-variates included in the 1st stage of a two-stage model.

Value

Character string representing a model name which represents the proposed model structure.

Examples

# GLM Model
Model.Names(c(1,0,2,3), names = c("Yr", "D", "L", "T"), model = "GLM",
structure = "Pois")
# Zero-Inflated Model - Count Sub-model Only
Model.Names(c(1,0,2,3), names = c("Yr", "D", "L", "T"), count.n = 4)
# Zero-Inflated Model - Both Sub-Models
Model.Names(c(1,0,2,3,0,1,0,0), names = c("Yr","D","L","T","Yr","D","L","T"),
count.only = FALSE, count.n = 4)

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