ResidPlotLong: Efficiently examine multiple model fits

Description Usage Arguments Value Examples

View source: R/ResidPlotLong.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#ResidPlotWide Example
data("BatDataWide", "EpfuNb2Wide", "MyevNb2Wide", package = "EcoCountHelper")

ResidPlotWide(BatDataWide, c("EpfuNb2Wide", "MyevNb2Wide"), "^[[:alpha:]]{4}")

EpfuNb2WideResidTests
EpfuNb2WideSimResidPlot
MyevNb2WideResidTests
MyevNb2WideSimResidPlot

#ResidPlotLong Example
data("BatDataLong", "EpfuNb2Long", "MyevNb2Long", package = "EcoCountHelper")

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

EpfuNb2LongResidTests
EpfuNb2LongSimResidPlot
MyevNb2LongResidTests
MyevNb2LongSimResidPlot

huntercole25/EcoCountHelper documentation built on July 21, 2020, 8:56 p.m.