考虑从1961年1月到2011年9月可口可乐公司的月股票收益率,简单收益率可以从CRSP获取,这里由文件m-ko-6111. txt给出,转换简单收益率为对数收益率。可口可乐公司的月股票收益率,对该对数收益率乘以100,即应用百分比对数收益率。 (a)对该序列建立TGARCH模型,进行模型检验,并给出拟合的模型水平效应不等于0吗? (b)对该序列建立NGARCH模型,进行模型检验,并给出拟合的模型。 (a) > cl=read.table("E:/ m-ko-6111.txt",header=T) > intc=log(cl$ko+1)*100 > source('E:/ Tgarch11.R') > m1 <- Tgarch11(intc) Log likelihood at MLEs: [1] -1933.312 Coefficient(s): Estimate Std. Error t value Pr(>|t|) mu 1.1574960 0.2283502 5.06895 4.0001e-07 *** omega 3.0348902 1.0524445 2.88366 0.0039309 ** alpha 0.0488288 0.0301262 1.62081 0.1050587 gam1 0.0804693 0.0448361 1.79474 0.0726948 . beta 0.8233339 0.0379452 21.69799 < 2.22e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > names(m1) [1] "residuals" "volatility" "par" > at <- m1$residuals > sigt <- m1$volatility > resi <- at/sigt > Box.test(resi, lag=10, type='Ljung') Box-Ljung test data: resi X-squared = 10.08, df = 10, p-value = 0.4335 > Box.test(resi, lag=20, type='Ljung') Box-Ljung test data: resi X-squared = 21.528, df = 20, p-value = 0.3666 > Box.test(resi^2, lag=10, type='Ljung') Box-Ljung test data: resi^2 X-squared = 10.399, df = 10, p-value = 0.4062 > Box.test(resi^2, lag=20, type='Ljung') Box-Ljung test data: resi^2 X-squared = 12.734, df = 20, p-value = 0.8885 > vol <- ts(m1$volatility,start=c(1961,1),frequency=12) > plot(vol,type='l',xlab='year',ylab='vol') 图1 拟合的波动率 > Resi <- ts(resi,start=c(1961,1),frequency=12) > plot(Resi,type='l',xlab='year',ylab='Resi') 图2 标准化残差 适合的TAGRCH模型是: 其中,估计值0.048和0.080的t估计值为1.61和1.79,其他估计值在5%的水平上显著。t检验表明的期望值显著不等于零, resi的Box-Ljung test显示Q(10) = 10.08,p=0.43, resi^2的Box-Ljung test显示Q(10) = 10.40,p=0.41,因此,所拟合的TGARCH模型是合适的。基于该模型和在5%显著性水平下,杠杆效应无统计学意义。 (b) > cl=read.table("E:/doctor Liu/R Documentary/m-ko-6111.txt",header=T) > intc=log(cl$ko+1)*100 > source('E:/doctor Liu/R Documentary/Ngarch.R') > m1 <- Ngarch(intc) Estimation results of NGARCH(1,1) model: estimates: 1.464186 1.154998 0.86844 0.09782551 0.1113541 std.errors: 0.2236933 0.4166718 0.02274459 0.02149025 0.1596848 t-ratio: 6.545508 2.771962 38.18226 4.552088 0.6973369 > res <- m1$residuals > vol <- m1$volatility > resi <- res/vol > Box.test(resi,lag=10,type='Ljung') Box-Ljung test data: resi X-squared = 11.103, df = 10, p-value = 0.3496 > Box.test(resi^2,lag=10,type='Ljung') Box-Ljung test data: resi^2 X-squared = 11.052, df = 10, p-value = 0.3535 vol <- ts(m1$volatility,start=c(1961,1),frequency=12) plot(vol,type='l',xlab='year',ylab='Vol') 图3 拟合的波动率 Resi <- ts(resi,start=c(1961,1),frequency=12) plot(Resi^2,type='l',xlab='year',ylab='Res-sq') 图4 平方残差 适合的TAGRCH模型是: 除了0.111,所有的估计值在5%的水平上都是显著的。设resi为标准化残差。resi的样本t值为-1.50,p值为0.133。对于resi,Ljung Box statistics给出Q(10) = 11.10, p值为0.35;对于resi^2序列,Ljung Box statistics给出Q(10) = 11.05, p值为0.35。因此,该模型适用于对数收益率序列。杠杆效应在5%的水平上并不显著。 |
|