Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

model.matrixqrrvglm

Construct the Model Matrix of a QRR-VGLM Object


Description

Creates a model matrix. Two types can be returned: a large one (class "vlm" or one that inherits from this such as "vglm") or a small one (such as returned if it were of class "lm").

Usage

model.matrixqrrvglm(object, type = c("latvar", "lm", "vlm"), ...)

Arguments

object

an object of a class "qrrvglm", i.e., a cqo object.

type

Type of model (or design) matrix returned. The first is the default. The value "latvar" is model matrix mainly comprising of the latent variable values (sometimes called the site scores). The value "lm" is the LM matrix directly corresponding to the formula argument. The value "vlm" is the big VLM model matrix given C.

...

further arguments passed to or from other methods.

Details

This function creates one of several design matrices from object. For example, this can be a small LM object or a big VLM object.

When type = "vlm" this function calls fnumat2R() to construct the big model matrix given C. That is, the constrained coefficients are assumed known, so that something like a large Poisson or logistic regression is set up. This is because all responses are fitted simultaneously here. The columns are labelled in the following order and with the following prefixes: "A" for the A matrix (linear in the latent variables), "D" for the D matrix (quadratic in the latent variables), "x1." for the B_1 matrix (usually contains the intercept; see the argument noRRR in qrrvglm.control).

Value

The design matrix after scaling for a regression model with the specified formula and data. By after scaling, it is meant that it matches the output of coef(qrrvglmObject) rather than the original scaling of the fitted object.

See Also

Examples

## Not run: 
set.seed(1); n <- 40; p <- 3; S <- 4; myrank <- 1
mydata <- rcqo(n, p, S, Rank = myrank, es.opt = TRUE, eq.max = TRUE)
(myform <- attr(mydata, "formula"))
mycqo <- cqo(myform, poissonff, data = mydata,
             I.tol = TRUE, Rank = myrank, Bestof = 5)
model.matrix(mycqo, type = "latvar")
model.matrix(mycqo, type = "lm")
model.matrix(mycqo, type = "vlm")

## End(Not run)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.