Learn R Programming

gamlss (version 4.2-4)

gamlss: 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 = sys.parent(), 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 $+$ operators, on the right. Nonparametric smoothing terms are indicated by pb() for penalised beta splines, cs for smoothing spline
sigma.formula
a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~cs(x,df=5). It can be abbreviated to sigma.fo=~cs(x,df=5).
nu.formula
a formula object for fitting a model to the nu parameter, e.g. nu.fo=~x
tau.formula
a formula object for fitting a model to the tau parameter, e.g. tau.fo=~cs(x,df=2)
family
a gamlss.family object, which is used to define the distribution and the link functions of the various parameters. The distribution families supported by gamlss() can be f
data
a data frame containing the variables occurring in the formula. If this is missing, the variables should be on the search list. e.g. data=aids
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 subset) or for a weighted likelihood analysis where the contribution of the observatio
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
method
the current algorithms for GAMLSS are RS(), CG() and mixed(). i.e. method=RS() will use the Rigby and Stasinopoulos algorithm, method=CG() will use the Cole and Green algorithm and mixed(2,10)
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. mu.start=4
sigma.start
vector or scalar of initial values for the scale parameter sigma e.g. sigma.start=1
nu.start
vector or scalar of initial values for the parameter nu e.g. nu.start=3
tau.start
vector or scalar of initial values for the location parameter tau e.g. tau.start=2
mu.fix
whether the mu parameter should be kept fixed in the fitting processes e.g. mu.fix=FALSE
sigma.fix
whether the sigma parameter should be kept fixed in the fitting processes e.g. sigma.fix=FALSE
nu.fix
whether the nu parameter should be kept fixed in the fitting processes e.g. nu.fix=FALSE
tau.fix
whether the tau parameter should be kept fixed in the fitting processes e.g. tau.fix=FALSE
control
this sets the control parameters of the outer iterations algorithm. The default setting is the gamlss.control function
i.control
this sets the control parameters of the inner iterations of the RS algorithm. The default setting is the glim.control function
...
for extra arguments
x
an object

Value

  • Returns a gamlss object with components
  • familythe distribution family of the gamlss object (see gamlss.family)
  • parametersthe name of the fitted parameters i.e. mu, sigma, nu, tau
  • callthe call of the gamlss function
  • ythe response variable
  • controlthe gamlss fit control settings
  • weightsthe vector of weights
  • G.deviancethe global deviance
  • Nthe number of observations in the fit
  • rqresa function to calculate the normalized (randomized) quantile residuals of the object
  • iterthe number of external iterations in the fitting process
  • typethe type of the distribution or the response variable (continuous or discrete)
  • methodwhich algorithm is used for the fit, RS(), CG() or mixed()
  • convergedwhether the model fitting has have converged
  • residualsthe normalized (randomized) quantile residuals of the model
  • mu.fvthe fitted values of the mu model, also sigma.fv, nu.fv, tau.fv for the other parameters if present
  • mu.lpthe linear predictor of the mu model, also sigma.lp, nu.lp, tau.lp for the other parameters if present
  • mu.wvthe working variable of the mu model, also sigma.wv, nu.wv, tau.wv for the other parameters if present
  • mu.wtthe working weights of the mu model, also sigma.wt, nu.wt, tau.wt for the other parameters if present
  • mu.linkthe link function for the mu model, also sigma.link, nu.link, tau.link for the other parameters if present
  • mu.termsthe terms for the mu model, also sigma.terms, nu.terms, tau.terms for the other parameters if present
  • mu.xthe design matrix for the mu, also sigma.x, nu.x, tau.x for the other parameters if present
  • mu.qrthe QR decomposition of the mu model, also sigma.qr, nu.qr, tau.qr for the other parameters if present
  • mu.coefficientsthe linear coefficients of the mu model, also sigma.coefficients, nu.coefficients, tau.coefficients for the other parameters if present
  • mu.formulathe formula for the mu model, also sigma.formula, nu.formula, tau.formula for the other parameters if present
  • mu.dfthe mu degrees of freedom also sigma.df, nu.df, tau.df for the other parameters if present
  • mu.nl.dfthe non linear degrees of freedom, also sigma.nl.df, nu.nl.df, tau.nl.df for the other parameters if present
  • df.fitthe total degrees of freedom use by the model
  • df.residualthe residual degrees of freedom left after the model is fitted
  • aicthe Akaike information criterion
  • sbcthe 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

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")

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. Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/). 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, http://www.jstatsoft.org/v23/i07.

See Also

gamlss.family, pdf.plot, find.hyper

Examples

Run this code
data(abdom)
mod<-gamlss(y~pb(x),sigma.fo=~pb(x),family=BCT, data=abdom, method=mixed(1,20))
plot(mod)
rm(mod)

Run the code above in your browser using DataLab