coefvlm: Extract Model Coefficients

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

View source: R/coef.vlm.q

Description

Extracts the estimated coefficients from VLM objects such as VGLMs.

Usage

1
coefvlm(object, matrix.out = FALSE, label = TRUE, colon = FALSE)

Arguments

object

An object for which the extraction of coefficients is meaningful. This will usually be a vglm object.

matrix.out

Logical. If TRUE then a matrix is returned. The explanatory variables are the rows. The linear/additive predictors are the columns. The constraint matrices are used to compute this matrix.

label

Logical. If FALSE then the names of the vector of coefficients are set to NULL.

colon

Logical. Explanatory variables which appear in more than one linear/additive predictor are labelled with a colon, e.g., age:1, age:2. However, if it only appears in one linear/additive predictor then the :1 is omitted by default. Then setting colon = TRUE will add the :1.

Details

This function works in a similar way to applying coef() to a lm or glm object. However, for VGLMs, there are more options available.

Value

A vector usually. A matrix if matrix.out = TRUE.

Author(s)

Thomas W. Yee

References

Yee, T. W. and Hastie, T. J. (2003). Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15–41.

See Also

vglm, coefvgam, coef.

Examples

1
2
3
4
5
6
7
8
9
zdata <- data.frame(x2 = runif(nn <- 200))
zdata <- transform(zdata, pstr0  = logitlink(-0.5 + 1*x2, inverse = TRUE),
                          lambda =   loglink( 0.5 + 2*x2, inverse = TRUE))
zdata <- transform(zdata, y2 = rzipois(nn, lambda, pstr0 = pstr0))

fit2 <- vglm(y2 ~ x2, zipoisson(zero = 1), data = zdata, trace = TRUE)
coef(fit2, matrix = TRUE)  # Always a good idea
coef(fit2)
coef(fit2, colon = TRUE)

Example output

Loading required package: stats4
Loading required package: splines
VGLM    linear loop  1 :  loglikelihood = -329.26758
VGLM    linear loop  2 :  loglikelihood = -322.91825
VGLM    linear loop  3 :  loglikelihood = -322.86076
VGLM    linear loop  4 :  loglikelihood = -322.8607
VGLM    linear loop  5 :  loglikelihood = -322.8607
            logitlink(pstr0) loglink(lambda)
(Intercept)        0.1273753       0.4837249
x2                 0.0000000       2.0919330
(Intercept):1 (Intercept):2            x2 
    0.1273753     0.4837249     2.0919330 
(Intercept):1 (Intercept):2          x2:1 
    0.1273753     0.4837249     2.0919330 

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.