fit_selected {enmpa}R Documentation

Fitting selected GLMs models

Description

Functions to facilitate fitting multiple GLMs.

Usage

fit_selected(glm_calibration)

fit_glms(formulas, data, weights = NULL, id = NULL)

Arguments

glm_calibration

a list resulting from calibration_glm. Models fitted are those in the slot "selected".

formulas

(character) a vector containing the formula(s) for GLM(s).

data

data.frame with the dependent and independent variables.

weights

(numeric) a vector with the weights for observations. Default = NULL.

id

(character) id code for models fitted. Default = NULL.

Value

A list of fitted GLMs.

For fit_selected, an enmpa ⁠fitted models⁠ object.

Examples

# GLM calibration results
data(cal_res, package = "enmpa")

# Fitting selected models
sel_fit <- fit_selected(cal_res)

sel_fit

# Custom formulas
forms <- c("Sp ~ bio_1 + I(bio_1^2) + I(bio_12^2)",
           "Sp ~ bio_12 + I(bio_1^2) + I(bio_12^2)")

# Fitting models
fits <- fit_glms(forms, data = cal_res$data)

fits$ModelID_1

[Package enmpa version 0.1.8 Index]