model.frame.gamlss: Extract a model.frame, a model matrix or terms from a GAMLSS...

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

Description

model.frame.gamlss, model.matrix.gamlss and terms.gamlss are the gamlss versions of the generic functions model.frame, model.matrix and terms respectively.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'gamlss'
model.frame(formula, what = c("mu", "sigma", "nu", "tau"),
                     parameter= NULL, ...)
## S3 method for class 'gamlss'
terms(x, what = c("mu", "sigma", "nu", "tau"), 
                     parameter= NULL,  ...)
## S3 method for class 'gamlss'
model.matrix(object, what = c("mu", "sigma", "nu", "tau"), 
                      parameter= NULL, ...)

Arguments

formula

a gamlss object

x

a gamlss object

object

a gamlss object

what

for which parameter to extract the model.frame, terms or model.frame

parameter

equivalent to what

...

for extra arguments

Value

a model.frame, a model.matrix or terms

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

gamlss

Examples

1
2
3
4
5
6
data(aids)
mod<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) # 
model.frame(mod)
model.matrix(mod)
terms(mod, "mu")
rm(mod)

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 
     y  poly(x, 3).1  poly(x, 3).2  poly(x, 3).3 qrt
1    2 -2.525235e-01  3.118254e-01 -3.451275e-01   1
2    6 -2.410452e-01  2.693037e-01 -2.510018e-01   2
3   10 -2.295668e-01  2.287598e-01 -1.678210e-01   3
4    8 -2.180885e-01  1.901937e-01 -9.506380e-02   4
5   12 -2.066101e-01  1.536053e-01 -3.220912e-02   1
6    9 -1.951318e-01  1.189947e-01  2.126427e-02   2
7   28 -1.836535e-01  8.636179e-02  6.587755e-02   3
8   28 -1.721751e-01  5.570665e-02  1.021519e-01   4
9   35 -1.606968e-01  2.702926e-02  1.306085e-01   1
10  32 -1.492184e-01  3.296251e-04  1.517685e-01   2
11  46 -1.377401e-01 -2.439226e-02  1.661532e-01   3
12  47 -1.262617e-01 -4.713640e-02  1.742836e-01   4
13  50 -1.147834e-01 -6.790278e-02  1.766811e-01   1
14  61 -1.033051e-01 -8.669141e-02  1.738667e-01   2
15  99 -9.182673e-02 -1.035023e-01  1.663616e-01   3
16  95 -8.034839e-02 -1.183354e-01  1.546871e-01   4
17 150 -6.887004e-02 -1.311908e-01  1.393644e-01   1
18 143 -5.739170e-02 -1.420684e-01  1.209145e-01   2
19 197 -4.591336e-02 -1.509683e-01  9.985868e-02   3
20 159 -3.443502e-02 -1.578904e-01  7.671815e-02   4
21 204 -2.295668e-02 -1.628348e-01  5.201407e-02   1
22 168 -1.147834e-02 -1.658014e-01  2.626763e-02   2
23 196 -1.019481e-17 -1.667903e-01 -1.975055e-17   3
24 194  1.147834e-02 -1.658014e-01 -2.626763e-02   4
25 210  2.295668e-02 -1.628348e-01 -5.201407e-02   1
26 180  3.443502e-02 -1.578904e-01 -7.671815e-02   2
27 277  4.591336e-02 -1.509683e-01 -9.985868e-02   3
28 181  5.739170e-02 -1.420684e-01 -1.209145e-01   4
29 327  6.887004e-02 -1.311908e-01 -1.393644e-01   1
30 276  8.034839e-02 -1.183354e-01 -1.546871e-01   2
31 365  9.182673e-02 -1.035023e-01 -1.663616e-01   3
32 300  1.033051e-01 -8.669141e-02 -1.738667e-01   4
33 356  1.147834e-01 -6.790278e-02 -1.766811e-01   1
34 304  1.262617e-01 -4.713640e-02 -1.742836e-01   2
35 307  1.377401e-01 -2.439226e-02 -1.661532e-01   3
36 386  1.492184e-01  3.296251e-04 -1.517685e-01   4
37 331  1.606968e-01  2.702926e-02 -1.306085e-01   1
38 358  1.721751e-01  5.570665e-02 -1.021519e-01   2
39 415  1.836535e-01  8.636179e-02 -6.587755e-02   3
40 374  1.951318e-01  1.189947e-01 -2.126427e-02   4
41 412  2.066101e-01  1.536053e-01  3.220912e-02   1
42 358  2.180885e-01  1.901937e-01  9.506380e-02   2
43 416  2.295668e-01  2.287598e-01  1.678210e-01   3
44 414  2.410452e-01  2.693037e-01  2.510018e-01   4
45 496  2.525235e-01  3.118254e-01  3.451275e-01   1
   (Intercept)   poly(x, 3)1   poly(x, 3)2   poly(x, 3)3 qrt2 qrt3 qrt4
