σ t σ t σt nikkei HP nikkei4csv H R nikkei4<-readcsv("h:=y=ynikkei4csv",header=t) (1) nikkei header=t nikkei4csv 4 4 nikkei nikkei4<-dataframe(n

Similar documents
28

yamadaiR(cEFA).pdf

(lm) lm AIC 2 / 1

最小2乗法

1 Stata SEM LightStone 3 2 SEM. 2., 2,. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press.

10

4 OLS 4 OLS 4.1 nurseries dual c dual i = c + βnurseries i + ε i (1) 1. OLS Workfile Quick - Estimate Equation OK Equation specification dual c nurser

Statistics for finance Part II

AR(1) y t = φy t 1 + ɛ t, ɛ t N(0, σ 2 ) 1. Mean of y t given y t 1, y t 2, E(y t y t 1, y t 2, ) = φy t 1 2. Variance of y t given y t 1, y t

80 X 1, X 2,, X n ( λ ) λ P(X = x) = f (x; λ) = λx e λ, x = 0, 1, 2, x! l(λ) = n f (x i ; λ) = i=1 i=1 n λ x i e λ i=1 x i! = λ n i=1 x i e nλ n i=1 x

DAA09

Use R

Microsoft Word - 計量研修テキスト_第5版).doc

Microsoft Word - 計量研修テキスト_第5版).doc

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k

講義のーと : データ解析のための統計モデリング. 第3回

k2 ( :35 ) ( k2) (GLM) web web 1 :

Part 1 GARCH () ( ) /24, p.2/93

1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3.

Isogai, T., Building a dynamic correlation network for fat-tailed financial asset returns, Applied Network Science (7):-24, 206,

Stata 11 Stata ts (ARMA) ARCH/GARCH whitepaper mwp 3 mwp-083 arch ARCH 11 mwp-051 arch postestimation 27 mwp-056 arima ARMA 35 mwp-003 arima postestim

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i

y i OLS [0, 1] OLS x i = (1, x 1,i,, x k,i ) β = (β 0, β 1,, β k ) G ( x i β) 1 G i 1 π i π i P {y i = 1 x i } = G (

講義のーと : データ解析のための統計モデリング. 第5回

1 15 R Part : website:

Microsoft Word - 計量研修テキスト_第5版).doc

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM

% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr

kubostat2015e p.2 how to specify Poisson regression model, a GLM GLM how to specify model, a GLM GLM logistic probability distribution Poisson distrib

kubostat2017b p.1 agenda I 2017 (b) probability distribution and maximum likelihood estimation :

untitled

第11回:線形回帰モデルのOLS推定

Microsoft Word - 計量研修テキスト_第5版).doc

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63>

Working Paper Series No March 2012 日本の商品先物市場におけるボラティリティの 長期記憶性に関する分析 三井秀俊 Research Institute of Economic Science College of Economics, Nihon Un

kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : :

こんにちは由美子です

1 kawaguchi p.1/81

Stata11 whitepapers mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F(

カルマンフィルターによるベータ推定( )

こんにちは由美子です

Rによる計量分析:データ解析と可視化 - 第3回 Rの基礎とデータ操作・管理

R John Fox R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R

講義のーと : データ解析のための統計モデリング. 第2回

計量経済分析 2011 年度夏学期期末試験 担当 : 別所俊一郎 以下のすべてに答えなさい. 回答は日本語か英語でおこなうこと. 1. 次のそれぞれの記述が正しいかどうか判定し, 誤りである場合には理由, あるいはより適切な 記述はどのようなものかを述べなさい. (1) You have to wo

untitled

Microsoft Word - 計量研修テキスト_第5版).doc

4.9 Hausman Test Time Fixed Effects Model vs Time Random Effects Model Two-way Fixed Effects Model

Stata User Group Meeting in Kyoto / ( / ) Stata User Group Meeting in Kyoto / 21

こんにちは由美子です

ブック

seminar0220a.dvi

浜松医科大学紀要

GLM PROC GLM y = Xβ + ε y X β ε ε σ 2 E[ε] = 0 var[ε] = σ 2 I σ 2 0 σ 2 =... 0 σ 2 σ 2 I ε σ 2 y E[y] =Xβ var[y] =σ 2 I PROC GLM

