Question
Problem:(20points) Using theRcode(posted below) download five years of daily stock prices for AAPL (2015-2019). Compute the standard deviation and kurtosis of the log-returns at i)
Problem:(20points)
Using theRcode(posted below) download five years of daily stock prices for AAPL (2015-2019). Compute the standard deviation and kurtosis of the log-returns at i) daily, ii) weekly and iii) monthly lags. Make a table with the results and discuss them: what is the trend?
How are these results connected to the stylized property of the financial markets known asAggregational Gaussianity?
library(quantmod)
library(PerformanceAnalytics)
rm(list=ls())
options("getSymbols.warning4.0"=FALSE)
#getSymbols("^GSPC",from="2018-01-01", to="2019-12-30") #Creates the time series object GSPC
getSymbols("XOM",from="2015-01-01", to="2019-12-30") #Creates the time series object GSPC
getSymbols("JPM",from="2020-12-01", to="2021-01-14") #Creates the time series object GSPC
names(XOM)#[1]Open, [2]High, [3]Low [4] Close [5]Volume
head(XOM)
tail(XOM)
tkr <- JPM
plot(Cl(tkr))
tail(tkr)
# compute log-returns
ret.d = periodReturn(tkr,period="daily",type="log")
ret.w = periodReturn(tkr,period="weekly",type="log")
ret.m = periodReturn(tkr,period="monthly",type="log")
ret.d <- ret.d[!is.na(ret.d)]# Remove missing values, if needed
plot(ret.d,main="Daily log returns")
qqnorm(ret.d,main="Q-Q plot")
av.ret.d <- mean(ret.d)
sd.ret.d <- sd(ret.d)
k.ret.d <- kurtosis(ret.d, method="excess")
data.d <- data.frame(av.ret.d, sd.ret.d, k.ret.d)
data.d
ann.vol <- sd.ret.d*sqrt(252)
av.ret.w <- mean(ret.w)
sd.ret.w <- sd(ret.w)
k.ret.w <- kurtosis(ret.w, method="excess")
data.w <- data.frame(av.ret.w, sd.ret.w, k.ret.w)
data.w
av.ret.m <- mean(ret.m)
sd.ret.m <- sd(ret.m)
k.ret.m <- kurtosis(ret.m, method="excess")
data.m <- data.frame(av.ret.m, sd.ret.m, k.ret.m)
data.m
6.5*12
12*5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started