Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

criterion

Compute information criteria for model comparison


Description

Takes an mcpfit as input and computes information criteria using loo or WAIC. Compare models using loo_compare and loo_model_weights. more in loo.

Usage

criterion(fit, criterion = "loo", ...)

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

## S3 method for class 'mcpfit'
waic(x, ...)

Arguments

fit

An mcpfit object.

criterion

One of "loo" (calls loo) or "waic" (calls waic).

...

Currently ignored

x

An mcpfit object.

Value

a loo or psis_loo object.

Methods (by generic)

  • loo: Computes loo on mcpfit objects

  • waic: Computes WAIC on mcpfit objects

Author(s)

Jonas Kristoffer Lindeløv jonas@lindeloev.dk

See Also

Examples

# Define two models and sample them
# options(mc.cores = 3)  # Speed up sampling
model1 = list(y ~ 1 + x, ~ 1)
model2 = list(y ~ 1 + x)  # Without a change point
fit1 = mcp(model1, ex_plateaus)
fit2 = mcp(model2, ex_plateaus)

# Compute LOO for each and compare (works for waic(fit) too)
fit1$loo = loo(fit1)
fit2$loo = loo(fit2)
loo::loo_compare(fit1$loo, fit2$loo)

mcp

Regression with Multiple Change Points

v0.3.0
GPL-2
Authors
Jonas Kristoffer Lindeløv [aut, cre] (<https://orcid.org/0000-0003-4565-0595>)
Initial release
2020-07-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.