Tuesday, 22 January 2013

IT and Business Application lab : Assignment 3


Problem 1: Using Mileage-Groove data, fit 'lm' and 'comment on the applicability of 'lm'.
Solution:
Commands:
>test1<-read.csv(file.choose(),header=T)


> a<-test1$mileage
> b<-test1$groove
> reg1<- lm(a~b)
> reg1


> res_var<-resid(reg1)
> res_var


> plot(b,res_var)

> qqnorm(res_var)

>qqline(res_var)

Linear Regression is not applicable as can be seen from the graph

Problem 2:
a) Plot residual and standard residual of independent variable
Solution: 
Commands:
 > test2<-read.csv(file.choose(),header=T)

> a<-test2$Pluto
> b<-test2$alpha
> reg1<- lm(a~b)
> reg1


> res_var<-resid(reg1)
> sres<-rstandard(reg1)



B) Plot qqplot and add a qqline
Solution:
Commands:
> plot(b,res_var)
> qqnorm(res_var)


> qqline(res_var)

Problem 3: Justify null hypothesis using Anova
Solution:
Commands:
> anova1<-read.csv(file.choose(),header=T)
> anova2<-aov(anova1$Comfort_level~anova1$Chair)     

p value=0.687
Since p-value is greater than 5%, we can't reject the null hypothesis.
 











No comments:

Post a Comment