Wednesday, 23 January 2013

ITLab Session3




Assignment 1A
Based on the groove and mileage data: mileage is affected by groove.
Fit lm and comment on the applicability of lm
Plot 
      a) Res vs independent variable
      b) Sres vs Independent variable
      c) qqplot and add a qqline.


Solution:





As the residual plot is not a random but shows somewhat a parabolic pattern so it can be stated that linear model is not applicable in the case.

Assignment 1B
Based on alpha pluto data: pluto is dependent variable and alpha is the independent variable.
Fit lm and comment on the applicability of lm
      a) Plot Res vs independent variable

Output:


b) Plot Sres vs independent variable

Output:


Since the above plot does not show any pattern and random in nature so we can safely apply the linear model.

c) qqplot and qqline

Output:



Assignment 2

Based on the chair type and comfort level data: Determine whether the comfort level given by all the types of chairs are same using the ANOVA technique.


Output:


As seen from the solution the p value comes out to be 0.687,which is greater than 5%,our confidence interval of 95%.So we can not reject the null hypothesis.

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:



Tuesday, 8 January 2013

Session 1

 
Posted by Picasa


The code to find the range of highest & lowest of combined column:

> z<- read.csv(file.choose(),header=T)
> zcol1<-z[,3]
> zcol2<-z[,4]
> mergeddata<-c(zcol1,zcol2)
> range(mergeddata)
[1] 4888.20 6020.75
> save.image("E:\\R\\session1")