计算分析题1
Consider the daily simple returns of American Express (AXP), CRSP value-weighted index (VW), CRSP equal-weighted index (EW), and the S&P composite index (SP) from September 01, 2001 to September 30, 2011. Returns of indices include dividends. The data are in the file d-axp3dx-0111.txt (date, axp, vw, ew, sp).
(a) Compute the sample mean, standard deviation, skewness, excess kurtosis,minimum, and maximum of each simple return series.
结果:
code | mean | standard deviation | minmum | maxmum | skew | excess kurtosis |
---|---|---|---|---|---|---|
axp | 0.000534 | 0.026368407 | -0.17595 | 0.206485 | 0.459773 | 9.592052847 |
vw | 0.000224 | 0.013651835 | -0.08976 | 0.114889 | -0.09832 | 7.982133846 |
ew | 0.000626 | 0.012080369 | -0.07824 | 0.107422 | -0.24741 | 8.108427735 |
sp | 9.42E-05 | 0.013779117 | -0.09035 | 0.1158 | 0.008152 | 8.532667329 |
各个简单收益率都为尖顶峰,axp呈明显正偏态,ew呈明显负偏态,vw和sp没有明显的偏态。
(b) Transform the simple returns to log returns. Compute the sample mean,standard deviation, skewness, excess kurtosis, minimum, and maximum of each log return series.
对
数
收
益
率
:
r
t
=
l
o
g
P
t
P
t
−
1
=
l
o
g
(
1
+
R
t
)
R
t
为
简
单
收
益
率
对数收益率:r_t=log \frac{P_t}{P_{t-1}}=log(1+R_t) \qquad R_t为简单收益率
对数收益率:rt=logPt−1Pt=log(1+Rt)Rt为简单收益率
结果:
code | mean | standard deviation | min | max | skew | excess kurtosis |
---|---|---|---|---|---|---|
axp | 0.000188 | 0.026294 | -0.19352 | 0.187711 | 0.020992 | 9.020499 |
vw | 0.000131 | 0.01367 | -0.09405 | 0.108755 | -0.30035 | 7.880082 |
ew | 0.000553 | 0.0121 | -0.08147 | 0.102035 | -0.42732 | 8.017712 |
sp | -7.5E-07 | 0.01379 | -0.0947 | 0.109572 | -0.20636 | 8.322826 |
各个对数收益率都为尖顶峰,vw、ew、sp呈明显负偏态,axp没有明显的偏态。
© Test the null hypothesis that the mean of the log returns of AXP stock is zero. Use 5% significance level to draw your conclusion.
答:通过t检验和z检验,AXP的对数收益率在5%显著性水平的双边检验下不为0。
t检验结果图:
z检验结果图:
代码附录:
#导入d-axp3dx-0111.txt文件
data1 <- read.table(
"D:/Rwork/金融时间序列分析数据/d-axp3dx-0111.txt",
header=T,stringsAsFactors = F)
#(a) Compute the sample mean,
#standard deviation, skewness, excess kurtosis,minimum,
#and maximum of each simple return series.
library(psych)
myvars <- c("axp","vw","ew","sp")
resulta <- describe(data1[myvars])
#导出结果
library(xlsx)
write.xlsx(resulta,"resulta.xlsx")
#(b) Transform the simple returns to log returns.
#Compute the sample mean,standard deviation,
#skewness, excess kurtosis, minimum, and maximum of
#each log return series.
data2 <- transform(data1,axp=log(1+axp),vw=log(1+vw),
ew=log(1+ew),sp=log(1+sp))
resultb <- describe(data2[myvars])
write.xlsx(resultb,"resultb.xlsx")
#Test the null hypothesis that the mean of the log returns of AXP stock is zero.
#Use 5% significance level to draw your conclusion.
library(BSDA)
t.test(x=data2["axp"],mu=0,sigma.x=0.05,alternative="two.sided")
z.test(x=data2["axp"],mu=0,sigma.x=0.05,alternative="two.sided")