Learn R Programming

BMisc (version 1.4.9)

drop_collinear: drop_collinear

Description

A function to check for multicollinearity and drop collinear terms from a matrix

Usage

drop_collinear(matrix)

Value

a matrix with collinear columns removed

Arguments

matrix

a matrix for which the function will remove collinear columns

Examples

Run this code
# \donttest{
  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
  }
# }

Run the code above in your browser using DataLab