Assignment 1
1)Find returns of NSE data of greater than 6 months having selected the 10th data point as start and 95th data point as end.
2)Find plot of the return.
>z<-read.csv(file.choose(),header=T)
>close
>close.ts<-ts(close)
>close.ts<-ts(close,deltat=1/12)
>close.ts<-ts(close,deltat=1/252)
>z.diff<-diff(close.ts)
>z.diff
>Returns<-cbind(close.ts,z.diff,lag(close.ts,k=-1)
>Returns
>plot(Returns)
>Returns<-z.diff/lag(close.ts,k=-1)
Assignment 2 question
1-700 data is available, Predict the data from 701-850, use the GLM estimation using LOGIT Analysis for the same.
> z<-read.csv(file.choose(),header=T)
> y<-z[1:700,1:9]
> head(y)
> sapply(y,mean)
> y$ed<-factor(y$ed)
> y.est<-glm(default~age+ed+employ+address+income+debtinc+creddebt+othdebt,data=y,family="binomial")
> summary(y.est)
> confint.default(y.est)
> y2<-with(y,data.frame(age=mean(age),employ=mean(employ),address=mean(address),income=mean(income),debtinc=mean(debtinc),creddebt=mean(creddebt),othdebt=mean(othdebt),ed=factor(1:4)))
> y2$prob<-predict(y.est,newdata=y2,type="response")
> head(y2)
1)Find returns of NSE data of greater than 6 months having selected the 10th data point as start and 95th data point as end.
2)Find plot of the return.
>z<-read.csv(file.choose(),header=T)
>head(z)
>close<-z$Close
>close
>close.ts<-ts(close)
>close.ts<-ts(close,deltat=1/12)
>close.ts<-ts(close,deltat=1/252)
>z.diff<-diff(close.ts)
>z.diff
>Returns<-cbind(close.ts,z.diff,lag(close.ts,k=-1)
>Returns
>plot(Returns)
>Returns<-z.diff/lag(close.ts,k=-1)
> z<-read.csv(file.choose(),header=T)
> y<-z[1:700,1:9]
> head(y)
> sapply(y,mean)
> y$ed<-factor(y$ed)
> y.est<-glm(default~age+ed+employ+address+income+debtinc+creddebt+othdebt,data=y,family="binomial")
> summary(y.est)
> confint.default(y.est)
> y2<-with(y,data.frame(age=mean(age),employ=mean(employ),address=mean(address),income=mean(income),debtinc=mean(debtinc),creddebt=mean(creddebt),othdebt=mean(othdebt),ed=factor(1:4)))
> y2$prob<-predict(y.est,newdata=y2,type="response")
> head(y2)





