| drop_collinear | R Documentation |
A function to check for multicollinearity and drop collinear terms from a matrix
drop_collinear(matrix)
matrix |
a matrix for which the function will remove collinear columns |
a matrix with collinear columns removed
if (requireNamespace("caret", quietly = TRUE)) {
X <- cbind(1:5, 2 * (1:5), rnorm(5))
colnames(X) <- c("x1", "x2", "x3")
drop_collinear(X) ## x2 dropped as collinear with x1
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.