I got this data table and need to calcualte variance inflation factors for all a
ID: 3274141 • Letter: I
Question
I got this data table and need to calcualte variance inflation factors for all avriables.
That's my code
>data = read.csv("U:/Cat Jumping.csv", header=TRUE)
>data<-subset(data,!is.na(sex))
> data$fem[data$sex=='f'] <- 1
> data$fem[data$sex=='m'] <- 0
> M1<-lm(takeoffVelocity~fem+bodyMass+hindLimbLength+muscleMass+bodyFat, data=data)
> vid(M1)
Error in vid(M1) : could not find function "vid"
I can't figure out why there's an error.
cat sex bodyMass hindLimbLength muscleMass bodyFat takeoffVelocity A f 3640 29.1 51.15 29 334.5 B f 2670 28.55 46.05 17 387.3 C m 5600 31.74 95.9 31 410.8 D f 4130 26.9 55.65 39 318.6 E f 3020 26.11 57.2 15 368.7 F f 2660 26.69 48.67 11 358.8 G f 3240 26.74 64.55 21 344.6 H m 5140 27.71 78.8 35 324.6 I f 3690 25.47 54.6 33 301.4 J f 3620 28.18 55.5 15 331.8 K f 5310 28.45 68.8 42 312.6 L m 5560 28.65 79.8 37 316.8 M m 3970 29.82 69.4 20 375.6 N f 3770 26.66 60.25 26 372.4 O f 5100 27.84 60.7 41 314.3 P f 2950 27.89 55.65 25 367.5 Q m 7930 30.58 98.95 48 286.3 R f 3550 28.06 79.25 16 352.5Explanation / Answer
> data=read.table(file.choose(),header=TRUE,sep=" '')
> data<-subset(data,!is.na(sex))
> data$fem[data$sex=='f'] <- 1
> data$fem[data$sex=='m'] <- 0
> M1<-lm(takeoffVelocity~fem+bodyMass+hindLimbLength+muscleMass+bodyFat, data=data)
> ## Then you need to use car library for calculating VIF
> library(car)
> vif(M1)
fem bodyMass hindLimbLength muscleMass bodyFat
2.949728 13.564732 2.105306 5.692910 5.612683
#########################################################################################
Best of Luck :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.