The GDF (gamlss2 Distribution 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
GDF(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 GDF is a slightly more general implementation of the S3 class GAMLSS tailored for gamlss2. For details please see the documentation of GAMLSS
Value
A GDF 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 seedlibrary("distributions3")set.seed(6020)## one normal distributionX <-GDF("NO", c(mu =1, sigma =2))X
[1] "GDF NO(mu = 1, sigma = 2)"
## two normal distributionsX <-GDF("NO", cbind(c(1, 1.5), c(0.6, 1.2)))X
## see ?gamlss.dist::GAMLSS for the remainder of this example## example using gamlss2data("abdom", package ="gamlss.data")## estimate modelb <-gamlss2(y ~s(x) | . | . | ., data = abdom, family = GA)
GAMLSS-RS iteration 1: Global Deviance = 4937.7817 eps = 0.369951
GAMLSS-RS iteration 2: Global Deviance = 4789.2637 eps = 0.030077
GAMLSS-RS iteration 3: Global Deviance = 4781.6786 eps = 0.001583
GAMLSS-RS iteration 4: Global Deviance = 4781.3298 eps = 0.000072
GAMLSS-RS iteration 5: Global Deviance = 4781.3279 eps = 0.000000
## extract, also works with newdatad <-data.frame("mean"=mean(b),"median"=median(b),"q95"=quantile(b, probs =0.95),"variance"=variance(b),"pdf"=pdf(b),"cdf"=cdf(b))print(head(d))