mssm documentation

This is the documentation of the public API of mssm. The entire source code is available for inspection on GitHub. For the purpose of applying the models available in this toolbox, the documentation here should however be sufficient.

mssm is a Python toolbox to estimate Generalized Additive Mixed Models (GAMMs), Generalized Additive Mixed Models of Location Scale and Shape (GAMMLSS), and more general smooth (mixed) models (GSMMs) in the sense defined by Wood, Pya, & Säfken (2016). mssm is an excellent choice for the modeling of multi-level time-series data, often estimating additive models with separate smooths for thousands of levels in a couple of minutes.

Use the side-bar on the left to navigate through the document tree (just click on src and it will expand).

Installation

The latest stable release of mssm can be installed from pypi. So to complete both steps (after installing conda - see here for instructions), simply run:

conda create -n mssm_env python=3.13
conda activate mssm_env
pip install mssm mssmViz # 'mssmViz' only needed for plotting

For more detailed instructions see the README.

Supported Models

GAMMs:

If you are missing a family, don’t worry - all you need to do is to implement the mssm.src.python.exp_fam.Family() template class for GAMM models.

GAMMLSS:

To implement a new familiy for a GAMMLSS model requires implementing the mssm.src.python.exp_fam.GAMLSSFamily() template class.

GSMMs

To implement a new member of the most general kind of smooth model, you will only need to implement the mssm.src.python.exp_fam.GENSMOOTHFamily() template class - mssm even supports completely derivative-free estimation. You can check the mssm.models.GSMM documentation for an example!

Supported Terms

If you want to know which (smooth, parametric, & random) terms are supported by these models, you should take a look at the mssm.src.python.formula.Formula class and the terms implemented in mssm.src.python.terms.

Tutorial & Model Visualization

To get started with mssm the tutorial and visualization code available as part of the mssmViz package might also be helpful. mssmViz for example offers functions to visualize predictions & residuals for GAMM & GAMMLSS.

Contents: