model_birds_glm: Fit GLMs for one or more species based on island-wide counts.

View source: R/glm_model.R

model_birds_glmR Documentation

Fit GLMs for one or more species based on island-wide counts.

Description

Fit GLMs for one or more species based on island-wide counts.

Usage

model_birds_glm(
  dat,
  family = "poisson",
  species_formulas = NULL,
  response = "Count",
  choose_terms = c("Year", "Year2", "Qtr"),
  fix_terms = "N_Stations",
  depends = tibble(term = "Year2", on = "Year"),
  robust_se = FALSE,
  verbose = TRUE
)

Arguments

dat

Dataframe with counts and predictors for each species to be modeled

family

Family of GLM to apply to data. One of "poisson", "negative binomial", or "auto".

species_formulas

Optional - tibble with two columns: Species_Code and formulas. Each entry of formulas should be a list of valid formula character vectors.

response

Optional - name of response column. Default is Count.

choose_terms

Optional - names of terms selected by AIC. Defaults are Year, Year2, and Qtr.

fix_terms

Optional - names of terms always included in model. Defaults to N_Stations.

depends

Optional - tibble with two columns: term and on. term is a name in choose_terms and is another name from choose_terms that term depends on. Default has term = Year2, on = Year.

robust_se

Flag for including HAC robust standard errors from package 'sandwich' in plots.

verbose

Flag for printing timing and progress updates.

Value

A tibble with species_code (char), models (list of glm objects), fit_plots, back_trans_plots, resid_plots, and unexp_plots (all lists of ggplots)


BibelnieksDFW/BrBS documentation built on April 20, 2022, 12:54 a.m.