Wednesday, 13 February 2013
Thursday, 7 February 2013
Assignment # 5
Assignment-1
Download NSE data for a 6months period at least and show the returns, having selected the 10th data point as start and 95th as end.
Download NSE data for a 6months period at least and show the returns, having selected the 10th data point as start and 95th as end.
Commands:-
> z<-read.csv(file.choose(),header=T)
> close<-z$Close
> close.ts<-ts(close)
> close.ts<-ts(close,deltat= 1/252)
> x<-ts(data=close.ts[10:95],frequency=1,deltat=1/252)
> x.ts<-ts(x)
> x.diff<-diff(x)
> y<-lag(x.ts,K=-1)
> Returns<-x.diff/y
> plot(Returns,main=" Returns from 10th to 95th day of NSE Mid-cap Index ")
> z1<-cbind(x.ts,x.diff,Returns)
> plot(z1,main=" Data from 10th to 95th day ; Difference ; Returns")
Assignment#2.
1-700 data is available. Predict the data from 701-850, use the GLM estimation using LOGIT Analysis for the same.
Commands
> logit.eg<- read.csv(file.choose(), header=T)
> z1<-logit.eg[1:700,1:9]
> head(z1)
> z1$ed<-factor(z1$ed)
> z1.est<-glm(default ~ age + ed + employ + address + income, data=z1, family ="binomial")
> summary(z1.est)
> forecast<-logit.eg[701:850,1:8]
> forecast$ed<-factor(forecast$ed)
> forecast$probability<-predict(z1.est,newdata=forecast,type="response")
> head(forecast)
Subscribe to:
Posts (Atom)






