Skip to contents

Examples

Multilevel models

A linear mixed model with the random effects integrated out and drawn back afterwards, checked against brms.

Cognitive diagnostic models

A DINA model for binary items, with the latent classes summed out, checked against Stan.

Correlation matrices

A multivariate normal with an LKJ prior on its correlation matrix, written in terms of canonical partial correlations, checked against Stan.

Binary factor analysis

A one-factor model for binary items, with the factor integrated out by Gauss-Hermite quadrature inside the log-posterior.

Diagnostic tests without a gold standard

Three latent class models for five schistosomiasis tests in Ghana, with the infection status summed out and a random effect integrated by quadrature.

Articles

Natural-scale summaries
Diagnostics
Model comparison with LOO and WAIC
Latent variables

Random effects, class memberships and other latent variables are integrated out of the log-posterior. Four ways to draw them back after the fit.

Speeding up with Rcpp

A structural equation model with 39 parameters, its log-posterior written first in R and then in C++ with Rcpp and RcppEigen, with an analytic gradient.

Gradients and Hessians with RTMB

The structural equation model of the Rcpp article written for RTMB, which differentiates R code automatically to give the gradient and the Hessian, and compared with R and C++ for speed and accuracy.

For package developers

Using the engine in your own package