library("gamlss2")
data("abdom", package = "gamlss.data")
## specify the model Formula
<- y ~ s(x) | s(x) | s(x) | s(x)
f
## estimate model using RS (default)
<- gamlss2(f, data = abdom, family = BCT, optimizer = RS)
b
## now with CG
<- gamlss2(f, data = abdom, family = BCT, optimizer = CG)
b
## first 2 RS iterations and afterwards switch to CG
<- gamlss2(f, data = abdom, family = BCT, CG = 2) b
Rigby and Stasinopoulos (RS) & Cole and Green (CG) Algorithm
Description
The function RS()
implements the algorithm of Rigby and Stasinopoulos, the function CG()
implements the algorithm of Cole and Green for estimating a GAMLSS with gamlss2
.
Usage
## Rigby and Stasinopoulos algorithm.
RS(x, y, specials, family, offsets,
weights, start, xterms, sterms, control)
## Cole and Green algorithm.
CG(x, y, specials, family, offsets,
weights, start, xterms, sterms, control)
Arguments
x
|
The full model matrix to be used for fitting. |
y
|
The response vector or matrix. |
specials
|
A named list of special model terms, e.g., including design and penalty matrices for fitting smooth terms using smooth.construct .
|
family
|
A family object, see gamlss2.family .
|
offsets
|
If supplied, a list or data frame of possible model offset. |
weights
|
If supplied, a numeric vector of weights. |
start
|
Starting values, either for the parameters of the response distribution or, if specified as a named list in which each element of length one is named with “(Intercept)” , the respective intercepts are initialized. If starting values are specified as a named list, data frame or matrix, where each element/column is a vector with the same length as the number of observations in the data, the respective predictors are initialized with these. See the examples for gamlss2 .
|
xterms
|
A named list specifying the linear model terms. Each named list element represents one parameter as specified in the family object. |
sterms
|
A named list specifying the special model terms. Each named list element represents one parameter as specified in the family object. |
control
|
Further control arguments as specified within the call of gamlss2 . See the details.
|
Details
Functions RS()
and CG()
are called within gamlss2
. Both functions implement a backfitting algorithm for estimating GAMLSS. For algorithm details see Rigby and Stasinopoulos (2005).
The functions use the following control arguments:
-
eps
: Numeric vector of length 2, the stopping criterion. Default iseps = c(1e-05, 1e-05)
for the outer and the inner backfitting loop. -
maxit
: Integer vector of length 2, the maximum number of iterations of the outer and inner backfitting loop. Default ismaxit = c(100, 10)
. -
step
: Numeric, the step length control parameter. Default isstep = 1
. Note that ifstep
is set smaller than 1, it might be appropriate to lower the stopping criterioneps
, too. -
CG
: Integer, the number of iterations when to start the CG correction. Default isCG = Inf
. -
trace
: Logical, should information be printed while the algorithm is running? -
flush
: Logical, useflush.console
for displaying the current output in the console. -
ridge
: Logical, should automatic ridge penalization be applied only to linear effects, without penalizing the intercept? For each parameter of the distribution the optimum ridge penalty is estimated using an information criterion. Possible options arecriterion = c(“aic”, “aicc”, “bic”, “gaic”, “gcv”)
. The default iscriterion = “gaic”
and argumentK = 2
, which can be set ingamlss2_control
.
To facilitate the development of new algorithms for gamlss2, users can exchange them using the optimizer
argument in gamlss2_control
. Users developing new model fitting functions are advised to use these functions as templates and pass them to gamlss2_control
. Alternatively, users can replace the optimizer function by adding a named list element, “optimizer”
, to the family object. For instructions on setting up new families in gamlss2, see gamlss2.family
.
Value
Functions RS()
and CG()
return a named list of class “gamlss2”
containing the following objects:
fitted.values
|
A data frame of the fitted values of the modeled parameters of the selected distribution. |
fitted.specials
|
A named list, one element for each parameter of the distribution, containing the fitted model object information of special model terms. |
fitted.linear
|
A named list, one element for each parameter of the distribution, containing the information on fitted linear effects. |
coefficients
|
A named list, one element for each parameter of the distribution, containing the estimated parameters of the linear effects. |
elapsed
|
The elapsed runtime of the algorithm. |
iterations
|
How many iterations the algorithm performed. |
logLik
|
The final value of the log-likelihood of the model. |
control
|
All control arguments used as supplied from function gamlss2_control .
|
References
Rigby RA, Stasinopoulos DM (2005). “Generalized Additive Models for Location, Scale and Shape (with Discussion).” Journal of the Royal Statistical Society, Series C (Applied Statistics), 54, 507–554. doi:10.1111/j.1467-9876.2005.00510.x
See Also
gamlss2
, gamlss2_control
, gamlss2.family