Automating VIF calculation on mutliple linear models

excelmac

New Member
I came up with this code to calculate VIF for variables for each model I am evaluating

Code:
displayvif<-function(x){
for (i in 1:length(x))
vif(x[[i]])
}
where x is

Code:
models<-lapply(d1,function(data){lm(reformulate(termlabels=".",response=names(data)[1]),data)})
and where d1 is

Code:
d1<-list(A,B,C,D)
where A,B,C and D are dataframes

My displayvif function does not work - it displays nothing

If i use

Code:
vif(x[[i]])
on 'models', i get what i want but the function won't display/create nothing.

Anyone know what is going on?