2014-07-15 170 views
-1

當我運行方差分析的迴歸模型,我發展,出現此錯誤:如何對R中的迴歸模型進行方差分析?

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.初學者有沒有人誰幫助我嗎? 謝謝

+0

我們需要一些額外的數據和一個最小的工作示例。 – TARehman

回答

0

錯誤消息表示您需要指定子模型 - 對於非線性迴歸,沒有明顯的選擇,因此您需要執行anova(model3, model0)其中model0對應於另一個模型的擬合 - 可能在一個或多個參數保持不變的情況下。

+0

謝謝你的anova。你不覺得模型的總結沒有完成嗎?我需要知道R平方,並調整R平方。當我運行線性模型的總結時,它包括調整後的R平方但不包含在此模型中。 – user3713988

+0

我爲上述模型運行「summary(model3)$ adj.r.squared」。但結果是「NULL」。爲什麼? – user3713988

+0

這是一個相當普遍公認的觀點,即雖然可以計算非線性迴歸的r平方值,但這並不意味着任何人的期望,所以R保護我們免受不計算它的意義的誘惑。我建議你使用並調整AIC或BIC指標,讓建議r-squared的人更深入地思考他們想要推斷的內容。 –

相關問題