You are on page 1of 9

Financial Mathematics

Problem Set 5
Question 3
(a)
Table 1 General Summary
X
MEAN
S.D.
Cor

(b)

Y
0.0090
0.0032
0.8171

0.0750
0.0195

Table 2 Summary for Each ID


ID

12300
12835
14277
17978
18056

Mean
for X
0.009
0.009
0.009
0.009
0.009

S.D. for X

Mean for Y

S.D. for Y

0.003316625 0.075009091 0.020315681


0.003316625
0.075 0.020232449
0.003316625
0.075 0.020304236
0.003316625 0.075009091 0.020316567
0.003316625 0.075009091 0.020305785

Correlation of
X and Y
0.816420516
0.820226175
0.816286739
0.816236506
0.816521437

(c)
The statistic in X is constant across SecIDs, while means and
standard deviation for Y change a little. Therefore, the correlation of X
and Y changes from ID to ID.

Question 4
Line Fit Plot for ID=18056
f(x) = 4.82x + 0.03
R = 0.71

Line Fit Plot for ID=17978


0.12
0.1

f(x) = 5.12x + 0.03


R = 1

0.08

0.06
0.04
0.02
0
0

0.01

0.01

0.01

0.01

0.01

0.02

Line Fit Plot for ID=14277

f(x) = 5.11x + 0.03


R = 0.64

0.01

0.01

0.01

0.01

0.01

0.02

Line Fit Plot for ID=12835

f(x) = 5.37x + 0.03


R = 1

0.01

0.01

0.01

0.01

Line Fit Plot for ID=12300

f(x) = 5.09x + 0.03


R = 0.64

0.01

0.02

The regressions are at the similar level, saying that they are almost
equally good. However, from the R-squares, we can tell that the
regression for ID=18056 is a bit higher than others (0.71comepared with
0.6+).
Question 5
(a)
Table 3 Summary of Each period for Log Return
Ann_mean
Ann_SD
SE
S&P(1-3y)
-0.107843508
0.2614536 0.0826789
8
1
AGG(1-3y)
0.011753093
0.0777226 0.0245780
1
5
S&P(4-6y)
0.110320351
0.2317836 0.0732964
8
3
AGG(4-6y)
0.018812795
0.0478017 0.01511623
S&P(all)
0.04931047
0.2078197 0.0657183
2
7
AGG
0.007117097
0.0541826 0.0171340
2
5

(b)

According to the plots above, neither SPX nor AGG is stationary. From
the charts we observed that both of them have ACF outside white noise
the blue barat lag 1. Therefore, both of them are not stationary.

Shown in the Q-Q Plot, both sets deviate from the theoretical line at the
end, even though they are approximately normal distributed in the
middle. Therefore, they may have a fat tail, making them deviate from the
normal distribution.

(c)

Table 4 Summary for Each Period of Simple Return


Ann_mean
Ann_SD
SE
S&P(1-3y)
-0.07378823
0.2610145 0.0825400
3
4
AGG(1-3y)
0.01474989
0.0771236 0.0243886
5
4
S&P(4-6y)
0.13715499
0.2315683 0.0732283
9
6
AGG(4-6y)
0.01995444
0.0477974 0.01511488
6
S&P(all)
0.07085327
0.2075515 0.0656335
9
7
AGG(all)
0.00857789
0.0539207 0.0170512
3
3
The means of Annual Simple Returns are a bit lower than those of Annual
Log Returns, given the Tylor Extension shown on class. However, the
standard deviations of two return calculations are about the same.
(d)
Table 5 Correlation and Beta for each Period
Correlation
Beta
CAT&SPX(1-3y)
0.7711057
0.05179002
CAT&SPX(4-6y)
0.955098
0.15264288
CAT&SPX all
0.5824057
0.03269968
Personally speaking, I do not think the correlation or beta is stationary.
Though, for most of the case, a portfolio beta is going to be stationary as
it stays at the same level through a long period of time. However, in our
case, the market has experienced huge financial crisis in 2008, making
the beta of portfolio changed a lot. Therefore, its reasonable to say that
the beta and correlation are nor stationary.
Question 6
(a)

Table 6 Data Summary


Mean
9.6
SD
90.49518
(b) -216 is likely to be an outlier.
2169.6
=2.4929504 away
90.49518

It is
P=n [ 1N (2.4929504 ) ]=0.06334325
Z=

(c)
(d)

Table 7 New Data Summary


Mean
34.66667

