waic_diff: Compute difference (WAIC1 - WAIC2) in WAIC and its SE for two...

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Compute difference (WAIC1 - WAIC2) in WAIC and its SE for two models.

Usage

1
waic_diff(l_pred1, l_pred2)

Arguments

l_pred1

A m1 x D matrix of predictive likelihoods (NOT log-likelihoods) from model 1.

l_pred2

A m2 x D matrix of predictive likelihoods (NOT log-likelihoods) from model 2.

Value

A vector of (1) the difference in WAIC (on the deviance scale) between models and (2) the standard error of the difference in WAIC.

Examples

1
2
3
4
5
6
data(teacher_rate)
fit_mlr <- gibbs_mlr(rating ~ grade, data = teacher_rate, m = 100)
fit_mlr2 <- gibbs_mlr(rating ~ grade + I(grade^2), data = teacher_rate, m = 100)
# Returns (1) D = WAIC(fit_mlr2) - WAIC(fit_mlr) and (2) SE(D)
#   Suggests that a linear relationship is preferable
waic_diff(t(lpd(fit_mlr2)), t(lpd(fit_mlr)))

ktw5691/psychtm documentation built on Nov. 3, 2021, 9:10 a.m.