| structure_vectors | R Documentation |
Generic function to compute structure vectors from different types of inputs.
Method for structure_vectors when the input is a formula and data frame.
structure_vectors(x, ...)
## Default S3 method:
structure_vectors(
x,
X,
model = c("b", "bcl", "acl", "os", "sl", "cl"),
label = TRUE,
rational = FALSE,
...
)
## S3 method for class 'formula'
structure_vectors(
x,
data,
contrasts = NULL,
model = NULL,
label = TRUE,
rational = FALSE,
...
)
x |
input object. Supported inputs:
|
... |
Additional arguments. |
X |
a design matrix, e.g. generated via a call to
|
model |
character string specifying the model class to be fitted. One of:
If missing or |
label |
Should the columns and rows be labeled? |
rational |
Should the matrix be returned in rational form (as per rcdd definition)? |
data |
either a standard data frame, list or environment (or object
coercible by Alternatively, |
contrasts |
an optional list. See the |
structure_vectors is an S3 generic function.
The formula method is for standard data frames and formulas that
work the same way as when used with glm. It does
not support extended formulas, and may not work for functions that do
formula processing differently.
For a data frame or matrix given as rational numbers in the rcdd definition, this is recognized but the formula does not get expanded and is taken literally. Consequently:
variables in formula must match exactly with the column
names in data;
factors need to be converted to dummies beforehand (which would not be possible in the rational format in any other way anyway).
A structure vector matrix with or without labeled rows and columns. For model = "sl", a list of structure vector matrices, where each list element corresponds sequentially to the categories of y, starting with the lowest and ending with the (K-1)-th category. At each category k, we consider all observations with category k or higher for the structure vector matrix.
data(qcsepdato)
yo<-qcsepdato$y
Xo<-qcsepdato[,2:ncol(qcsepdato)]
# Sequential link (default method and no labelling)
structure_vectors(yo, Xo, model = "sl", label = FALSE)
# Ordered stereotype (formula method)
structure_vectors(y ~ x1 + x2, data = qcsepdato, model = "os")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.