bmscstan {bmscstan}R Documentation

Bayesian Multilevel Single Case models using 'Stan'


The bmscstan package provides an interface to fit Bayesian Multilevel Single Case models. These models compare the performance of a Single Case against a control group, combining the flexibility of multilevel models and the potentiality of Bayesian Statistics.


The package is now limited to gaussian data only, but we will further expand it to cover binomial and ordinal (Likert scales) data.

By means of bmscstan the effects of the control group and the effects of the deviance between the Single Case and the group will be estimated.

The model to estimate the controls parameters is:

y~N(β X + b Z, σ2)

where y is the controls' dependent variable, X the contrast matrix for Population-level (or Fixed) Effects, and β are the unknown coefficients to be estimate. Z is the contrast matrix for the Varying (or Random, or Group-level) effects, and b are the unknown estimates for the varying effects. σ^2 is the variance.

In order to estimate the coefficients of the Single Case, the formula is the following:

ypt~N(φ Xpt, σ2pt)

where φ = β + δ.

The validation of the approach can be found here:


The main function of bmscstan is BMSC, which uses formula syntax to specify your model.

[Package bmscstan version 1.1.0 Index]