如何对R中的回归模型进行ANOVA?

时间:2014-07-15 15:58:01

标签: r summary anova

当我为我开发的回归模型运行ANOVA时,会出现此错误:

  Error in anova.nls(model3) : nova is only defined for sequences of "nls" objects

此错误的含义是什么?

应该提到的是,当我运行模型摘要时,我只看到模型的估计参数,而没有其他统计参数。这是否意味着该模型仍需要修改,而这不是最终模型?请查看我的模型的说明,摘要和方差分析:

 model3 = nls(Height ~ 1.30 + a*(I(1- exp(-b*Diameter))^c), data = dat1, start = list(a=48,b=0.012,c=0.491), algorithm="port")

 summary(model3)
 anova(model3)

结果如下:

model3 = nls(Height ~ 1.30 + a*(I(1- exp(-b*Diameter))^c), data = dat1, start = list(a=48,b=0.012,c=0.491), algorithm="port")
summary(model3)

Formula: Height ~ 1.3 + a * (I(1 - exp(-b * Diameter))^c)

Parameters:
   Estimate Std. Error t value Pr(>|t|)    
a 43.121923   1.653027  26.087  < 2e-16 ***

b  0.022037   0.003811   5.783 1.38e-08 ***

c  0.914263   0.116202   7.868 2.75e-14 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 5.369 on 446 degrees of freedom

Algorithm "port", convergence message: relative convergence (4) 

anova(model3)
Error in anova.nls(model3) : 
  anova is only defined for sequences of "nls" objects

我是R的初学者。有人帮我吗? 谢谢

1 个答案:

答案 0 :(得分:0)

错误消息表示您需要指定子模型 - 对于非线性回归,没有明显的选择,因此您需要执行anova(model3, model0)其中model0对应适合另一个模型 - 可能是你的一个或多个参数保持不变。