constraints(object, ...)
constraints.vlm(object, type = c("lm", "term"), all = TRUE, which,
matrix.out = FALSE, colnames.arg = TRUE, ...)
vglmff-class
.nvar(object, type = "lm")
and
the number of terms, respectively.all = FALSE
then which
gives the integer index or a
vector of logicals specifying the selection.TRUE
then the constraint matrices
are cbind()ed
together.
The result is usually more compact because the default
is a list of constraint matrices.TRUE
then column names are assigned
corresponding to the variables.type
.constraints()
returns a list comprising of
constraint matrices---usually one for each column of the
VLM model matrix, and in that order.
The list is labelled with the variable names.
Each constraint matrix has $M$ rows, where
$M$ is the number of linear/additive predictors,
and whose rank is equal to the number of columns.
A model with no constraints at all has an order
$M$ identity matrix as each variable's
constraint matrix.
For vglm
and vgam
objects,
feeding in type = "term"
constraint matrices back
into the same model should work and give an identical model.
The default are the "lm"
-type constraint matrices;
this is a list with one constraint matrix per column of
the LM matrix.
See the constraints
argument of vglm
,
and the example below.
VGLMs and VGAMs have constraint matrices which are known. The class of RR-VGLMs have constraint matrices which are unknown and are to be estimated.
Yee, T. W. and Hastie, T. J. (2003) Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15--41.
is.parallel
,
is.zero
.
VGLMs are described in vglm-class
;
RR-VGLMs are described in rrvglm-class
.
Arguments such as zero
and parallel
found in many zero
.
See CommonVGAMffArguments
for more information.
# Fit the proportional odds model:
pneumo <- transform(pneumo, let = log(exposure.time))
(fit1 <- vglm(cbind(normal, mild, severe) ~ sm.bs(let, 3),
cumulative(parallel = TRUE, reverse = TRUE), data = pneumo))
coef(fit1, matrix = TRUE)
constraints(fit1) # Parallel assumption results in this
constraints(fit1, type = "term") # Same as the default ("vlm"-type)
is.parallel(fit1)
# An equivalent model to fit1 (needs the type "term" constraints):
clist.term <- constraints(fit1, type = "term") # "term"-type constraints
(fit2 <- vglm(cbind(normal, mild, severe) ~ sm.bs(let, 3), data = pneumo,
cumulative(reverse = TRUE), constraints = clist.term))
abs(max(coef(fit1, matrix = TRUE) -
coef(fit2, matrix = TRUE))) # Should be zero
# Fit a rank-1 stereotype (RR-multinomial logit) model:
fit <- rrvglm(Country ~ Width + Height + HP, multinomial, data = car.all)
constraints(fit) # All except the first are the estimated A matrix
Run the code above in your browser using DataLab