Wednesday, 23 January 2013

ITBAL-3 on Jan 22

Question 1: 

Fit ‘lm’ and comment on the applicability of ‘lm’
Plot1: Residual vs Independent curve
Plot2: Standard Residual vs independent curve

Command:

data<-read.csv(file.choose(),header=T)
data
x<-data$groove
x
y<-data$mileage
y
reg<-lm(y~x)
res<-resid(reg)
res
plot(x,res)


a) Grooves vs Mileage data:





The plot is parabolic.
So, regression is not possible.

b) Alpha-Pluto data:




A Random plot.
Implies, regression can be applied.


Command:
qqnorm(res)
qqline(res)



Question 2: Justify Null hypothesis for ANOVA

Command:
data<-read.csv(file.choose(),header=T)
data
data.anova<-aov(data$comfort.levels~data$chair1)
summary(data.anova)







Tuesday, 15 January 2013

ITBAL-2 on Jan 15th

A little more knowledge on matrices and some other applications of 'R'.

Question 1 : Column Binding

Command:
mat1<-c(5,2,4,3,6,4,6,7,3,11,9,1,10,4,2,2)
dim(mat1)<-c(4,4)
mat2<-c(4,2,3,5,2,2,1,6,3,6,4,3,2,8,9,11)
dim(mat2)<-c(4,4)
sel1<-mat1[ ,3]
sel2<-mat2[ .2]
matbind<-cbind(sel1,sel2)
matbind



Question 2 : Matrix Multiplication

Command:

mat1<-c(5,2,4,3,6,4,6,7,3,11,9,1,10,4,2,2)
dim(mat1)<-c(4,4)
mat2<-c(4,2,3,5,2,2,1,6,3,6,4,3,2,8,9,11)
dim(mat2)<-c(4,4)
matprd<-mat1%*%mat2
matprd


Question 3 : Linear Regression Model

Data used:


Command:
nse<-read.csv(file.choose(),header=T)
open<-nse[ ,2]
high<-nse[ ,3]
reg<-lm(high~open,data=nse)
reg



Question 4 : Noraml Distribution

Command:
x<-seq(0,200)
y<-dnorm(x,mean=100,sd=20)
plot(x,y,type="l",col="red")











Tuesday, 8 January 2013

ITBAL-1 on Jan 8th

Today's class introduced us to software package 'R' - very useful in statistical computing and graphics. Some of the basic commands and plots. The assignments are below:

Data used:
Nifty Indices from Oct 1, 2012 to Jan 4, 2013. Source - NSE (http://www.nseindia.com/products/content/equities/indices/historical_index_data.htm)

The complete data:

Command:
z<-read.csv(file.choose(),header=T)


Question 1 : Plotting values in histogram

Command:
zcol1<-z[ ,3]



Question 2 : Plotting values 'dots and lines' along with title and labels

Command:
zcol2<-z[ ,4]
plot(zcol2,type="b",main="NSE data",xlab="time",ylab="value")



Question 3 : Plotting scatterchart

Command:
zcol2<-z[ ,3]
plot.default(zcol2,main="NSE Scatter",xlab="time",ylab="value")


Question 4 : Finding max and min indices

Command:
zmerge<-c(zcol1,zcol2)
range(merge)