toLoo: Compute approximate leave-one-out (LOO) cross-validation for...

View source: R/fit.R

toLooR Documentation

Compute approximate leave-one-out (LOO) cross-validation for Bayesian models using Pareto smoothed importance sampling (PSIS)

Description

You must use an ‘_ll’ model variation (see findModel).

Usage

toLoo(fit, ...)

Arguments

fit

a stanfit object

...

Additional options passed to loo.

Value

a loo object

See Also

outlierTable, loo

Examples

palist <- letters[1:10]
df <- twoLevelGraph(palist, 300)
theta <- rnorm(length(palist))
names(theta) <- palist
df <- generateItem(df, theta, th=rep(0.5, 4))

df <- filterGraph(df)
df <- normalizeData(df)
dl <- prepCleanData(df)
dl$scale <- 1.5


m1 <- pcStan("unidim_ll", dl)

loo1 <- toLoo(m1, cores=1)
print(loo1)


pcFactorStan documentation built on Sept. 14, 2023, 1:09 a.m.