Index.Grid: Develop "grid" over which to predict CPUE from an index model...

View source: R/Index_functions.R

Index.GridR Documentation

Develop "grid" over which to predict CPUE from an index model based on covariate values

Description

Index.Grid

Usage

Index.Grid(
  X,
  X.type,
  X.name,
  covariates,
  type,
  bin.length = 17,
  cont.length = 51
)

Arguments

X

numeric vector representing the primary covariate of interest. As such, this is the variable you are wanting to get a predicted "effect" for over a range of values this variable can take.

X.type

character vector defining structure of the X variable of interest. See type for a description of the possible X.types

X.name

character string defining the name of the X variable of interest

covariates

numeric list containing additional covariates included in the final models being considered

type

character vector defining structure of each covariate. It must be the same length as the covariates list. Each covariate must be defined as one of four values:

factor

discrete covariate where data fall in discrete bins

mean

any variable for which you want to use the mean value in the model prediction frame. This would be commonly used to represent an offset variable or potentially continous covariates

numeric

continuous covariate, i.e., data fall along a continuous scale

continuous

continuous covariate, i.e., data fall along a continuous scale

discrete

numeric value representing a discrete value for which you want to use in a prediction frame for a given covariete. For example, you may want to choose a specific depth or latitude

median

any variable for which you want to use the median value in the model prediction frame. This would be commonly used to represent an offset variable or potentially continous covariates

mode

any variable for which you want to use the modal value in the model prediction frame. This would be commonly used to represent an offset variable or potentially continous covariates

bin.length

numeric value representing the number of discrete points of each continuous covariate to use in the prediction frame. Recommendation is to use an odd number such that the median of the range of the contiuous variable is used. Function used the value to choose n = bin.length equally spaced points from the minimum of each continuous covariate to the maximum of each continuous covariate

cont.length

numeric value representing the number of discrete points of each continuous covariate to use in the prediction frame. Recommendation is to use an odd number such that the median of the range of the contiuous variable is used. Function used the value to choose n = cont.length equally spaced points from the minimum of each continuous covariate to the maximum of each continuous covariate. It is analogous to bin.length, just allows for additional flexibility of having more precision for the primary variable of interest

Value

list the same length as models that contains summary statistics for each model explored

See Also

Other Model Evaluation: Index.Summary(), disp()

Examples

X <- factor(sample(c(seq(1990, 2015, 1)), size = 10000, replace = TRUE))
df <- data.frame(depth = rnorm(n = 10000, mean = 0, sd = 1), temp = rnorm(
n = 10000, mean = 0, sd = 0.5), lat = rnorm(n = 10000, mean =0, sd = 3))
Index.Grid(X = X, X.type = "factor", X.name = "Year", covariates = df,
type = rep("mean", 3))
Index.Grid(X = X, X.type = "factor", X.name = "Year", covariates = df, type =
rep("numeric", 3), bin.length = 3)

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