Calculates variance inflation factor (VIF) for a set of variables and exclude the highly correlated variables from the set through a stepwise procedure. This method can be used to deal with multicollinearity problems when you fit statistical models
1 2 3
explanatory variables (predictors), defined as a raster object (
a number specifying the correlation threshold for vifcor and VIF threshold for vifstep (see details).
additional arguments. see details.
VIF can be used to detect collinearity (Strong correlation between two or more predictor variables). Collinearity causes instability in parameter estimation in regression-type models. The VIF is based on the square of the multiple correlation coefficient resulting from regressing a predictor variable against all other predictor variables. If a variable has a strong linear relationship with at least one other variables, the correlation coefficient would be close to 1, and VIF for that variable would be large. A VIF greater than 10 is a signal that the model has a collinearity problem.
vif function calculates this statistic for all variables in
vifstep uses two different strategy to exclude highly collinear variable through a stepwise procedure.
vifcor, first find a pair of variables which has the maximum linear correlation (greater than th), and exclude one of them which has greater VIF. The procedure is repeated untill no variable with a high corrrelation coefficient (grater than threshold) with other variables remains.
vifstep calculate VIF for all variables, exclude one with highest VIF (greater than threshold), repeat the procedure untill no variables with VIF greater than
maxobservations a number (default=5000) specifying the maximum number of observations should be contributed in calculation of VIF. When the number of observations (cells in raster or rows in data.frame/matrix) is greater than
maxobservations, then a random sample with a size of
maxobservations is drawn to keep the calculation effecient.
an object of class
Babak Naimi firstname.lastname@example.org
Chatterjee, S. and Hadi, A. S. 2006. Regression analysis by example. John Wiley and Sons.;
Dormann, C. F. et al. 2012. Collinearity: A review of methods to Deal with it and a simulation study evaluating their performance. Ecography 35: 001-020.;
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## 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 v2 <- vifstep(r, th=10) # identify collinear variables that should be excluded v2 ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.