Testing for multicollinearity of covariates for occupancy models in R

398 views Asked by At

I am trying to test for multicollinearity among my covariates in an occupancy model in R. I am using the package unmarked for these occupancy models. I have tried using VIF but it seems to not be supported in this package.

Does anyone maybe know how I can test for multicollinearity for occupancy models?

I have 26 covariates so it would be helpful to know if I can eliminate some of them.

Below is my umf for this:

siteCovs <- data.frame(
  SEff=SEff, Undis=Undis, Dis=Dis, Undis_=Undis_, 
  Dis_=Dis_, NDVI=NDVI, WS=WS, WS_=WS_, HS=HS, 
  HS_=HS_, Rdist=Rdist, Tdist=Tdist, N17dist=N17dist, 
  R550dist=R550dist, R29dist=R29dist, R548dist=R548dist, 
  LZKGdist=LZKGdist, Fdist=Fdist, R=R, T=T, N17=N17, 
  R550=R550, R29=R29, R548=R548, LZKG=LZKG, F=F
  )
umf <- unmarkedFrameOccu(
  y=ydat, 
  siteCovs= siteCovs
  )

Thank you!

2

There are 2 answers

0
Monk On

You can test for multi-collinearity using the olsrr package. Example below.

library(olsrr)
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_coll_diag(model)
0
michael On

This might be an issue of naming: there is a vif function in the package unmarked as well as a vif function in the package car.

car::vif is what you'd use on a linear model of the form lm(), whereas unmarked::vif is what you'd use on your occupancy model. To calculate the VIF on occupancy, you'd enter

unmarked::vif(mod = yourmodelhere, type = "state")