ModelCompare: Model selection tool for multiple groups

Description Usage Arguments Value Examples

View source: R/ModelCompare.R

Description

This function allows users to input a list/vector of groups (taxonomic or otherwise), each of which has multiple candidate models generated with glmmTMB, and quickly attain AIC tables for each group. Group names supplied to the Groups argument are used as text patterns supplied to ls as pattern argument values, and model objects in the global environment containing the supplied group names are compared via AIC.

Usage

1
ModelCompare(Groups, TopModOutName)

Arguments

Groups

A character vector of groups (e.g. species, demographics), each with two or more candidate models to be compared. Because the values supplied for this argument are essentially used as regular expression text patterns to search the global environment, model object names must contain a value supplied to this argument to be included in the comparisons.

TopModOutName

An unquoted string used as the object name for the resultant data table showing the top model for each group supplied to the Groups argument.

Value

This function produces n+1 data tables, with n being the number of groups supplied to the Groups argument. A data table detailing each model in a group and its AIC value is produed for each group. Each of these data tables is named with the group name followed by "AIC" (e.g., the data table associated with a group named "Epfu" would be named "EpfuAIC"). An additional data table is produced detailing the top model for each group. The data table of top models is named with the value supplied to the TopModOutName argument.

Examples

1
2
3
4
5
6
7
8
9
data("EpfuNb1Long", "EpfuNb2Long", "MyevNb1Long",
      "MyevNb2Long", package = "EcoCountHelper")
      
Species <- c("Epfu", "Myev")
ModelCompare(Species, TestCompare)

EpfuAIC
MyevAIC
TestCompare

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