Variability Analysis in R

Uses a Bayesian model to estimate the variability in a repeated measure outcome and use that as an outcome or a predictor in a second stage model.

varian is a free, open source R package for variability analysis using Bayesian inference.

It provides a formula interface in R to define a multilevel model for a variable with repeated measures, in addition to standard multilevel features such as fixed effects and a random intercepts/slopes, the residual variance is a random variable by ID. The latent residual variance estimates are then used as predictors in a regression of another outcome.

At its core, varian uses Stan to estimate the models.

R version 3.1.1 or later is required. You can download the latest version of R here:

Stan and the varian package rely on being able to compile C++ code.

  • For Windows, download and install Rtools at
  • For Mac, make sure you have the latest version of Xcode installed. The installation instructions for rstan provide more details.
  • For Linux, make sure you have a recent version of ge++ or clang++.

Install the latest version of the rstan package, which you can do from CRAN now. That page also lists more detailed directions for getting the necessary tools installed.

install.packages("rstan", dependencies = TRUE)

You can install:

  • the latest stable release (0.2.2) from CRAN

    install.packages("varian", dependencies = TRUE)
  • the latest development version from github


See our open access pre-print on the arXiv


  • If you find a bug or have a feature request, please let us know on the issue tracker:

  • Have questions or need support? Email us at and mention "varian" in the subject.


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.2.2 by Joshua F. Wiley, 2 years ago

Report a bug at

Browse source code at

Authors: Joshua F. Wiley [aut, cre], Elkhart Group Limited [cph]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports stats, MASS, Formula, grid, gridExtra

Depends on rstan, ggplot2

Suggests testthat

See at CRAN