1            1 -2.525235e-01  0.3118253845 -3.451275e-01    0    0    0
2            1 -2.410452e-01  0.2693037411 -2.510018e-01    1    0    0
3            1 -2.295668e-01  0.2287598487 -1.678210e-01    0    1    0
4            1 -2.180885e-01  0.1901937070 -9.506380e-02    0    0    1
5            1 -2.066101e-01  0.1536053162 -3.220912e-02    0    0    0
6            1 -1.951318e-01  0.1189946763  2.126427e-02    1    0    0
7            1 -1.836535e-01  0.0863617872  6.587755e-02    0    1    0
8            1 -1.721751e-01  0.0557066490  1.021519e-01    0    0    1
9            1 -1.606968e-01  0.0270292617  1.306085e-01    0    0    0
10           1 -1.492184e-01  0.0003296251  1.517685e-01    1    0    0
11           1 -1.377401e-01 -0.0243922605  1.661532e-01    0    1    0
12           1 -1.262617e-01 -0.0471363953  1.742836e-01    0    0    1
13           1 -1.147834e-01 -0.0679027793  1.766811e-01    0    0    0
14           1 -1.033051e-01 -0.0866914124  1.738667e-01    1    0    0
15           1 -9.182673e-02 -0.1035022946  1.663616e-01    0    1    0
16           1 -8.034839e-02 -0.1183354260  1.546871e-01    0    0    1
17           1 -6.887004e-02 -0.1311908066  1.393644e-01    0    0    0
18           1 -5.739170e-02 -0.1420684363  1.209145e-01    1    0    0
19           1 -4.591336e-02 -0.1509683151  9.985868e-02    0    1    0
20           1 -3.443502e-02 -0.1578904431  7.671815e-02    0    0    1
21           1 -2.295668e-02 -0.1628348202  5.201407e-02    0    0    0
22           1 -1.147834e-02 -0.1658014465  2.626763e-02    1    0    0
23           1 -1.019481e-17 -0.1667903219 -1.975055e-17    0    1    0
24           1  1.147834e-02 -0.1658014465 -2.626763e-02    0    0    1
25           1  2.295668e-02 -0.1628348202 -5.201407e-02    0    0    0
26           1  3.443502e-02 -0.1578904431 -7.671815e-02    1    0    0
27           1  4.591336e-02 -0.1509683151 -9.985868e-02    0    1    0
28           1  5.739170e-02 -0.1420684363 -1.209145e-01    0    0    1
29           1  6.887004e-02 -0.1311908066 -1.393644e-01    0    0    0
30           1  8.034839e-02 -0.1183354260 -1.546871e-01    1    0    0
31           1  9.182673e-02 -0.1035022946 -1.663616e-01    0    1    0
32           1  1.033051e-01 -0.0866914124 -1.738667e-01    0    0    1
33           1  1.147834e-01 -0.0679027793 -1.766811e-01    0    0    0
34           1  1.262617e-01 -0.0471363953 -1.742836e-01    1    0    0
35           1  1.377401e-01 -0.0243922605 -1.661532e-01    0    1    0
36           1  1.492184e-01  0.0003296251 -1.517685e-01    0    0    1
37           1  1.606968e-01  0.0270292617 -1.306085e-01    0    0    0
38           1  1.721751e-01  0.0557066490 -1.021519e-01    1    0    0
39           1  1.836535e-01  0.0863617872 -6.587755e-02    0    1    0
40           1  1.951318e-01  0.1189946763 -2.126427e-02    0    0    1
41           1  2.066101e-01  0.1536053162  3.220912e-02    0    0    0
42           1  2.180885e-01  0.1901937070  9.506380e-02    1    0    0
43           1  2.295668e-01  0.2287598487  1.678210e-01    0    1    0
44           1  2.410452e-01  0.2693037411  2.510018e-01    0    0    1
45           1  2.525235e-01  0.3118253845  3.451275e-01    0    0    0
attr(,"assign")
[1] 0 1 1 1 2 2 2
attr(,"contrasts")
attr(,"contrasts")$qrt
[1] "contr.treatment"

