Skip to main content

Overview

gamlss2 logo

The gamlss2 package provides infrastructure for generalized additive models for location, scale, and shape (GAMLSS) and distributional regression more generally. It reimplements the classic gamlss framework with an emphasis on estimation speed and flexible model components. Its modular design supports alternative estimation algorithms, Bayesian sampling, and model terms such as regression trees and forests.

Models can use smooth terms from mgcv, custom special terms, and response families with more than four parameters. Separate predictors for the distribution parameters are specified in a single formula.

1 Choosing a vignette

Start with First Steps to fit a seasonal model for daily motorcycle counts, inspect its residuals, and predict the probability of a busy day.

If you want to… Read
Estimate a mean or quantile, or construct an interval for a future observation Prediction and Uncertainty
Compare predictive distributions using calibration plots and scoring rules Forecasting and Assessment
Fit a model by Bayesian sampling and interpret posterior draws Bayesian GAMLSS
Adapt a distribution for truncation, censoring, rounding, or extra point masses Family Extensions
Implement a response distribution or connect one from distributions3 Family Objects
Add a predictor term with its own fitting and prediction methods Special Model Terms

2 Function reference

gamlss2() fits the model using the RS() optimizer by default. Use summary() and plot() to inspect a fit and predict() to obtain fitted distributions. To browse all manual pages in R, use

help(package = "gamlss2")

3 Installation

The development version of gamlss2 can be installed via

install.packages("gamlss2",
  repos = c("https://gamlss-dev.R-universe.dev",
            "https://cloud.R-project.org"))

4 License

The package is available under the General Public License version 3 or version 2.

References

Rigby, R. A., and D. M. Stasinopoulos. 2005. “Generalized Additive Models for Location, Scale and Shape.” Journal of the Royal Statistical Society C 54 (3): 507–54. https://doi.org/10.1111/j.1467-9876.2005.00510.x.