Learn R Programming

loo (version 0.1.2)

loo: Leave-one-out cross-validation (LOO)

Description

Efficient approximate leave-one-out cross-validation

Usage

loo(log_lik, ...)

Arguments

log_lik
an $S$ by $N$ matrix, where $S$ is the size of the posterior sample (the number of simulations) and $N$ is the number of data points. Typically (but not restricted to be) the object returned by extract_log_lik
...
optional arguments to pass to psislw. Possible arguments and their defaults are: [object Object],[object Object],[object Object]

We recommend using the default values for the psislw arguments u

Value

  • A named list (of class 'loo') with components:

    [object Object],[object Object],[object Object],[object Object],[object Object]

See Also

loo-package, print.loo, compare

Examples

Run this code
log_lik1 <- extract_log_lik(stanfit1)
loo1 <- loo(log_lik1)
print(loo1, digits = 3)

log_lik2 <- extract_log_lik(stanfit2)
loo2 <- loo(log_lik2)
loo2

loo_diff <- compare(loo1, loo2)
loo_diff
print(loo_diff, digits = 5)

Run the code above in your browser using DataLab