y ~ poly(x, 3) + qrt
attr(,"variables")
list(y, poly(x, 3), qrt)
attr(,"factors")
           poly(x, 3) qrt
y                   0   0
poly(x, 3)          1   0
qrt                 0   1
attr(,"term.labels")
[1] "poly(x, 3)" "qrt"       
attr(,"specials")
attr(,"specials")$cs
NULL

attr(,"specials")$scs
NULL

attr(,"specials")$ps
NULL

attr(,"specials")$pb
NULL

attr(,"specials")$cy
NULL

attr(,"specials")$tp
NULL

attr(,"specials")$pvc
NULL

attr(,"specials")$pbm
NULL

attr(,"specials")$pbj
NULL

attr(,"specials")$pbo
NULL

attr(,"specials")$pbz
NULL

attr(,"specials")$pbc
NULL

attr(,"specials")$pbts
NULL

attr(,"specials")$pcat
NULL

attr(,"specials")$pbq
NULL

attr(,"specials")$gmrf
NULL

attr(,"specials")$mrfa
NULL

attr(,"specials")$mrf
NULL

attr(,"specials")$sap
NULL

attr(,"specials")$sap3
NULL

attr(,"specials")$krig
NULL

attr(,"specials")$lo
NULL

attr(,"specials")$random
NULL

attr(,"specials")$re
NULL

attr(,"specials")$fp
NULL

attr(,"specials")$pp
NULL

attr(,"specials")$nl
NULL

attr(,"specials")$ri
NULL

attr(,"specials")$boost
NULL

attr(,"specials")$fk
NULL

attr(,"specials")$own
NULL

attr(,"specials")$test
NULL

attr(,"specials")$test0
NULL

attr(,"specials")$test1
NULL

attr(,"specials")$arma
NULL

attr(,"specials")$rw
NULL

attr(,"specials")$ar
NULL

attr(,"specials")$seas
NULL

attr(,"specials")$srw
NULL

attr(,"specials")$sar
NULL

attr(,"specials")$la
NULL

attr(,"specials")$tr
NULL

attr(,"specials")$ga
NULL

attr(,"specials")$ba
NULL

attr(,"specials")$mm
NULL

attr(,"specials")$nn
NULL

attr(,"specials")$sv
NULL

attr(,"specials")$ma
NULL

attr(,"specials")$pr
NULL

attr(,"specials")$pc
NULL

attr(,"specials")$h2o
NULL

attr(,"specials")$pa
NULL

attr(,"order")
[1] 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: R_GlobalEnv>
attr(,"predvars")
list(y, poly(x, 3, coefs = list(alpha = c(23, 23, 23), norm2 = c(1, 
45, 7590, 1022626, 132532329.6))), qrt)
attr(,"dataClasses")
          y  poly(x, 3)         qrt 
  "numeric" "nmatrix.3"    "factor" 

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