Create a GAMLSS2 Distribution

Description

The GAMLSS2 family is a unified class with corresponding methods that represent all distributional families supported by the gamlss2 package. It enables seamless integration with the distributions3 workflow and provides a consistent interface for model fitting and distributional computations.

Usage

GAMLSS2(family, parameters)

Arguments

family character. Name of a gamlss2.family or a family provided by the gamlss.dist package, e.g, NO or BI for the normal or binomial distribution, respectively.
parameters numeric, matrix, list or data frame, see the examples.

Details

The S3 class GAMLSS2 is a slightly more general implementation of the S3 class GAMLSS tailored for gamlss2. For details please see the documentation of GAMLSS

Value

A GAMLSS2 object, inheriting from distribution.

References

Zeileis A, Lang MN, Hayes A (2022). “distributions3: From Basic Probability to Probabilistic Regression.” Presented at useR! 2022 - The R User Conference. Slides, video, vignette, code at https://www.zeileis.org/news/user2022/.

See Also

gamlss2.family

Examples

library("gamlss2")


## package and random seed
library("distributions3")
set.seed(6020)

## one normal distribution
X <- GAMLSS2("NO", c(mu = 1, sigma = 2))
X
[1] "GAMLSS2 NO(mu = 1, sigma = 2)"
## two normal distributions
X <- GAMLSS2("NO", cbind(c(1, 1.5), c(0.6, 1.2)))
X
[1] "GAMLSS2 NO(mu = 1.0, sigma = 0.6)" "GAMLSS2 NO(mu = 1.5, sigma = 1.2)"
## three Weibull distributions
X <- GAMLSS2("WEI", list(mu = c(1, 1, 2), sigma = c(1, 2, 2)))
X
[1] "GAMLSS2 WEI(mu = 1, sigma = 1)" "GAMLSS2 WEI(mu = 1, sigma = 2)"
[3] "GAMLSS2 WEI(mu = 2, sigma = 2)"
## see ?gamlss.dist::GAMLSS for the remainder of this example