loo.trophicSDMfit: Computes an approximation of loo for the whole model

View source: R/loo.trophicSDMfit.R

loo.trophicSDMfitR Documentation

Computes an approximation of loo for the whole model

Description

Only works if method = 'stan_glm'. The global loo is computed by summing the loo of all the local models (since the likelihood factorises, the log-likelihood can be summed)This is an implementation of the methods described in Vehtari, Gelman, and Gabry (2017) and Vehtari, Simpson, Gelman, Yao, and Gabry (2019).

Usage

## S3 method for class 'trophicSDMfit'
loo(x, ...)

Arguments

x

A trophicSDMfit object obtained with trophicSDM()

...

additional arguments

Value

The value of the loo for the whole model

Author(s)

Giovanni Poggiato

Examples

data(Y, X, G)
# define abiotic part of the model
env.formula = "~ X_1 + X_2"
# Run the model with bottom-up control using stan_glm as fitting method and no penalisation
m = trophicSDM(Y,X,G, env.formula,
               family = binomial(link = "logit"), penal = NULL, iter = 50,
               mode = "prey", method = "stan_glm")
brms::loo(m)

webSDM documentation built on June 24, 2024, 5:13 p.m.