ASSIGNMENT1: Create log of return data. Find Historical
volatility of it.
(Log St – Log St-1)/ log St-1 or Log [(St- St-1 )/St-1]
ASSIGNMENT2: Create ACF plot on log returns data. Also do
ADF test on it and interpret it. Work with closing price
> data<-read.csv(file.choose(),header=T)
> close<-data$Close
> close.ts<-ts(close,frequency=252)
> closeshift.ts<-lag(close.ts,k=-1)
> n<-log(close.ts)-log(closeshift.ts)
> returns<-n/log(closeshift.ts)
> plot(returns,main="Log Returns")
acf(returns,main="Auto Correlation Function")
> adf.test(returns)
Augmented Dickey-Fuller Test
data: returns
Dickey-Fuller = -5.6217, Lag order = 6, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(returns) : p-value smaller than printed p-value
T<-252^0.5
> HistoricalValue<-sd(returns)/T
> HistoricalValue
[1] 6.825207e-05



No comments:
Post a Comment