ResidPlotLong: Efficiently examine multiple model fits

ResidPlotLongR Documentation

Efficiently examine multiple model fits

Description

These functions are essentially wrappers for a few DHARMa functions that allow users to assess model fit for models produced using glmmTMB with or without random effects.

Usage

ResidPlotLong(
  Data,
  CountCol,
  GroupCol,
  ModNames,
  GroupPat = "^[[:alnum:]]+",
  Looped = T,
  Nsims = 1000,
  TestVals = T
)

ResidPlotWide(
  Data,
  ModNames,
  GroupPat = "^[[:alnum:]]+",
  Nsims = 1000,
  TestVals = T
)

Arguments

Data

The unquoted name of the data frame or data table containing the raw data models are based on.

CountCol

A character string specifying the name of the vector containing count data.

GroupCol

A character string specifying the name of the vector containing group information (e.g., order, species) for each observation.

ModNames

A character vector of model object names to assess model fit for.

GroupPat

A quoted regular expression that can be used to extract the character string representing the column name containing the response variable of a model for (e.g., if the models "EpfuNb2" and "MyluNb2" are supplied for the ModNames argument, an appropriate regular expression would be "^[[:alpha:]]{4}" because the response variable columns are "Epfu" and "Mylu", respectively).

Looped

A logical value indicating whether models were generated using a for loop or apply function that results in the "Data" value in the model output including an iterative subset. Defaults to "T".

Nsims

A number indicating the number of data simulations to run with simulate.

TestVals

A logical value indicating whether model fit test values should be generated alongside the plots this function creates.

Value

These functions output the plots generated by testResiduals. Each resultant plot is named with the model name followed by "SimResidPlot" (e.g., the plot associated with a model named "EpfuNb2" would be named "EpfuNb2SimResidPlot"). If TestVals = T, test values will also be generated. The resultant test values are named with the model name follow by "ResidTests" (e.g., the test values associated with a model named "EpfuNb2" would be named "EpfuNb2SimResidPlot").

Examples

#ResidPlotWide Example
data("BatDataWide", "Epfu_Nb2", "Myev_Nb2", package = "EcoCountHelper")

ResidPlotWide(BatDataWide, c("Epfu_Nb2", "Myev_Nb2"), "^[[:alpha:]]{4}")

Epfu_Nb2ResidTests
Epfu_Nb2SimResidPlot
Myev_Nb2ResidTests
Myev_Nb2SimResidPlot

#ResidPlotLong Example
data("BatDataLong", "Epfu_Nb2_Long", "Myev_Nb2_Long", package = "EcoCountHelper")

ResidPlotLong(BatDataLong, "Count", "Species",
 c("Epfu_Nb2_Long", "Myev_Nb2_Long"), "^[[:alpha:]]{4}")

Epfu_Nb2_LongResidTests
Epfu_Nb2_LongSimResidPlot
Myev_Nb2_LongResidTests
Myev_Nb2_LongSimResidPlot


huntercole25/EcoCountHelper documentation built on Jan. 14, 2023, 4:13 a.m.