I have inputted bioclimatic variables into R studio in which I wish to test them for collinearity so that I can remove highly correlated variables for completion of a species distribution model. I have managed to stack the raster files so far but haven't gotten any further and cannot find a clear explanation on how to run a vif for raster's. any help would be appreciated.
I have tried making a list, however I cannot seam to get it to work, as when I test for a vif of the list created it states the file needs to be in a file. type
I think that you can test a stacked raster data set for multicollinearity by taking a large sample of pixels, converting them to a dataframe, creating a linear model, and testing for collinerality using
vif()as normal. Personally, I prefer working with theterra::package as it has largely replace theraster::package. Below is a reproducible example. I have included in the comments the alternative functions inraster:::