Assignment 1:
Create log of returns for NIFTY data from 01 Jan 2012 to 31 Jan 2013 and calculate the historical volatility
Create log of returns for NIFTY data from 01 Jan 2012 to 31 Jan 2013 and calculate the historical volatility
clprice<-read.csv(file.choose(), header =T)
head(z)
closingprice<-clprice[,5]
closingprice.ts<-ts(closingprice, frequency =252)
st<-log(closingprice.ts)
stlag<-log(lag(closingprice.ts,k=-1))
log.returns<-(st-stlag)/stlag
plot(log.returns)
T =(252) ^ 0.5
historicalvolatility<-sd(returns) * T
historicalvolatility
head(z)
closingprice<-clprice[,5]
closingprice.ts<-ts(closingprice, frequency =252)
st<-log(closingprice.ts)
stlag<-log(lag(closingprice.ts,k=-1))
log.returns<-(st-stlag)/stlag
plot(log.returns)
T =(252) ^ 0.5
historicalvolatility<-sd(returns) * T
historicalvolatility
Assignment 2:
Create ACF plot for the above log of returns data and perform the adf test and comment on it
The ACF plot can be done using the below formula
acf(log.returns)
Create ACF plot for the above log of returns data and perform the adf test and comment on it
The ACF plot can be done using the below formula
acf(log.returns)
The Plot suggests us that our data lies inside the confidence interval of 95% and there is maximum possibility of being stationary.
The ADF test is performed using the below formula:
adf.test(returns)
The ADF test is performed using the below formula:
adf.test(returns)



No comments:
Post a Comment