gamlss {gamlss} | R Documentation |
Generalized Additive Models for Location Scale and Shape
Description
Returns an object of class "gamlss", which is a generalized additive model for location scale and shape (GAMLSS).
The function gamlss()
is very similar to the gam()
function in S-plus (now also in R in package gam
), but
can fit more distributions (not only the ones belonging to the exponential family) and can model all the parameters of the
distribution as functions of the explanatory variables (e.g. using linear, non-linear, smoothing, loess
and random effects terms).
This implementation of gamlss()
allows modelling of up to four
parameters in a distribution family, which are conventionally called mu
, sigma
, nu
and tau
.
The function gamlssNews()
shows what is new in the current implementation.
Usage
gamlss(formula = formula(data), sigma.formula = ~1,
nu.formula = ~1, tau.formula = ~1, family = NO(),
data, weights = NULL,
contrasts = NULL, method = RS(), start.from = NULL,
mu.start = NULL, sigma.start = NULL,
nu.start = NULL, tau.start = NULL,
mu.fix = FALSE, sigma.fix = FALSE, nu.fix = FALSE,
tau.fix = FALSE, control = gamlss.control(...),
i.control = glim.control(...), ...)
is.gamlss(x)
gamlssNews()
Arguments
formula |
a formula object, with the response on the left of an ~ operator, and the terms, separated by |
sigma.formula |
a formula object for fitting a model to the sigma parameter, as in the formula above,
e.g. |
nu.formula |
a formula object for fitting a model to the nu parameter, e.g. |
tau.formula |
a formula object for fitting a model to the tau parameter, e.g. |
family |
a |
data |
a data frame containing the variables occurring in the formula, e.g. |
weights |
a vector of weights. Note that this is not the same as in the glm() or gam() function.
Here weights can be used to weight out observations (like in |
contrasts |
list of contrasts to be used for some or all of the factors appearing as variables in the model formula. The names of the list should be the names of the corresponding variables. The elements should either be contrast-type matrices (matrices with as many rows as levels of the factor and with columns linearly independent of each other and of a column of ones), or else they should be functions that compute such contrast matrices. |
method |
the current algorithms for GAMLSS are RS(), CG() and mixed(). i.e. |
start.from |
a fitted GAMLSS model which the fitted values will be used as staring values for the current model |
mu.start |
vector or scalar of initial values for the location parameter mu e.g. |
sigma.start |
vector or scalar of initial values for the scale parameter sigma e.g. |
nu.start |
vector or scalar of initial values for the parameter nu e.g. |
tau.start |
vector or scalar of initial values for the location parameter tau e.g. |
mu.fix |
whether the mu parameter should be kept fixed in the fitting processes e.g. |
sigma.fix |
whether the sigma parameter should be kept fixed in the fitting processes e.g. |
nu.fix |
whether the nu parameter should be kept fixed in the fitting processes e.g. |
tau.fix |
whether the tau parameter should be kept fixed in the fitting processes e.g. |
control |
this sets the control parameters of the outer iterations algorithm. The default setting is the |
i.control |
this sets the control parameters of the inner iterations of the RS algorithm. The default setting is the |
... |
for extra arguments |
x |
an object |
Details
The Generalized Additive Model for Location, Scale and Shape
is a general class of statistical models for a univariate
response variable. The model assumes independent observations of the response variable
y given the parameters, the explanatory variables and the values
of the random effects. The distribution for the response variable
in the GAMLSS can be selected from a very general family of
distributions including highly skew and/or kurtotic continuous and
discrete distributions, see gamlss.family
. The systematic part of the model is
expanded to allow modelling not only of the mean (or location) parameter,
but also of the other parameters of the distribution of y, as
linear parametric and/or additive nonparametric (smooth)
functions of explanatory variables and/or random effects terms.
Maximum (penalized) likelihood estimation is used to fit the
(non)parametric models. A Newton-Raphson/Fisher scoring algorithm
is used to maximize the (penalized) likelihood. The additive terms
in the model are fitted using a backfitting algorithm.
is.gamlss
is a short version is is(object,"gamlss")
Value
Returns a gamlss object with components
family |
the distribution family of the gamlss object (see gamlss.family) |
parameters |
the name of the fitted parameters i.e. |
call |
the call of the gamlss function |
y |
the response variable |
control |
the gamlss fit control settings |
weights |
the vector of weights |
G.deviance |
the global deviance |
N |
the number of observations in the fit |
rqres |
a function to calculate the normalized (randomized) quantile residuals of the object |
iter |
the number of external iterations in the fitting process |
type |
the type of the distribution or the response variable (continuous or discrete) |
method |
which algorithm is used for the fit, RS(), CG() or mixed() |
converged |
whether the model fitting has have converged |
residuals |
the normalized (randomized) quantile residuals of the model |
mu.fv |
the fitted values of the mu model, also sigma.fv, nu.fv, tau.fv for the other parameters if present |
mu.lp |
the linear predictor of the mu model, also sigma.lp, nu.lp, tau.lp for the other parameters if present |
mu.wv |
the working variable of the mu model, also |
mu.wt |
the working weights of the mu model, also sigma.wt, nu.wt, tau.wt for the other parameters if present |
mu.link |
the link function for the mu model, also sigma.link, nu.link, tau.link for the other parameters if present |
mu.terms |
the terms for the mu model, also sigma.terms, nu.terms, tau.terms for the other parameters if present |
mu.x |
the design matrix for the mu, also sigma.x, nu.x, tau.x for the other parameters if present |
mu.qr |
the QR decomposition of the mu model, also sigma.qr, nu.qr, tau.qr for the other parameters if present |
mu.coefficients |
the linear coefficients of the mu model, also sigma.coefficients, nu.coefficients, tau.coefficients for the other parameters if present |
mu.formula |
the formula for the mu model, also sigma.formula, nu.formula, tau.formula for the other parameters if present |
mu.df |
the mu degrees of freedom also sigma.df, nu.df, tau.df for the other parameters if present |
mu.nl.df |
the non linear degrees of freedom, also sigma.nl.df, nu.nl.df, tau.nl.df for the other parameters if present |
df.fit |
the total degrees of freedom use by the model |
df.residual |
the residual degrees of freedom left after the model is fitted |
aic |
the Akaike information criterion |
sbc |
the Bayesian information criterion |
Warning
Respect the parameter hierarchy when you are fitting a model. For example a good model for mu
should be fitted before a model for sigma
is fitted
Note
The following generic functions can be used with a GAMLSS object: print
, summary
, fitted
, coef
,
residuals
, update
, plot
, deviance
, formula
Author(s)
Mikis Stasinopoulos, Bob Rigby, Calliope Akantziliotou and Vlasios Voudouris
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, https://www.jstatsoft.org/v23/i07/.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.
(see also https://www.gamlss.com/).
See Also
gamlss.family
, pdf.plot
, find.hyper
Examples
data(abdom)
mod<-gamlss(y~pb(x),sigma.fo=~pb(x),family=BCT, data=abdom, method=mixed(1,20))
plot(mod)
rm(mod)