glm_pres_abs: Fit a Generalized Linear Models on presence/absence data

glm_pres_absR Documentation

Fit a Generalized Linear Models on presence/absence data

Description

glm_pres_abs returns a presence/absence GLM model. It can run a StepAIC if specified. It runs the GLMs, plot the residuals analysis graphs and return the GLM outputs.

Usage

glm_pres_abs(
  tableau_pres,
  parameters,
  formula_select,
  summary = FALSE,
  type = 2
)

Arguments

tableau_pres

table of presence and absence data, coming as the output of table_pres_abs

parameters

list of parameters to test

formula_select

if "auto", the function select which formula as the lowest AIC. Else, run the selected formula.

summary

To show residuals plots.

type

To study marginal effects with Anova type III in case of interaction

Value

glm_pres_abs can either return the best GLM model based on AIC comparison, or return the outputs of the GLM based on the formula given in formula_select

Examples

data(tableau_sc)
list_param <- c("annee", "saison")
table_ex <- table_pres_abs(tableau_sc, esp="PSEUDOTOLITHUS ELONGATUS", list_param=c("annee", "saison"), espece_id='nom_taxonomique', var_eff_list=c("surface_chalutee"), catch_col='total_capture', limit=0.0001)
param <- param_use(table_ex, list_param)

for (i in 1:length(param)){
table_ex[,param[i]] <- as.factor(table_ex[,param[i]])
table_ex[,param[i]] <- droplevels(table_ex[,param[i]])
contrasts(table_ex[,param[i]]) <- contr.sum(levels(table_ex[,param[i]]))
}

glm_pres_abs(table_ex, param, formula_select = "auto")


polehalieutique/demerstem documentation built on Aug. 4, 2024, 5:12 a.m.