MEDseq v1.2.0


Monthly downloads



Mixtures of Exponential-Distance Models with Covariates

Implements a model-based clustering method for categorical life-course sequences relying on mixtures of exponential-distance models introduced by Murphy et al. (2019) <arXiv:1908.07963>. A range of flexible precision parameter settings corresponding to weighted generalisations of the Hamming distance metric are considered, along with the potential inclusion of a noise component. Gating covariates can be supplied in order to relate sequences to baseline characteristics. Sampling weights are also accommodated. The models are fitted using the EM algorithm and tools for visualising the results are also provided.


CRAN_Status_Badge rstudio mirror downloads rstudio mirror downloads

MEDseq R Package

Mixtures of Exponential-Distance Models

for Clustering Longitudinal Life-Course Sequences

with Gating Covariates and Sampling Weights

Written by Keefe Murphy


Fits MEDseq models introduced by Murphy et al. (2019) [arXiv:1908.07963](, i.e. fits mixtures of exponential-distance models for clustering longitudinal/categorical life-course sequence data via the EM/CEM algorithm. A family of parsimonious precision parameter constraints are accommodated. So too are sampling weights. Gating covariates can be supplied via formula interfaces. Visualisation of the results of such models is also facilitated.

The most important function in the MEDseq package is: MEDseq_fit, for fitting the models via EM/CEM. MEDseq_control allows supplying additional arguments which govern, among other things, controls on the initialisation of the allocations for the EM/CEM algorithm and the various model selection options. MEDseq_compare is provided for conducting model selection between different results from using different covariate combinations &/or initialisation strategies, etc. MEDseq_stderr is provided for computing the standard errors of the coefficients for the covariates in the gating network.

A dedicated plotting function exists for visualising various aspects of the results, using new methods as well as some existing methods from the TraMineR package. Finally, the package also contains two data sets: biofam and mvad.


You can install the latest stable official release of the MEDseq package from CRAN:


or the development version from GitHub:

# If required install devtools:  
# install.packages('devtools')  

In either case, you can then explore the package with:

help(MEDseq_fit) # Help on the main modelling function

For a more thorough intro, the vignette document is available as follows:

vignette("MEDseq", package="MEDseq")

However, if the package is installed from GitHub the vignette is not automatically created. It can be accessed when installing from GitHub with the code:

devtools::install_github('Keefe-Murphy/MEDseq', build_vignettes = TRUE)

Alternatively, the vignette is available on the package's CRAN page.


Murphy, K., Murphy, T. B., Piccarreta, R., and Gormley, I. C. (2019). Clustering longitudinal life-course sequences using mixtures of exponential-distance models. To appear. [arXiv:1908.07963](

Functions in MEDseq

Name Description
MEDseq_news Show the NEWS file
dbs Compute the Density-based Silhouette
MEDseq_control Set control values for use with MEDseq_fit
MEDseq_meantime Compute the mean time spent in each sequence category
get_MEDseq_results Extract results from a MEDseq model
MEDseq-package MEDseq: Mixtures of Exponential-Distance Models with Covariates
MEDseq_fit MEDseq: Mixtures of Exponential-Distance Models with Covariates
MEDseq_stderr MEDseq gating network standard errors
MEDseq_compare Choose the best MEDseq model
biofam Family life states from the Swiss Household Panel biographical survey
mvad MVAD: Transition from school to work
plot.MEDseq Plot MEDseq results
No Results!

Vignettes of MEDseq

No Results!

Last month downloads


Type Package
Date 2020-11-20
License GPL (>= 2)
Encoding UTF-8
LazyData true
RoxygenNote 7.1.1
VignetteBuilder knitr
NeedsCompilation no
Packaged 2020-11-20 22:45:59 UTC; Keefe
Repository CRAN
Date/Publication 2020-11-21 14:20:02 UTC

Include our badge in your README