R语言—回归诊断(2)
#回归诊断
> state<-as.data.frame(state.x77[,c("Murder","Population","Illiteracy","Income","Frost")])
> fit<-lm(Murder~Population+Illiteracy+Income+Frost,data=state)
> library(gvlma)
> gvmodel<-gvlma(fit)
> summary(gvmodel)
>library(car)
>qqPlot(fit,labels=row.names(states),id.method="identify",simulate=TRUE,main="qqPlot")
>library(car)
>durbinWatsonTest(fit)
>library(car)
>crPlots(fit)
>library(car)
>ncvTest(fit)
>library(car)
>vif(fit)
>sqrt(vif(fit))>2
扫描二维码
获取更多精彩
大康的笔记