Description Usage Arguments Details Value Author(s) See Also Examples
Coefficients (columns) are dropped from a design matrix to ensure that it has full rank.
1 |
X |
a design matrix, e.g., the result of |
silent |
should a message not be issued if X is column rank deficient? |
Redundant columns of the design matrix are identified with the
LINPACK implementation of the qr
decomposition and
removed. The returned design matrix will have qr(X)$rank
columns.
The design matrix X
without redundant columns.
Rune Haubo B Christensen
1 2 3 4 5 6 7 8 9 10 11 12 | X <- model.matrix( ~ PRODID * DAY, data = soup)
ncol(X)
newX <- drop.coef(X)
ncol(newX)
## Essentially this is being computed:
qr.X <- qr(X, tol = 1e-7, LAPACK = FALSE)
newX <- X[, qr.X$pivot[1:qr.X$rank], drop = FALSE]
## is newX of full column rank?
ncol(newX) == qr(newX)$rank
## the number of columns being dropped:
ncol(X) - ncol(newX)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.