Gaussian Repeated Measures with conjugate priors fitted using proc MCMC in SAS

Gaussian Repeated Measures with conjugate priors fitted using proc MCMC in SAS.

Quick summary

The basic idea is to use conjugate priors to reduce autocorrelation in the MCMC chain when using the classic MMRM model. The macro is fully compatible with the proc MCMC missing data facilities, so handles both intermittent and monotone missing data (withdrawals) correctly under MAR.

The core code uses the UDS facility in proc MCMC to implement a fully conjugate updating algorithm for the classic Gaussian Repeated Measures (RM) model often known as MMRM. The current version only supports a single shared unstructured covariance matrix. Missing data is handled by the data augmentation facility built into proc MCMC.

The main advantage of using this macro is that there is very little correlation from MC step to step. This makes it runs faster than implementations such as the GSK5 macros that require extensive thinning of the chain.

There are two main macros. The first %build creates a parallel data set from vertical data and codes up classification variables ready for use in the main macro %mymcmc, adding missing data flags. This makes it easy to handle the macro’s input data conventions for classification variables (factors).

Facilities are built into the %mymcmc macro to
a) directly generate imputed data based on a series of possible reference-based marginal models using the data augmentation in proc MCMC.
b) extend the model such as the Diggle-Kenward selection model (example below).

The macros were written by James Roger. They are freely available for general usage. Comments, questions and error reports should be addressed to .


Currently only supports a single shared variance-covariance matrix.


List of files/folders that can be downloaded MyMCMC20160715.
1) MyMCMC_explained01.pdf. A set of slides that describe the main macro and the possible uses in more detail.
2) The SAS code for the macro. The header includes a detailed description.
3) and Demo_Start1-results.html. Example code shows how a very simple model would be fitted directly using proc MCMC and then fits the same model using the macro.
4) and Demo_Priors2-results.html. This example shows how to implement informative priors for either linear predictor or covariance parameters.
5) and Demo_Impute3-results.html. This example demonstrates the additional facilities for directly imputing data under J2R and CIR.
6) and Demo_DK5-results.html. Demonstration of extending the model to include the missing data mechanism using the Diggle Kenward model.

This page was written by James Roger ( ).

Comments are closed.