VIF and UMF

408 views
Skip to first unread message

frederic sanchis

unread,
Jun 29, 2018, 5:57:05 AM6/29/18
to unmarked
Hello everyone !
i would want to 
controll for multicollinearity on this model with vif
fm<- occu(~ temp ~div_pente+Surf_AO+altitude, umf)
vif(lm(XXXXXXX ~
div_pente+Surf_AO+altitude, data= siteCovs

Is it possible and if so with which variable
response (XXXXXX) ? predicted occupancy ?
thank you for your help

frederic

Marc J. Mazerolle

unread,
Jun 29, 2018, 8:35:09 AM6/29/18
to unmarked

Hi Frederic,


if you want to assess multicollinearity among different predictors with the variance inflation factor (VIF), you can just run a classic linear regression with any random response variable as a function of the predictors of interest. Specifically, to estimate the VIF of a given variable, you 1) regress the variable against the remaining predictors, 2) extract the R^2 of the regression, and then, 3)  VIF = 1/(1 - R^2).


If you're using the vif( ) function in the car package, you can see this using the cement data set:


library(car)

data(cement, package = "AICcmodavg")

head(cement)


##run model with y as response

m1 <- lm(y ~ x1 + x2 + x3 + x4, data = cement)

##extract VIF

vif(m1)


##create bogus variable

cement$bogus <- lm(bogus ~ x1 + x2 + x3 + x4, data = cement)
vif(m2)


It is straightforward to do this for predictors on occupancy. For predictors on detection probability, you'll need to "unfold" the data so that each predictor is in its own column, before estimating VIF.


Hope it helps,


Marc


____________________
Marc J. Mazerolle
Département des sciences du bois et de la forêt
2405 rue de la Terrasse
Université Laval
Québec, Québec G1V OA6, Canada
Tel: (418) 656-2131 ext. 7120
Email: marc.ma...@sbf.ulaval.ca

De : unma...@googlegroups.com <unma...@googlegroups.com> de la part de frederic sanchis <sanch...@gmail.com>
Envoyé : 29 juin 2018 05:51
À : unmarked
Objet : [unmarked] VIF and UMF
 
--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

frederic sanchis

unread,
Jun 29, 2018, 9:59:17 AM6/29/18
to unma...@googlegroups.com
Thanks you for your help marc

I actually use the package car and the vif fonction
it works well with lm model or glm
but how to use it with an occupancy model ? i dont understand
> fm <- occu (~ temp ~ div_pente + Surf_AO + altitude, umf)
> vif (fm)
Error: $ operator not defined for this S4 class

thanks for your help

To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+unsubscribe@googlegroups.com.

Marc J. Mazerolle

unread,
Jun 29, 2018, 10:18:14 AM6/29/18
to unma...@googlegroups.com

Frederic,


in order for it to get the VIF, you need to run the regressions with lm( ), not occu( ). For instance, to determine the VIF for the predictors div_pente, Surf_AO, and  altitude, which are fit on occupancy in your case, then just do:


m1 <- lm(bogusResponse ~ div_pente + Surf_AO + altitude,

data = aClassicDataFrame)

vif(m1)


Here, bogusResponse is a (random) numeric variable that must appear somewhere in your classic R data.frame, not UMF.


Marc

____________________
Marc J. Mazerolle
Département des sciences du bois et de la forêt
2405 rue de la Terrasse
Université Laval
Québec, Québec G1V OA6, Canada
Tel: (418) 656-2131 ext. 7120
Email: marc.ma...@sbf.ulaval.ca
Envoyé : 29 juin 2018 09:59
À : unma...@googlegroups.com
Objet : Re: [unmarked] VIF and UMF
 
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.

frederic sanchis

unread,
Jun 29, 2018, 12:15:23 PM6/29/18
to unma...@googlegroups.com
OK I understand now
I did not understand that it could work with a bogus response variable...
thank you for your answers Marc
Reply all
Reply to author
Forward
0 new messages