multi.collinear: Multi-collinearity test

Description Usage Arguments Value Note Author(s) References Examples

View source: R/multi.collinear.R

Description

Test for multi-collinearity in data using qr-matrix decomposition

Usage

1
2
multi.collinear(x, perm = FALSE, leave.out = FALSE, n = 99,
  p = 0.0000001, na.rm = FALSE)

Arguments

x

data.frame or matrix object

perm

(FALSE/TRUE) Should a permutation be applied

leave.out

(FALSE/TRUE) Should a variable be left out at each permutation

n

Number of permutations

p

multi-collinearity threshold

na.rm

(FALSE/TRUE) Remove NA values

Value

If perm == TRUE a data.frame of indicating the frequency that a variable was collinear and, if leave.out = TRUE the number of times it was omitted. Otherwise, a vector of collinear variables is returned. If no colinear variables are identified a NULL is returned.

Note

A permutation approach is not available where, at each iteration, the columns are randomly rearranged and a parameter dropped. The frequency that a variable is identified as collinear is accumulated. The multi-collinearity threshold needs to be adjusted based on number of parameters. For small number(s) of variables (<20) use ~1e-07 and for larger ~0.05

Author(s)

Jeffrey S. Evans <jeffrey_evans<at>tnc.org>

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. Dongarra, J. J., Bunch, J. R., Moler, C. B. and Stewart, G. W. (1978) LINPACK Users Guide. Philadelphia: SIAM Publications.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 
test <- data.frame(v1=seq(0.1, 5, length=100), v2=seq(0.1, 5, length=100), 
                   v3=dnorm(runif(100)), v4=dnorm(runif(100)))
					
# Single test					
  ( cl <- multi.collinear(test) )

# Permutated test with leave out	
( cl.test <- multi.collinear(test, perm = TRUE, leave.out = TRUE, n = 999) )
    cl.test[cl.test$frequency > 0,]$variables
			       
 # Remove identified variable(s)
 head( test[,-which(names(test) %in% cl.test[cl.test$frequency > 0,]$variables)] )

rfUtilities documentation built on Oct. 3, 2019, 9:04 a.m.