struc_vec: Function to calculate the structure vector matrix X* for...

View source: R/struc_vec.R

struc_vecR Documentation

Function to calculate the structure vector matrix X* for categorical outcomes.

Description

Function to calculate the structure vector matrix X* for categorical outcomes.

Usage

struc_vec(y, X, label = TRUE, rational = FALSE)

Arguments

y

an outcome variable. Should be a factor else we order increasingly in an alpha-numeric fashion.

X

a design matrix, e.g. generated via a call to model.matrix or via the function make_yx. This means we expect that X already contains the desired contrasts for factors (e.g., dummies) and any other expanded columns (e.g., for polynomials).

label

should the structure vector matrix have row and column labels?

rational

should the matrices be returned in rational format?

Details

If X is given as the standard R object for design matrices (i.e., a numeric matrix), the structure vector matrix is returned the same way unless rational=TRUE; then it is returned as a character matrix of rational numbers. If X is given in rational format, it is also returned as rational format even if rational is set to FALSE. This returned matrix is like -nomin_Xstar(y,X).

Value

a matrix of structure vectors with or without labels


divoRce documentation built on April 28, 2026, 3:01 p.m.

Related to struc_vec in divoRce...