> usdata01 と打ち込んでエンター キーを押すと V1 V2 V : : : : のように表示され 読み込まれていることがわかる ここで V1, V2, V3 は R が列のデータに自 動的につけた変数名である ( variable

201711grade2.pdf

.3 ˆβ1 = S, S ˆβ0 = ȳ ˆβ1 S = (β0 + β1i i) β0 β1 S = (i β0 β1i) = 0 β0 S = (i β0 β1i)i = 0 β1 β0, β1 ȳ β0 β1 = 0, (i ȳ β1(i ))i = 0 {(i ȳ)(i ) β1(i ))

: (EQS) /EQUATIONS V1 = 30*V F1 + E1; V2 = 25*V *F1 + E2; V3 = 16*V *F1 + E3; V4 = 10*V F2 + E4; V5 = 19*V99

DVIOUT-ar

1 Tokyo Daily Rainfall (mm) Days (mm)

橡表紙参照.PDF

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or

Table 1 Experimental conditions Fig. 1 Belt sanded surface model Table 2 Factor loadings of final varimax criterion 5 6

自由集会時系列part2web.key

I L01( Wed) : Time-stamp: Wed 07:38 JST hig e, ( ) L01 I(2017) 1 / 19

Microsoft PowerPoint - TA報告(7)

インターネットを活用した経済分析 - フリーソフト Rを使おう

第9回 日経STOCKリーグレポート 審査委員特別賞<地域の元気がでるで賞>

1 Stata SEM LightStone 1 5 SEM Stata Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press. Introduc

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

山形大学紀要

R による共和分分析 1. 共和分分析を行う 1.1 パッケージ urca インスツールする 共和分分析をするために R のパッケージ urca をインスツールする パッケージとは通常の R には含まれていない 追加的な R のコマンドの集まりのようなものである R には追加的に 600 以上のパッ

評論・社会科学 123号(P)☆/1.福田

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0)

03.Œk’ì

ii

J1順位と得点者数の関係分析

untitled

以下の内容について説明する 1. VAR モデル推定する 2. VAR モデルを用いて予測する 3. グレンジャーの因果性を検定する 4. インパルス応答関数を描く 1. VAR モデルを推定する ここでは VAR(p) モデル : R による時系列分析の方法 2 y t = c + Φ 1 y t

第13回:交差項を含む回帰・弾力性の推定

統計研修R分散分析(追加).indd

7. フィリップス曲線 経済統計分析 (2014 年度秋学期 ) フィリップス曲線の推定 ( 経済理論との関連 ) フィリップス曲線とは何か? 物価と失業の関係 トレード オフ 政策運営 ( 財政 金融政策 ) への含意 ( 計量分析の手法 ) 関数形の選択 ( 関係が直線的でない場合の推定 ) 推

Microsoft Word - StatsDirectMA Web ver. 2.0.doc

II (2011 ) ( ) α β û i R

10:30 12:00 P.G. vs vs vs 2

オーストラリア研究紀要 36号(P)☆/3.橋本

プログラム

Stata 11 Stata ROC whitepaper mwp anova/oneway 3 mwp-042 kwallis Kruskal Wallis 28 mwp-045 ranksum/median / 31 mwp-047 roctab/roccomp ROC 34 mwp-050 s

kubostat7f p GLM! logistic regression as usual? N? GLM GLM doesn t work! GLM!! probabilit distribution binomial distribution : : β + β x i link functi

卒業論文

スケーリング理論とはなにか? - --尺度を変えて見えること--


と入力する すると最初の 25 行が表示される 1 行目は変数の名前であり 2 列目は企業番号 (1,,10),3 列目は西暦 (1935,,1954) を表している ( 他のパネルデータを分析する際もデ ータをこのように並べておかなくてはならない つまりまず i=1 を固定し i=1 の t に関

, (GPS: Global Positioning Systemg),.,, (LBS: Local Based Services).. GPS,.,. RFID LAN,.,.,.,,,.,..,.,.,,, i

Web Web Web Web Web, i

Dependent Variable: LOG(GDP00/(E*HOUR)) Date: 02/27/06 Time: 16:39 Sample (adjusted): 1994Q1 2005Q3 Included observations: 47 after adjustments C -1.5

_念3)医療2009_夏.indd

dpri04.dvi

untitled

Studies of Foot Form for Footwear Design (Part 9) : Characteristics of the Foot Form of Young and Elder Women Based on their Sizes of Ball Joint Girth

Transcription:

R 1 R R R tseries fseries 1 tseries fseries R Japan(Tokyo) R library(tseries) library(fseries) 2 t r t t 1 Ω t 1 E[r t Ω t 1 ] ɛ t r t = E[r t Ω t 1 ] + ɛ t ɛ t 2 iid (independently, identically distributed) ɛ t = σ t z t, σ t > 0, z t iid N (0, 1) R Ver241 a-matsumo@osipposaka-uacjp 1 fseries tseries fseries GARCH garchfit 2 [2000] z t z t z t 1

