DistFitLong: Visually examine the mean-variance relationship of data

View source: R/DistFitLong.R

DistFitLongR Documentation

Visually examine the mean-variance relationship of data

Description

These functions plot data by group, and overlay lines representing three family functions that are commonly used for count data: NB1, NB2, and Poisson. For more information on this, please reference this document.

Usage

DistFitLong(Splitters, Data, CountCol, GroupCol, GroupList, ThemeBlack = T)

DistFitWide(Splitters, Data, GroupList, ThemeBlack = T)

Arguments

Splitters

A character vector of column names to aggregate data by.

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.

GroupList

A character vector of column names representing groups that define model membership (e.g., species, demographics).

ThemeBlack

A logical value indicating whether the plots generated should include theme_nocturnal (T) or not (F).

Value

These functions produces a mean/variance plot with NB1, NB2, and Poisson family function lines for each group in the vector supplied to the GroupList argument. Each resultant plot is named with the group name followed by "DistPlot" (e.g., the plot associated with a group named "Epfu" would be named "EpfuDistPlot".)

Examples

#DistFitWide Example
data("BatDataWide", package = "EcoCountHelper")

DistFitWide(c("Site", "Year"),
                BatDataWide, c("Myev", "Epfu"))
                
EpfuDistPlot
MyevDistPlot

#DistFitLong Example
data("BatDataLong", package = "EcoCountHelper")

DistFitLong(c("Site", "Year"),
  BatDataLong, "Count", "Species", c("Myev", "Epfu"))
  
EpfuDistPlot
MyevDistPlot


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