异方差检验

等级相关系数诊断

cor.test(mydata$x, abs(residuals(model)), method="spearman", alternative="two.sided")

输出

	Spearman's rank correlation rho

data:  mydata$x and abs(residuals(model))
S = 1424, p-value = 0.002504
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.5653236 

G-Q检验

library(lmtest)
gqtest(model, order.by = ~data$CDA, data =NewData, fraction = 30)

输出

	Goldfeld-Quandt test

data:  model
GQ = 2.9526, df1 = 39, df2 = 39, p-value = 0.0005143
alternative hypothesis: variance increases from segment 1 to 2

最后更新于