σ t σ t σt 2 225 nikkei HP nikkei4csv H R nikkei4<-readcsv("h:=y=ynikkei4csv",header=t) (1) nikkei header=t nikkei4csv 4 4 nikkei nikkei4<-dataframe(nikkei4) (2) nikkei<-nikkei4[,4] (3) dnikkei dnikkei <-diff(log(nikkei)) (4) dnikkei 21 ARCH(q) ARCH(:Auto-regressive Conditional Heteroskedasticity) σt 2 ɛ 2 t 1, ɛ 2 t 2, ARCH(q) : σ 2 t = ω + q α j ɛ 2 t j, ω > 0, j α j 0 j=1 tseries ARCH garch ARCH(2) arch2 arch2<-garch(dnikkei, order=c(0,2)) (5) summary(arch2) 3 3 ***** ESTIMATION WITH ANALYTICAL GRADIENT ***** Warning: 2

Call: garch(x = dnikkei, order = c(0, 2)) Model: GARCH(0,2) Residuals: Min 1Q Median 3Q Max -755848-054383 001040 056867 609377 Coefficient(s): Estimate Std Error t value Pr(> t ) a0 1366e-04 2783e-06 49077 < 2e-16 *** a1 1157e-01 1452e-02 7971 155e-15 *** a2 8335e-02 1487e-02 5606 207e-08 *** --- Signif codes: 0 *** 0001 ** 001 * 005 01 1 Diagnostic Tests: Jarque Bera Test data: Residuals X-squared = 1611481, df = 2, p-value < 22e-16 Box-Ljung test data: SquaredResiduals X-squared = 11212, df = 1, p-value = 02897 ARCH(2) σ 2 t = 1366 10 4 + 01157ɛ 2 t 1 + 008335ɛ 2 t 2, Std Error: (2783 10 6 ) (001452) (001487) 22 GARCH(p, q) GARCH(:Generalized Auto-regressive Conditional Heteroskedasticity) σt 2 ɛ 2 t 1, ɛ 2 t 2, σt 1, 2 σt 2, 2 GARCH(p, q) : σ 2 t = ω + p β i σt 1 2 + i=1 q α j ɛ 2 t j, ω > 0, i β i 0, j α j 0 j=1 GARCH garch GARCH(1,1) garch11 garch11<-garch(dnikkei, order=c(1,1)) (6) summary(garch11) Call: garch(x = dnikkei, order = c(1, 1)) Model: GARCH(1,1) Residuals: Min 1Q Median 3Q Max -898948-058079 001014 059228 588422 Coefficient(s): Estimate Std Error t value Pr(> t ) a0 3886e-06 4801e-07 8094 666e-16 *** 3

a1 6483e-02 4907e-03 13212 2e-16 *** b1 9134e-01 6331e-03 144286 < 2e-16 *** --- Signif codes: 0 *** 0001 ** 001 * 005 01 1 Diagnostic Tests: Jarque Bera Test data: Residuals X-squared = 2179503, df = 2, p-value < 22e-16 Box-Ljung test data: SquaredResiduals X-squared = 10566, df = 1, p-value = 0304 GARCH(1,1) σ 2 t = 3886 10 6 + 006483ɛ 2 t 1 + 09134σ 2 t 1, Std Error: (4801 10 7 ) (00049) (0006331) 23 ARCH,GARCH GARCH(1,1) summary(garch11) GARCH(1,1) Diagnostic Tests: Jarque Bera Test data: Residuals X-squared = 2179503, df = 2, p-value < 22e-16 Box-Ljung test data: SquaredResiduals X-squared = 10566, df = 1, p-value = 0304 tseries GARCH Jarque Bera Test: p Ljung-Box Test: 1 4 p 5 n<-length(dnikkei) nparam<-length(coef(garch11))-1 L<-30 garchbox<-rep(0,l) garchboxsq<-rep(0,l) for(i in 1:L){ box<-boxtest(garch11$resid,lag=i,type="ljung-box") boxsq<-boxtest(garch11$resid^2,lag=i,type="ljung-box") garchbox[i]<-box$pvalue 4 GARCH ɛ t 5 HP acf pacf plot=false 4

garchboxsq[i]<-boxsq$pvalue } par(mfrow=c(3,4),mar=c(4,4,4,05),las=1) plot(garch11$resid,type="l",main="residual") plot(garchbox,type="b",ylim=c(0,1),main="ljung-box p-value") abline(h=005,lty=2,col="red") abline(v=25) acf(garch11$resid[nparam:n],main="acf") pacf(garch11$resid[nparam:n],main="pacf") cpgram(garch11$resid,main="cumulative Periodgram") qqnorm(garch11$resid,main="normal QQ plot") qqline(garch11$resid) plot(garch11$resid,type="n",bty="n",xlab="",ylab="",xaxt="n",yaxt="n") plot(garch11$resid^2,type="l",main="residual Square") plot(garchboxsq,type="b",ylim=c(0,1),main="ljung-box p-value") abline(h=005,lty=2,col="red") abline(v=25) acf(garch11$resid[nparam:n]^2,main="acf") pacf(garch11$resid[nparam:n]^2,main="pacf") 1 1 1 2 Ljung-Box p (30 ) p p 1 3 ACF 35 ) 5% 0 1 4 PACF( 35 2 1 2 2 QQ 2 4 3 1 Ljung-Box p 30 p 3 2 ACF 35 ) 3 3 PACF 35 5

