![](/img/trans.png)
[英]AR(1) with Nonlinear Least Squares using Marquardt Algorithm: EViews vs R
[英]Regression in R (vs Eviews)
當您在Eviews中進行回歸時,您會獲得如下統計信息的面板:
在R中是否有一種方法可以在一個列表中獲得關於R中的回歸的所有/大部分統計數據?
請參閱summary
,它將為大多數類的回歸對象生成摘要。
例如,來自help(glm)
:
> clotting <- data.frame(
+ u = c(5,10,15,20,30,40,60,80,100),
+ lot1 = c(118,58,42,35,27,25,21,19,18),
+ lot2 = c(69,35,26,21,18,16,13,12,12))
> summary(glm(lot1 ~ log(u), data = clotting, family = Gamma))
Call:
glm(formula = lot1 ~ log(u), family = Gamma, data = clotting)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.04008 -0.03756 -0.02637 0.02905 0.08641
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.0165544 0.0009275 -17.85 4.28e-07 ***
log(u) 0.0153431 0.0004150 36.98 2.75e-09 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for Gamma family taken to be 0.002446059)
Null deviance: 3.51283 on 8 degrees of freedom
Residual deviance: 0.01673 on 7 degrees of freedom
AIC: 37.99
Number of Fisher Scoring iterations: 3
R對GUI程序的重大勝利通常是函數的輸出可用。 所以你可以這樣做:
> s = summary(glm(lot1 ~ log(u), data = clotting, family = Gamma))
> s$coefficients[1,]
Estimate Std. Error t value Pr(>|t|)
-1.655438e-02 9.275466e-04 -1.784749e+01 4.279149e-07
> s$cov.scaled
(Intercept) log(u)
(Intercept) 8.603427e-07 -3.606457e-07
log(u) -3.606457e-07 1.721915e-07
獲取t和p以及參數或縮放協方差矩陣的所有內容。 但是,請務必閱讀摘要方法的文檔,以確保獲得您認為的結果。 有時返回對象中的事物可以在變換后的尺度上計算,並且在打印對象時呈現在未變換的尺度上。
但請注意,您似乎作為示例顯示的是ARIMA模型,並且R中的arima
對象沒有很好的summary
函數:
> m = arima(lh, order = c(1,0,1))
> summary(m)
Length Class Mode
coef 3 -none- numeric
sigma2 1 -none- numeric
var.coef 9 -none- numeric
mask 3 -none- logical
loglik 1 -none- numeric
aic 1 -none- numeric
arma 7 -none- numeric
residuals 48 ts numeric
call 3 -none- call
series 1 -none- character
code 1 -none- numeric
n.cond 1 -none- numeric
model 10 -none- list
這只是包含這些元素的列表對象的默認摘要。 只需打印它就可以獲得以下幾點:
> m
Call:
arima(x = lh, order = c(1, 0, 1))
Coefficients:
ar1 ma1 intercept
0.4522 0.1982 2.4101
s.e. 0.1769 0.1705 0.1358
sigma^2 estimated as 0.1923: log likelihood = -28.76, aic = 65.52
如果m是你的lm
生成模型,只需執行: summary(m)
來獲取所有這些模型統計數據和數字。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.