merlin - a unified framework for data-analysis

merlin stands for Mixed Effects Regression for LInear, Non-linear and user-defined models. merlin can do a lot of things, from simple stuff like fitting a linear regression or a Weibull survival model, to a three-level logistic mixed effects model, or a multivariate joint model of multiple longitudinal outcomes (of different types) and a recurrent event and survival with non-linear effects… the list is rather endless. merlin can do things you or I haven’t even thought of yet.

This page contains information on how to install the package, links to version histories, and a collection of tutorials and examples to fit and obtain a wide variety of models and predictions.



The current stable version of merlin can be installed from the SSC archive by typing:

ssc install merlin

Any updates can be picked up by typing adoupdate, update. A detailed version history is provided.

The development version of merlin in Stata (which contains new features still in testing), can be installed by typing:

net install merlin, from("")

and then run adoupdate as normal to pick up any updates. A detailed version history of the development version is also provided.

Following installation, see help merlin for an overview of the package.



For detailed examples see the merlin tutorials in Stata page.



Below are publications which have contributed to the development of the merlin package.

Weibull CE, Lambert PC, Eloranta S, Andersson TML, Dickman PW, Crowther MJ. A multi-state model incorporating estimation of excess hazards and multiple time scales. Statistics in Medicine 2021; (Accepted). (Pre-print).

Crowther MJ. merlin - a unified framework for data analysis and methods development in Stata. Stata Journal 2020;20(4):763-784. (Pre-print:

Gasparini A, Abrams KR, Barrett JK, Major JK, Sweeting MJ, Brunskill NJ, Crowther MJ. Mixed effects models for healthcare longitudinal data with an informative visiting process: a Monte Carlo simulation study. Statistica Neerlandica 2020;74(1):5-23 (Pre-print:

Crowther MJ. Multilevel mixed effects parametric survival analysis: Estimation, simulation and application. Stata Journal 2019;19(4):931-949. (Pre-print:

Crowther MJ. Extended multivariate generalised linear and non-linear mixed effects models. arXiv:1710.02223.


merlin in R

merlin was released on CRAN on 15th August 2018. The version history can be found here



comments powered by Disqus