Wednesday, 16 January 2013

ITLab: Session2


Assignment 1: 


To create a matrix:
x <- c[1:9]
dim(x) <- c(3,3)

y <- c[10:18]
dim(y) <- c(3,3)

To select a column
z1 <- x[ ,3]
z2 <- y[ ,2]

z3<- cbind(z1,z2)

Output:




Assignment 2:

Multiplication of the matrices.

z <- x %*% y

Output:



Assignment 3:


nse <- read.csv(file.choose(),header=T)

For finding the regression and residuals:

reg <- lm(High ~ Open , data = nse)
residuals(reg)

Output:


Assignment 4:

Generating a normal distribution data & plotting it.

x<-rnorm(40,0,1)
y<-dnorm(x)

plot(x,y)

Output:



No comments:

Post a Comment