Pages

Wednesday, 13 February 2013

IT Business Application Lab : Session # 6


Assignment 1: Create log of returns data  and calculate its historical volatility.




Assignment 2: Create ACF plot of log returns and do Augmented Dickey-Fuller test.




Thursday, 7 February 2013

IT Business Application Lab : Session # 5



IT Business Application Lab Assignment: #Session 5

Assignment #1:  Calculate returns after converting a data set into Time Series format. 

Data set used: S&P CNX 500 01-01-2012-31-12-2013
                       http://goo.gl/XwXaQ

Commands Used:


> z<-read.csv(file.choose(),header=T)
> head(z)
> open<-z$Open[10:95]
> open.ts<-ts(open,deltat=1/252)
> open.ts
> summary(open.ts)
> z.diff<-diff(open.ts)
> z.diff
> returns<-cbind(open.ts,z.diff,lag(open.ts,k=-1))
> returns
> plot(returns)
> returns<-z.diff/lag(open.ts,k=-1)
> returns
> plot(returns)




Assignment #2: 1-700 data is available, Predict the data from 701-850, use the GLM estimation  using LOGIT.

Commands Used:



> z<-read.csv(file.choose(),header=T)
> p1<-z[1:700,1:9]
> head(p1)
> p1$ed<-factor(z1$ed)
> p1.est<-glm(default ~ age + ed + employ + address + income, data=p1, family ="binomial")
> summary(p1.est)
> forecast<-z[701:850,1:8]
> forecast$ed<-factor(forecast$ed)
> forecast$probability<-predict(p1.est,newdata=forecast,type="response")
> head(forecast) 


Workspace Text Filehttp://goo.gl/HgyQl