Excluding variables specified in a VIF object
Phisically exclude the collinear variables which are identified using
vifstep from a set of variables.
explanatory variables (predictors), defined as a raster object (
an object of class
additional argument as in
Before using this function, you should execute one of
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
Babak Naimi email@example.com
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
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.