collinear | R Documentation |
Test for linear or nonlinear collinearity/correlation in data
collinear(x, p = 0.85, nonlinear = FALSE, p.value = 0.001)
x |
A data.frame or matrix containing continuous data |
p |
The correlation cutoff (default is 0.85) |
nonlinear |
A boolean flag for calculating nonlinear correlations (FALSE/TRUE) |
p.value |
If nonlinear is TRUE, the p value to accept as the significance of the correlation |
Messages and a vector of correlated variables
Evaluation of the pairwise linear correlated variables to remove is accomplished through calculating the mean correlations of each variable and selecting the variable with higher mean.
Nonlinear correlations assume the model form:
E(Y_i | X_i) = \alpha + f(X_i) + \varepsilon_i
With the hypothesis:
H_{0} : f(x) = 0, \ \forall x$$
Jeffrey S. Evans <jeffrey_evans<at>tnc.org>
data(cor.data)
# Evaluate linear correlations on linear data
head( dat <- cor.data[[4]] )
pairs(dat, pch=20)
( cor.vars <- collinear( dat ) )
# Remove identified variable(s)
head( dat[,-which(names(dat) %in% cor.vars)] )
# Evaluate linear correlations on nonlinear data
# using nonlinear correlation function
plot(cor.data[[1]], pch=20)
collinear(cor.data[[1]], p=0.80, nonlinear = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.