Excluding variables specified in a VIF object

Share:

Description

Phisically exclude the collinear variables which are identified using vifcor or vifstep from a set of variables.

Usage

1

Arguments

x

explanatory variables (predictors), defined as a raster object (RasterStack or RasterBrick), or as a matrix, or as a data.frame.

vif

an object of class VIF, resulted from vifcor or vifstep functions.

...

additional argument as in vifstep

Details

Before using this function, you should execute one of vifstep or vifcor which detect collinearity based on calculating variance inflation factor (VIF) statistics. If vif is missing, then vifstep is called.

Value

an object of class same as x (i.e. RasterStack or RasterBrick or data.frame or matrix)

Author(s)

Babak Naimi naimi.b@gmail.com

http://r-gis.net

See Also

vif

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
file <- system.file("external/spain.grd", package="usdm")

r <- brick(file) # reading a RasterBrick object including 10 raster layers in Spain

r 

vif(r) # calculates vif for the variables in r

v1 <- vifcor(r, th=0.9) # identify collinear variables that should be excluded

v1

re1 <- exclude(r,v1) # exclude the collinear variables that were identified in 
# the previous step

re1

v2 <- vifstep(r, th=10) # identify collinear variables that should be excluded

v2

re2 <- exclude(r, v2) # exclude the collinear variables that were identified in 
# the previous step

re2

re3 <- exclude(r) # first, vifstep is called 


re3