ITBAL Session 6
Assignment 1:Create a log of returns on data from 01.01.2012 to 31.01.2013 and calculate historical volatility.
2.create ACF plot for log returns perform adf test and interpret.
2.create ACF plot for log returns perform adf test and interpret.
closingprice<-ass1[,5]
closingprice.ts<-ts(closingprice,frequency=252)
temptable<-closingprice.ts-lag(closingprice.ts,k=-1)
lagtable<-cbind(closingprice.ts,lag(closingprice.ts,k=-1),temptable)
lagtable
head(lagtable)
returns<-(closingprice.ts-lag(closingprice.ts,k=-1))/lag(closingprice.ts,k=-1)
l<-scale(returns)+10
logreturns<-log(l)
l<-scale(returns)+10
logreturns<-log(l)
acf(logreturns)
from the above graph we can see the measurements lie with in the 95% confidence interval therefore the time series is stationary.
2.commands
T=(252)^0.5
historicalvolatility<-sd(logreturns)*T
historicalvolatility
adf.test(logreturns)
from the above graph we can see the measurements lie with in the 95% confidence interval therefore the time series is stationary.
2.commands
T=(252)^0.5
historicalvolatility<-sd(logreturns)*T
historicalvolatility
adf.test(logreturns)
From the picture it is clear that p value=0.01 is less than 0.05
Therefore we reject the null hypothesis and accept the alternative hypothesis which states the time series is stationary.



No comments:
Post a Comment