(Bing Image Creator で生成: プロンプト: Close up of blue Hydrangea, pink Hydrangea and green hydrangea flowers, photo)
の続きです。前回の分析で、static model, FDL model, AR(1) model すべてで Serail Correlation があることがわかりました。
なので今回は、Cochrane-Ourcutt 法でモデルを推定してみたいと思います。
まず orcutt パッケージの読み込みをします。
そうしたら、cochrane.orcutt() 関数を使います。
stargazer() 関数で OLSで推定したモデルと Cochrane-Orcuttで推定したモデルを比較してみます。
OLS で推計したモデルでは、Lg5 の係数は 0.174で、Cochrane-Orcutt では0.005とかなり小さい値になりました。
両者の推定した tpxをみてみましょう。
黒い線はOLSで推定したtpxで、赤い線がCochrane-Orcuttで推定した線です。緑の線が実際のtpxです。赤い線はほとんど水平線ですね。
次は、FDL modelでも同じことをしてみます。
Cochrane-Orcuttで推定したモデルは、係数の値がかなり小さくなっています。
推定したtpxをグラフを描いてみます。
Static Model と同様に Cochrane-Orcuttで推定した値はほとんど水平線です。
それでは、最後、AR(1) Model も同様の分析をしましょう。
こんどは、OLSで推定した係数とCochrane-Orcuttで推定した係数が同じくらいの値になりましたね。
グラフを描いてみましょう。
3つの線が区別できないほどですね。
ここまでの結果を考慮すると、Static Model, FDL Model よりは AR(1) Model のほうがtpx: 東証株価指数の値を説明するモデルとしては適切なようです。
今回は以上です。
次回は、
です。
はじめから読むには、
です。
今回のコードは以下になります。
#
# orcuttパッケージの読み込み
library(orcutt)
#
# static_model を Cochrane-Orcutt で
static_model_oc <- cochrane.orcutt(static_model)
summary(static_model_oc)
#
# OLS と Cochrane-Orcutt の比較
stargazer(static_model, static_model_oc,
type = "text")
#
# OLSの推定値とCochrane-Orcuttの推定値
plot(predict(static_model), type = "l", main = "Static Model")
lines(predict(static_model_oc), col = 2)
lines(df$tpx, col = 3)
legend("topright", c("OLS", "CO", "Actual"), col = c(1, 2, 3),
lty = c(1, 1, 1))
#
# FDL modelをCochrane-Orcuttで推定
FDL_model_co <- cochrane.orcutt(FDL_model)
#
# OLSとの比較
stargazer(FDL_model, FDL_model_co, type = "text")
#
# OLSの推定値とCochrane-Orcuttの推定値
plot(predict(FDL_model), type = "l", main = "FDL Model")
lines(predict(FDL_model_co), col = 2)
lines(df$tpx, col = 3)
legend("bottomright", c("OLS", "CO", "Actual"), col = c(1, 2, 3),
lty = 1)
#
# AR(1) model を Cochrane-Orcutt で推定
AR1_model_co <- cochrane.orcutt(AR1_model)
#
# OLS との比較
stargazer(AR1_model, AR1_model_co, type = "text")
#
# OLSの推定値とCochrane-Orcuttの推定値のグラフ
plot(predict(AR1_model), type = "l", main = "AR(1) Model")
lines(predict(AR1_model_co), col = 2)
lines(df$tpx, col = 3)
legend("bottomright", c("OLS", "CO", "Actual"), col = c(1, 2, 3),
lty = 1)
#