3 31 EGARCH(p, q) GJR(p, q) ARCH GARCH ARCH GARCH EGARCH GJR GJR(p, q) : GJR(p, q) ɛ t 1 1 0 6

D t 1 σ 2 t = ω + p β i σt i 2 + i=1 q (α j ɛ 2 t j + γ j D t j ɛ2 t j), ω > 0, i, j β i, α j, γ j 0, j=1 EGARCH(p, q) : σt 2 ɛ 2 t j EGARCH ɛ t j σ t j z t j := ɛ t j /σ t j ln(σ 2 t ) = ω + p β i ln(σt i) 2 + i=1 q { α j θzt j + γ( z t j E z t j ) } j=1 R fseries garchoxinterface fseries garchoxinterface Step1: Ox Ox ( PC ) H:=YOxMetrics4=YOx OxMetrics Ox H:=YOx 6 : http://wwweu-tokyoacjp/ omori/ox/indexhtm Step2: Ox Ox G@RCHVer42 H:=YOx=Ypackages http://wwwcoreuclacbe/ laurent/g@rch/site/indexhtml Step3 : GarchOxModelingox Modified GarchOxModelling file H:=YOx=Ylib http://facultychicagogsbedu/rueytsay/teaching/bs41202/sp2007/ Step4 : Step3 A corrected version of the garchoxfit function Modified GarchOxModelling file txt garchoxfit Rtxt 6 H:=YOx 7

R 7 16 command = "C:=Y=YOx=Y=Ybin =Y=Yoxlexe C:=Y=YOx=Y=Ylib=Y=YGarchOxModellingox" C:=Y H:=Y Ox H R source("garchoxfit Rtxt") : garchoxinterface ARMA ARMA(1,0) AR(1) GJR(1,1) m1 m1<-garchoxfit(formulamean= arma(1,0), formulavar= gjr(1,1),series=dif) (7) 8 ******************** ** SPECIFICATIONS ** ******************** Dependent variable : X Mean Equation : ARMA (1, 0) model No regressor in the mean Variance Equation : GJR(1, 1) model No regressor in the variance The distribution is a Gauss distribution Strong convergence using numerical derivatives Log-likelihood = 116989 Maximum Likelihood Estimation (StdErrors based on Second derivatives) Coefficient StdError t-value t-prob Cst(M) 0000101 000021415 04725 06366 AR(1) 0150090 0017042 8807 00000 Cst(V) 0040843 00080254 5089 00000 ARCH(Alpha1) 0068120 00074708 9118 00000 GARCH(Beta1) 0908588 00099891 9096 00000 GHR(Gamma1) 0090895 00336651 2700 00071 No Observations : 3920 No Parameters : 6 Mean (Y) : -000010 Variance (Y) : 000017 Skewness (Y) : -016499 Kurtosis (Y) : 599703 Log Likelihood : 11698930 Alpha[1]+Beta[1]: 097651 Warning : To avoid numerical problems, the estimated parameter Cst(V), and its stderror have been multiplied by 10^4 The sample mean of squared residuals was used to start recursion The positivity constraint for the GARCH (1,1) is observed This constraint is alpha[l]/[1 - beta(l)] >= 0 7 R garchoxfit Rtxt R R C Program Files garchoxfit 8 GARCH CPU 15GHz 512MB PC 8

