Tuesday, 15 January 2013

ITLAB-Session2

ASSIGNMENT 1:
a)
Create the two matrices

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)


b) Select the highlighted columns

x<-z1[,1]
y<-z2[,3]

c)Use cbind to create a new matrix

z<-cbind(x,y)

 



ASSIGMENT 2: Multiply 2 Matrices


Command used:

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)

result<-z1%*%z2

ASSIGNMENT 3)

z<- read.csv(file.choose(),header=T)
reg1<-lm(high~open,data=z)
residuals(reg1)



ASSIGNMENT 4)

 Generate a Normal distribution data and plot it.

rnorm(N, mean,sd)
where N is the no of observations
mean is the mean vector
sd - standard deviation





No comments:

Post a Comment