Wednesday, January 16, 2013

Business Application Lab - Day 2

Assignment 1:Matrix Binding
z1<-c(1:9)
z1<-c(1,2,3,4,5,6,7,8,9)
dim(z1)<-c(3,3)


z2<-c(1:9)
z2<-c(32,5,15,48,10,18,1,12,23)
dim(z2)<-c(3,3)

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

z3<-cbind(x,y)


Assignment 2:Matrix Multiplication
Using the matrices created in the first assignment
z3<-z1%*%z2
z3


Assignment 3:Regression
nse<-read.csv(file.choose(),header=T)
open<-nse[,2]
high<-nse[,3]

reg<-lm(high~open,data=nse)
reg
residuals(reg)


Assignment 4: Normal Distribution Plot
x<-seq(-5,5,length=200)
y<-dnorm(x,mean=0,sd=1)
plot(x,y,col="red")



No comments:

Post a Comment