The unconditional variance is 0000173863 The conditions are alpha[0] > 0, alpha[l] + beta[l] < 1 and alpha[i] + beta[i] >= 0 => See Doornik & Ooms (2001) for more details The condition for existence of the fourth moment of the GARCH is observed The constraint equals 0962849 and should be < 1 => See Ling & McAleer (2001) for details Estimated Parameters Vector : 0000101; 0150090; 0000004; 0068120; 0908588 *************** ** FORECASTS ** *************** Number of Forecasts: 15 Horizon Mean Variance 1 0002854 00001076 2 00005144 0000105 3 00001632 00001026 4 00001105 00001002 5 00001026 978e-005 6 00001014 955e-005 7 00001012 9326e-005 8 00001012 9107e-005 9 00001012 8893e-005 10 00001012 8684e-005 11 00001012 848e-005 12 00001012 8281e-005 13 00001012 8087e-005 14 00001012 7897e-005 15 00001012 7711e-005 Forecasts errors measures cannot be computed because there are not enough out-of-sample observations) Elapsed Time : 4031 seconds (or 00671833 minutes) *********** ** TESTS ** *********** Statistic t-test P-Value Skewness -038815 99251 32391e-023 Excess Kurtosis 35788 45767 000000 Jarque-Bera 21903 NaN 000000 Information Criterium (to be minimized) Akaike -5966291 Shibata -5966294 Schwarz -5958288 Hannan-Quinn -5963451 Q-Statistics on Standardized Residuals --> P-values adjusted by 1 degree(s) of freedom Q( 10) = 869102 [04662708] Q( 15) = 166551 [02750242] Q( 20) = 259216 [01323881] H0 : No serial correlation ==> Accept H0 when prob is High [Q < Chisq(lag)] -------------- Q-Statistics on Squared Standardized Residuals --> P-values adjusted by 2 degree(s) of freedom Q( 10) = 663530 [05764419] Q( 15) = 815385 [08334345] Q( 20) = 110363 [08928108] H0 : No serial correlation ==> Accept H0 when prob is High [Q < Chisq(lag)] -------------- ARCH 1-2 test: F(2,3913)= 086756 [04201] ARCH 1-5 test: F(5,3907)= 074896 [05868] ARCH 1-10 test: F(10,3897)= 057124 [08387] -------------- Diagnostic test based on the news impact curve (EGARCH vs GARCH) Test P-value Sign Bias t-test 073704 046110 Negative Size Bias t-test 014646 088356 Positive Size Bias t-test 125593 020914 Joint Test for the Three Effects 164696 064879 9

Joint Statistic of the Nyblom test of stability: 27826 Individual Nyblom Statistics: Cst(M) 012959 AR(1) 046767 Cst(V) 2091820 ARCH(Alpha1) 2598398 GARCH(Beta1) 2227730 GJR(Gamma1) 2011231 Rem: Asymptotic 1% critical value for individual statistics = 075 Asymptotic 5% critical value for individual statistics = 047 Adjusted Pearson Chi-square Goodness-of-fit test # Cells(g) Statistic P-Value(g-1) P-Value(g-k-1) 40 1285306 0000000 0000000 50 1459184 0000000 0000000 60 1618061 0000000 0000000 Rem: k = 5 = # estimated parameters r t = 0000101 + 015009r t 1 + ɛ t, Std Error: (0000214) (0017042), σ 2 t = 0040843 + 0908588σ 2 t 1 + (006812 + 0090895D t 1 )ɛ2 t 1, Std Error: (000802) (000998) (00076) (00336) AR(1) EGARCH(1,1) m2 m2<-garchoxfit(formulamean= arma(1,0), formulavar= egarch(1,1),series=dif) 32 AIC AIC garch AIC AIC AIC := 2 log L + 2n log L n GARCH(p, q) n = p + q + 1 9 for(p in 1:3){ for(q in 1:3){ tmp<-garch(dif,order=c(p,q)) likelihood<-tmp$nlikeli 9 HP 10

nparam<-length(coef(tmp)) aic<- -2*likelihood+2*nparam cat("order1",p,"order2",q,"aic",aic, "\n")}} 9 AIC 4 Doornik, JA (2002), Object-Oriented Matrix Programming Using Ox, 3rd ed London: Timberlake Consultants Press and Oxford: wwwdoornikcom (2004),, tseries fseries http://cranr-projectorg/src/contrib/descriptions/tserieshtml http://cranr-projectorg/src/contrib/descriptions/fserieshtml Ox garchoxfit http://facultychicagogsbedu/rueytsay/teaching/bs41202/sp2007/ 11