I am beginner in R doing modelling in R, I loaded excel sheet in R, i have chosen x elements and y elements then fitted model for linear and second order regression. Now I have both models. I am bit confused how to calculate vif for each term in model like e.g model1<-lm(y1~x1+x2+.....x9) when I am using rms package then it's giving me like vif(model1) x1 x2 x3 x4 x5 x6 x7 6.679692 1.520271 1.667125 3.618439 4.931810 2.073879 13.870630 x8 x9 220.969628 214.034135 now i want to compare each term with std vif as vif>=10 and which will satisfy this condition i want to delete that term and update model1. i have done something like this fun = function(model1) { for(i in 1:length(model1)) { v=vif(model1) ss=any(v[i]>=10) if(ss==1){update(model1,.~.,-v[i])} else{print("no update")} i<-i+1 } return(model1) } fun(model1) but giving error as Error in if (ss == 1) { : missing value where TRUE/FALSE needed. please tell me how do i solve this problem. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to calculate vif of each term of model in R?
Methekar, Pushpa (GE Transportation, Non-GE) Wed, 08 Apr 2015 05:52:10 -0700
- [R] How to calculate vif of e... Methekar, Pushpa (GE Transportation, Non-GE)
- Re: [R] How to calculate... PIKAL Petr
- Re: [R] How to calcu... PIKAL Petr
- Re: [R] How to c... PIKAL Petr
- Re: [R] How ... PIKAL Petr
- Re: [R]... PIKAL Petr