Skip to contents

Lightweight S3 generics so calls of the form loo(fit) dispatch through R's S3 system even when the loo package is not loaded. When loo is loaded, its generic resolves first; this fallback only fires for bare-namespace use.

Usage

loo(x, ...)

waic(x, ...)

Arguments

x

a fitted ame or lame object with $log_lik.

...

passed to the relevant method.

Value

A loo / waic object.

Examples

# \donttest{
set.seed(1)
n <- 12
Y <- matrix(rnorm(n * n), n, n); diag(Y) <- NA
# a model without actor effects; chains = 1 keeps the example short
fit <- ame(Y, R = 0, rvar = FALSE, cvar = FALSE, dcor = FALSE,
           nscan = 200, burn = 20, odens = 1,
           save_log_lik = TRUE, verbose = FALSE, chains = 1)
if (requireNamespace("loo", quietly = TRUE)) {
  print(loo(fit))
  print(waic(fit))
}
#> 
#> Computed from 200 by 132 log-likelihood matrix.
#> 
#>          Estimate   SE
#> elpd_loo   -172.9  7.9
#> p_loo         2.1  0.3
#> looic       345.8 15.8
#> ------
#> MCSE of elpd_loo is 0.1.
#> MCSE and ESS estimates assume independent draws (r_eff=1).
#> 
#> All Pareto k estimates are good (k < 0.57).
#> See help('pareto-k-diagnostic') for details.
#> 
#> Computed from 200 by 132 log-likelihood matrix.
#> 
#>           Estimate   SE
#> elpd_waic   -172.8  7.9
#> p_waic         2.0  0.3
#> waic         345.7 15.8
# }