R で線形時系列モデルを当てはめようとしています。最初のアプローチは lm を使用していました。
> m1 = lm(logp~logg, data = data)
> summary(m1)
Call:
lm(formula = logp ~ logg, data = data)
Residuals:
Min 1Q Median 3Q Max
-0.56209 -0.21766 -0.02728 0.20243 0.82112
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.14218 0.59651 3.591 0.000556 ***
logg -0.57819 0.04931 -11.725 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2921 on 83 degrees of freedom
Multiple R-squared: 0.6236, Adjusted R-squared: 0.619
F-statistic: 137.5 on 1 and 83 DF, p-value: < 2.2e-16
しかし、残差が自己相関していることに気付き、それを補正したいと考えています。したがって、代わりに gls を使用しました。
> m2 = gls(logp~logg, data = data, correlation=corAR1(form=~1))
> summary(m2)
Generalized least squares fit by REML
Model: logp ~ logg
Data: data
AIC BIC logLik
-83.1498 -73.47444 45.5749
Correlation Structure: AR(1)
Formula: ~1
Parameter estimate(s):
Phi
0.9313839
Coefficients:
Value Std.Error t-value p-value
(Intercept) 4.82358 1.1435778 4.217972 1e-04
logg -0.35891 0.0925918 -3.876257 2e-04
Correlation:
(Intr)
logg 0.986
Standardized residuals:
Min Q1 Med Q3 Max
-1.5206442 -0.7602385 -0.2905489 0.6310135 2.7341294
Residual standard error: 0.3788309
Degrees of freedom: 85 total; 83 residual
ここに示すように、パラメーターの推定値は同じである必要がありますが、t 統計量は異なるはずです。ただし、非常に異なるパラメーター推定値が得られます。何故ですか?私は何か間違ったことをしていますか、それとも統計を誤解していますか?
を使用して適合値を比較するm1$fitted.values
と、m2$fitted
それらはまったく同じです。これにより、gls からのパラメーター推定値は lm からのパラメーター推定値とは異なる方法で解釈されるべきだと思われますが、どうすればよいのでしょうか?