Tuesday, 15 January 2013

ITBA Lab session 2

Assignment 1:
The objective is to create two 3 x 3 matrices and select 1 column of matrix 1 and another column  of matrix 2 finally merging  them into another matrix using cbind command.

Command :-

z1<-c(1,2,3,4,5,6,7,8,9)

dim(z1)<-c(3,3)

z2<-c(32,48,01,05,10,12,15,18,23)

dim(z2)<-c(3,3)

x<-z1[,3]

y<-z2[,1]

z3<-cbind(x,y)

Assignment 2:

Multiplication of matrix 1 and 2.

Command :-

mul<-z1%*%z2

mul


 


Assignment 3:

The objective is to read historical data of indices from NSE site from Dec 1 2012 to Dec 31 2012 and finding out the regression and residuals.
 To read NSE file 
 
Command :-
nse<-read.csv(file.choose(),header=T)
reg<-lm(high~open,data=nse)
To find residuals
residuals(reg)

Assignment 4:
The objective is to generate a normal distribution data and plot it.
 
Command :-
x=seq(70,130,length=200)
y=dnorm(x,mean=100,sd=10)
plot(x,y)
 
 


 


 

No comments:

Post a Comment