lpred: Extract Linear Predictor Values and Standard Errors For A...

Description Usage Arguments Value Author(s) References See Also Examples

Description

lpred is the GAMLSS specific method which extracts the linear predictor and its (approximate) standard errors for a specified parameter from a GAMLSS objects. The lpred can be also used to extract the fitted values (with its approximate standard errors) or specific terms in the model (with its approximate standard errors) in the same way that the predict.lm() and predict.glm() functions can be used for lm or glm objects. The function lp extract only the linear predictor. If prediction is required for new data values then use the function predict.gamlss().

Usage

1
2
3
4
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

1
2
3
4
5
6
7
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)

Example output

Loading required package: splines
Loading required package: gamlss.data
Loading required package: gamlss.dist
Loading required package: MASS
Loading required package: nlme
Loading required package: parallel
 **********   GAMLSS Version 5.0-2  ********** 
For more on GAMLSS look at http://www.gamlss.org/
Type gamlssNews() to see new features/changes/bug fixes.

GAMLSS-RS iteration 1: Global Deviance = 416.8014 
GAMLSS-RS iteration 2: Global Deviance = 416.8014 
           qrt
1   0.06406873
2  -0.09231187
3   0.07405488
4  -0.05163616
5   0.06406873
6  -0.09231187
7   0.07405488
8  -0.05163616
9   0.06406873
10 -0.09231187
11  0.07405488
12 -0.05163616
13  0.06406873
14 -0.09231187
15  0.07405488
16 -0.05163616
17  0.06406873
18 -0.09231187
19  0.07405488
20 -0.05163616
21  0.06406873
22 -0.09231187
23  0.07405488
24 -0.05163616
25  0.06406873
26 -0.09231187
27  0.07405488
28 -0.05163616
29  0.06406873
30 -0.09231187
31  0.07405488
32 -0.05163616
33  0.06406873
34 -0.09231187
35  0.07405488
36 -0.05163616
37  0.06406873
38 -0.09231187
39  0.07405488
40 -0.05163616
41  0.06406873
42 -0.09231187
43  0.07405488
44 -0.05163616
45  0.06406873
attr(,"constant")
[1] 4.750404
       1        2        3        4        5        6        7        8 
1.359957 1.529298 2.004478 2.171183 2.563356 2.668003 3.080448 3.186374 
       9       10       11       12       13       14       15       16 
3.519725 3.567508 3.925046 3.978022 4.260380 4.259128 4.569587 4.577442 
      17       18       19       20       21       22       23       24 
4.816636 4.774177 5.045386 5.015949 5.219807 5.143970 5.383758 5.324857 
      25       26       27       28       29       30       31       32 
5.501209 5.399822 5.616018 5.535482 5.692156 5.573048 5.773481 5.679138 
      33       34       35       36       37       38       39       40 
5.823963 5.694963 5.887461 5.787141 5.927945 5.796882 5.989274 5.890805 
      41       42       43       44       45 
6.035417 5.910120 6.110234 6.021444 6.177694 

gamlss documentation built on March 31, 2021, 5:10 p.m.