###### Example 1: Fuel consumption of automobiles
Auto <- ISLR::Auto
fit1 <- glm(mpg ~ weight*horsepower, family=inverse.gaussian("log"), data=Auto)
vdtest(fit1)
vdtest(fit1,varformula= ~ weight + horsepower)
vdtest(fit1,varformula= ~ log(weight) + log(horsepower))
###### Example 2: Hill races in Scotland
data(races)
fit2 <- glm(rtime ~ log(distance) + cclimb, family=Gamma("log"), data=races)
vdtest(fit2)
vdtest(fit2,varformula= ~ distance + cclimb)
vdtest(fit2,varformula= ~ log(distance) + log(cclimb))
###### Example 3: Mammal brain and body weights
data(brains)
fit3 <- glm(BrainWt ~ log(BodyWt), family=Gamma("log"), data=brains)
vdtest(fit3)
vdtest(fit3,varformula= ~ BodyWt)
Run the code above in your browser using DataLab