SD
46.30605
(e) Both the mean and the standard deviation changed quite a bit after
excluding this data point. However, its hard to say whether or not should
we exclude it. Since Chauvenets criterion requires a normal distribution,
such a small sample can hardly satisfy this condition. We may need more
data points or further information about the cause of this extreme point
before reaching to any further conclusions.
(f) Different from previous case, its reasonable to apply Chauvenets
criterion to SPX and AGG daily log return. Since the log return obey
normal distribution and both data set have relatively large samples. The
data satisfy the assumptions of Chauvenets criterion. However, we may
also need to think twice before adopting this criterion. As financial crisis
exerts a relatively long-term effects on overall market, its hard to decide
the exact set of data points to exclude.

Appendix I Coding for R


##### Question5
##### Question (a)
setwd("/Users/Sophie/Dropbox/MIT/Summer 2016/Math/HW/HW5")
data2=read.table("PS5-data2.txt",header=TRUE)
ticker=colnames(data2)[-1]
logreturn=data.frame(matrix(rep(0,nrow(data2)*5),ncol=5))
colnames(logreturn)=paste(ticker,"Log",sep = "_")
data2=cbind.data.frame(data2,logreturn)
for (i in 1:5){
data2[,(i+6)]=c(NA,diff(log(data2[,(i+1)])))
}
period1=data2[1:756,];period2=data2[757:1512,]
Annual_stats=matrix(rep(0,18),ncol=3,
dimnames = list(c("S&P 1-3y","AGG 1-3y","S&P 4-6y","AGG
4-6y","S&P all","AGG all"),
c("Annual_mean","Annual_SD","SE")))
Annual_mean=function(df,stock,years)
sum(df[,stock],na.rm
=
TRUE)/years
Annual_sd=function(df,stock,years)
sd(df[,stock],na.rm
=
TRUE)*sqrt(252)
s=rep(list(period1,period2,data2),each=2);t=rep(c("SPX_Log","AGG_Lo
g"),3);m=rep(c(3,3,10),each=2)
for (i in 1:6){
Annual_stats[i,1]=Annual_mean(s[[i]],t[i],m[i])
Annual_stats[i,2]=Annual_sd(s[[i]],t[i])
Annual_stats[i,3]=Annual_sd(s[[i]],t[i])/sqrt(10)
}
Annual_stats
#####Qustion (b)
par(mfrow=c(1,2))
acf(diff(data2[,"SPX_Log"]), lag.max = 40, type = "correlation", plot = T,
main = "SPX Correlogram", na.action = na.pass)
acf(diff(data2[,"AGG_Log"]), lag.max = 40, type = "correlation", plot =
T, main = "AGG Correlogram", na.action = na.pass)

par(mfrow=c(1,2))
qqnorm(data2[,"SPX_Log"],cex=0.1);qqline(data2[,"SPX_Log"], col = 2)
qqnorm(data2[,"AGG_Log"],cex=0.1);qqline(data2[,"AGG_Log"], col =

2)
##### Question (c)
simplereturn=data.frame(matrix(rep(0,nrow(data2)*5),ncol=5))
colnames(simplereturn)=paste(ticker,"Simple",sep = "_")
data2=cbind.data.frame(data2,simplereturn)
for (i in 1:5){
data2[,(i+11)]=c(exp(data2[,(i+6)])-1)
}
period1=data2[1:756,];period2=data2[757:1512,]
Annual_stats_simple=matrix(rep(0,18),ncol=3,
dimnames = list(c("S&P 1-3y","AGG 1-3y","S&P 4-6y","AGG
4-6y","S&P
all","AGG
all"),
c("Annual_mean","Annual_SD","SE")))
s=rep(list(period1,period2,data2),each=2);t=rep(c("SPX_Simple","AGG_
Simple"),3);m=rep(c(3,3,10),each=2)
for (i in 1:6){
Annual_stats_simple[i,1]=Annual_mean(s[[i]],t[i],m[i])
Annual_stats_simple[i,2]=Annual_sd(s[[i]],t[i])
Annual_stats_simple[i,3]=Annual_sd(s[[i]],t[i])/sqrt(10)
}
Annual_stats_simple
##### Question (d)
beta=matrix(rep(0,6),ncol=2,
dimnames = list(c("CAT&SPX 1-3y","CAT&SPX 46y","CAT&SPX all"),
c("Correlation","Beta")))
beta[1,1]=cor(period1$CAT,period1$SPX);beta[2,1]=cor(period2$CAT,p
eriod2$SPX);beta[3,1]=cor(data2$CAT,data2$SPX)
beta[1,2]=beta[1,1]*sd(period1$CAT)/sd(period1$SPX);beta[2,2]=beta[2,
1]*sd(period2$CAT)/sd(period2$SPX);beta[3,2]=beta[3,1]*sd(data2$CA
T)/sd(data2$SPX)
beta

You might also like