Calculates variance inflation factor (VIF) for a set of variables and exclude the highly correlated variables from the set through a stepwise procedure.

1 2 3 |

`x` |
explanatory variables (predictors), defined as a raster object ( |

`th` |
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 `x`

. `vifcor`

and `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 `th`

remains.

addtional arguments:

`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 `VIF`

Babak Naimi naimi.b@gmail.com

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.;

Naimi, B., Hamm, N.A.S., Groen, T.A., Skidmore, A.K., and Toxopeus, A.G. 2012. Where is positional uncertainty a problem for species distribution modelling, Ecography. Submitted.

`exclude`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
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
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.