RealEffectTabLong: Tabulate meaningful effect sizes

Description Usage Arguments Value Examples

View source: R/RealEffectTabLong.R

Description

These functions are akin to the RealEffectText function, but rather than generating a meaningful portrayal of a single predictor's effect on a model's response variable, the RealEffectTab functions tabulate effects of specified changes for multiple predictors (scaled or unscaled) and multiple models as a percent change in the response variable. The "Wide" and "Long" suffixes indicate the type of data the function is meant to be used with.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
RealEffectTabLong(
  Models,
  Predictors,
  UnitChanges,
  ConfInt = 95,
  Pvals = T,
  GroupCol,
  GroupPat = "^[[:alnum:]]+",
  ScaleSds = rep(NA, length(Predictors)),
  PredVects = ScaleSds,
  Data = NULL
)

RealEffectTabWide(
  Models,
  Predictors,
  UnitChanges,
  ConfInt = 95,
  Pvals = T,
  ScaleSds = rep(NA, length(Predictors)),
  PredVects = ScaleSds,
  Data = NULL
)

Arguments

Models

Either a character vector of glmmTMB model object names, or the unquoted name of a single glmmTMB model object.

Predictors

A character vector representing the predictors of interest. Appropriate values can be found by entering row.names(summary(x)$coeff$cond) in the console, where x is the model of interest.

UnitChanges

A numeric vector indicating the unscaled change in a predictor for which effects should be returned in the order of the Predictors vector.

ConfInt

A number indicating the desired confidence interval as a percent value.

Pvals

A logical value indicating whether or not to append predictor p-values to the output table.

GroupCol

A character string indicating the column name containing group membership information.

GroupPat

A regular expression capable of extracting group membership information from model names.

ScaleSds

A numeric vector indicating the how many standard deviations a predictor has been scaled by in the order of the Predictors vector. If a predictor has not been scaled, its respective ScaleSds value should be NA.

PredVects

A character vector specifying the column names of the unscaled predictors.

Data

The unquoted name of the table containing the unscaled predictor vectors, and when using RealEffectTabLong, the group membership column.

Value

These functions return a data table with six vectors: the name of the model that the change in the response variable is associated with, the name of the predictor that the change in the response variable is associated with, the unscaled change in the predictor, the change in the response variable expressed as a percentage, and the lower and upper confidence intervals expressed as percentages. If Pvals = T, a seventh column with predictor p-values is also included.

Examples

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

#RealEffectTabWide Single Model Example
RealEffectTabWide(EpfuNb2Wide, Predictors = c("scale2(Yday)", "scale2(MoonPct)"),
                  UnitChanges = c(10, 0.3), ScaleSds = c(2,2),
                  PredVects = c("Yday", "MoonPct"), Data = BatDataWide)

#RealEffectTabWide Multiple Model Example
RealEffectTabWide(c("EpfuNb2Wide", "MyevNb2Wide"),
                  Predictors = c("scale2(Yday)", "scale2(MoonPct)"),
                  UnitChanges = c(10, 0.3), ScaleSds = c(2,2),
                  PredVects = c("Yday", "MoonPct"), Data = BatDataWide)
                  
#RealEffectTabLong Single Model Example
RealEffectTabLong(EpfuNb2Long,
                  Predictors = c("scale2(Yday)", "scale2(MoonPct)"),
                  UnitChanges = c(10, 0.3), GroupCol = "Species",
                  GroupPat = "^[[:alpha:]]{4}", ScaleSds = c(2,2),
                  PredVects = c("Yday", "MoonPct"), Data = BatDataLong)

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