Excluding variables specified in a VIF object
Phisically exclude the collinear variables which are identified using vifcor
or vifstep
from a set of variables.
exclude(x, vif, ...)
x |
explanatory variables (predictors), defined as a raster object ( |
vif |
an object of class |
... |
additional argument as in |
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.
an object of class same as x
(i.e. RasterStack
or RasterBrick
or data.frame
or matrix
)
Babak Naimi naimi.b@gmail.com
IF you used this method, please cite the following article for which this package is developed:
Naimi, B., Hamm, N.A.S., Groen, T.A., Skidmore, A.K., and Toxopeus, A.G. 2014. Where is positional uncertainty a problem for species distribution modelling?, Ecography 37 (2): 191-203.
## Not run: 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 ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.