lpred {gamlss}R Documentation

Extract Linear Predictor Values and Standard Errors For A GAMLSS Model

Description

The function lpred() is the GAMLSS specific method which extracts the linear predictor and its (approximate) standard errors for a specified model parameter from a GAMLSS objects. The lpred() can be used to extract the predictor fitted values (and its approximate standard errors) or the contribution of specific terms in the model (with their approximate standard errors) in the same way that the predict.lm() and predict.glm() functions can be used for lm or glm objects. Note that lpred() extract information for the predictors of mu,sigma, nu and tau at the training data values. If predictions are required for new data then use the functions predict.gamlss() or predictAll().

The function lp extract only the linear predictor at the training data values.

Usage

lpred(obj, what = c("mu", "sigma", "nu", "tau"), parameter= NULL,
           type = c("link", "response", "terms"), 
           terms = NULL, se.fit = FALSE, ...)
lp(obj, what = c("mu", "sigma", "nu", "tau"), parameter= NULL, ... ) 

Arguments

obj

a GAMLSS fitted model

what

which distribution parameter is required, default what="mu"

parameter

equivalent to what

type

type="link" (the default) gets the linear predictor for the specified distribution parameter. type="response" gets the fitted values for the parameter while type="terms" gets the fitted terms contribution

terms

if type="terms", which terms to be selected (default is all terms)

se.fit

if TRUE the approximate standard errors of the appropriate type are extracted

...

for extra arguments

Value

If se.fit=FALSE a vector (or a matrix) of the appropriate type is extracted from the GAMLSS object for the given parameter in what. If se.fit=TRUE a list containing the appropriate type, fit, and its (approximate) standard errors, se.fit.

Author(s)

Mikis Stasinopoulos

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

predict.gamlss

Examples

data(aids)
mod<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) # 
mod.t <- lpred(mod, type = "terms", terms= "qrt")
mod.t
mod.lp <- lp(mod)
mod.lp 
rm(mod, mod.t,mod.lp)

[Package gamlss version 5.4-22 Index]