Wednesday, 13 February 2013

IT Business Lab Class 6



IT Business Lab class-6:
 
Assignment: Creating a log of returns data and calculating their historical volatility. Also to Create ACF plot for log returns, and carry out ADF test and interpret  it.


data<-read.csv(file.choose(),header=T)
close<-data$Close
close.ts<-ts(close,frequency=252)
closeshift.ts<-lag(close.ts,k=-1)
numerator<-log(close.ts)-log(closeshift.ts)
numerator
returns<-numerator/log(closeshift.ts)
plot(returns,main="Log Returns;NIFTY 1 Jan 2012 to 31 Jan 2013")
acf(returns,main="Auto Correlation Function on log returns")
adf.test(returns)
T<-252^0.5
histvol<-sd(returns)/T
histvol


Return values:

 


Log returns: 



 

Plot of acf log return:

 

ADF test and Historical Volatility:
 
 Interpretation:
Confidence interval = 95%
implies, Alpha = 0.05
After ADF test, obtained p-value = 0.01 which is < alpha
Hence, we REJECT the null hypothesis.