#this post is created as a solution for assignments given on 05/02/2013 in IT & Business Applications Lab, Spring Semester, VGSoM, IIT Kharagpur Class of 2014.
Assignment #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.
Solution:
Steps:
1. Extract the data (from 5/7/2011 to 7/2/2013) in a separate .csv file.2. Find the Returns applying Time series and Lag
3. Draw the plot.
Commands used:
z<-read.csv(file.choose(),header=T)
Closedata<-z$Close
Close.ts<-ts(Closedata)
Close.ts<-ts(Closedata,deltat= 1/252)
znew<-ts(data=Close.ts[10:95],frequency=1,deltat=1/252)
znew.ts<-ts(znew)
znew.diff<-diff(znew)
zdenominator<-lag(znew.ts,K=-1)
Returndata<-znew.diff/zdenominator
plot(Returndata,main=" Returndata for 10 th to 95th day of NSE data downloaded ")
![]() |
| Snapshot of Result |
Assignment #2: 1-700 data is available, Predict the data from 701-850, use the GLM estimation using LOGIT Analysis for the same.
Solution:
Commands:z<-read.csv(file.choose(),header=T)
z1<-z[1:700,1:9]
head(z1)
z1$ed<-factor(z1$ed)
z1.est<-glm(default ~ age + ed + employ + address + income + debtinc + creddebt + othedebt, data=z1, family ="binomial")
summary(z1.est)
forecast<-z[701:850,1:8]
forecast$ed<-factor(forecast$ed)
forecast$probability<-predict(z1.est,newdata=forecast,type="response")
head(forecast)



No comments:
Post a Comment