Learn R Programming

gamlss.nl (version 4.1-0)

nlgamlss: Fitting non linear Generalized Additive Models for Location Scale and Shape (GAMLSS)

Description

This function is an additional method for fitting GAMLSS models. It suitable to fit linear or non linear parametric models using distributions available in the GAMLSS package. It is based on the function stablereg() of the R package stable created by Philippe Lambert and Jim Lindsey which can be found in Jim Lindsey's web page http://popgen.unimaas.nl/~jlindsey/index.html (see also Lambert, P. and Lindsey, J.K. (1999)). The method is very general but requires starting values for all the parameters. For parametric models it can also be used to give the exact (that is taking into the account the correlation between the distributional parameters) asymptotic standard errors.

Usage

nlgamlss(y = NULL, mu.formula = ~1, sigma.formula = ~1, nu.formula = ~1, tau.formula = ~1, mu.fix = FALSE, sigma.fix = FALSE, nu.fix = FALSE, tau.fix = FALSE, all.fix = FALSE, mu.start = NULL, sigma.start = NULL, nu.start = NULL, tau.start = NULL, family = NO(), weights = 1, exact = FALSE, delta = 1, data = parent.frame(), control = NL.control(), llik.output = FALSE)

Arguments

y
the response variable y. Note the difference between gamlss and nlgamss in declaring the y variable In gamlss, y~x is used for modelling the location parameters while here you need y=y and mu.fo=x
mu.formula
a formula object for fitting a model to the location mu parameter, e.g. mu.fo=~x The mu.formula is a linear or nonlinear language expression beginning with ~ or an R function, describing the regression function for the predictor of the location parameter (i.e. after transformation of mu by its link function). mu.start is a vector of initial conditions for the parameters in the regression for this parameter. mu.fix is a boolean indicating if an optimization of the likelihood has to be carried out on these parameters. If no optimization is desired on the location parameters mu, i.e. when the likelihood has to be evaluated or optimized at a fixed location, then mu.fix=TRUE has to be explicitly specified with mu.start indicating the fixed value for the predictor of mu.
sigma.formula
a formula object for fitting a model to the sigma parameter, as in the mu.formula above, e.g. sigma.formula=~x1+x2. It can be abbreviated to sigma.fo=~x1+x2.
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=~x
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
all.fix
whether all the parameters should be fixed at their starting values. This is a way of evaluating the likelihood function
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
family
the distribution family of the gamlss object (see gamlss.family)
weights
a vector of weights. Here weights can be used to weight out observations (like in subset) or for a weighted likelihood analysis where the contribution of the observations to the likelihood differs according to weights. The length of weights must be the same as the number of observations in the data. By default, the weight is set to one. To set weights to vector w use weights=w
exact
If TRUE, fits the exact likelihood function for continuous data by integration over y observation intervals usually determined by the rounding used in the measurement of y, see delta below
delta
Scalar or vector giving the unit of measurement for each response value, set to unity by default. For example, if a response is measured to two decimals, delta=0.01. If the response is transformed, this must be multiplied by the Jacobian. For example, with a log transformation, delta=1/y. The transformation cannot contain unknown parameters. The delta values are used only if exact=TRUE
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
control
this sets the control parameters for the nlm() iterations algorithm. The default setting is the NL.control function
llik.output
is TRUE when the likelihood has to be displayed at each iteration of the optimization

Value

Returns a nlgamlss object with components
family
the distribution family of the nlgamlss object (see gamlss.family)
parameters
the name of the fitted parameters i.e. mu, sigma, nu, tau
call
the call of the nlgamlss function
y
the response variable
control
the nlgamlss 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 , discrete or mixture)
method
which algorithm is used for the fit, JL() in this case
aic
the Akaike information criterion
sbc
the Schwatz Bayesian information criterion
df.residual
the residual degrees of freedom left after the model is fitted
df.fit
the total degrees of freedom use by the model
converged
whether the model fitting has have converged as in nlm()
iter
the number of iterations as in nlm()
residuals
the normalized (randomized) quantile residuals of the model
coefficients
all the fitted coefficients of the model
se
the standard errors of all the fitted coefficients of the model
cov
the covariance matrix of all the fitted coefficients of the model
corr
the correlation matrix of all the fitted coefficients 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.link
the link function for the mu model, also sigma.link, nu.link, tau.link 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.coefficients
the estimated coefficients of the mu model, also sigma.coefficients, nu.coefficients, tau.coefficients for the other parameters if present
mu.coefficients
the standard errors of the coefficients of the mu model, also sigma.coefficients, nu.coefficients, tau.coefficients 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

References

http://popgen.unimaas.nl/~jlindsey/index.html : Jim Lindsey web page

Lambert, P. and Lindsey, J.K. (1999) Analysing financial returns using regression models based on non-symmetric stable distributions. Applied Statistics 48, 409-424.

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. (2006). Using the Box-Cox t distribution in GAMLSS to mode skewnees and and kurtosis. to appear in Statistical Modelling.

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.com/).

See Also

gamlss, gamlss.family

Examples

Run this code
data(la)
# fitting a BCPE distribtion to the data
modBCPE<- nlgamlss(y=PET60, mu.fo=~bflow*(1-(1-exp(p1))*exp(-p2/bflow)),
                   sigma.formula=~1,  mu.start = c(-.9, 90), 
                   sigma.start= -2.3, nu.start=0, tau.start=log(2.5),  
                   family=BCPE, data=la)
modBCPE
plot(modBCPE)

Run the code above in your browser using DataLab