Wednesday, 23 January 2013

Assignment 3- session 3

Assignment 3

Assignment 3-1) Do an aggression analysis on data provided (mileage vs grooves)  and comment on the results derived.

sol:
> z<- read.csv(file.choose(),header=T)
> z
  mileage  grove
1       0 394.33
2       4 329.50
3       8 291.00
4      12 255.17
5      16 229.33
6      20 204.83
7      24 179.00
8      28 163.83
9      32 150.33

> x<-z$grove
> y<-z$mileage
> reg1<-lm(y~x)
> summary(reg1)

Call:
lm(formula = y ~ x)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.5577 -1.8696 -0.8322  1.4912  3.7249 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 47.94458    2.82389   16.98 6.03e-07 ***
x           -0.13084    0.01103  -11.86 6.87e-06 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 2.549 on 7 degrees of freedom
Multiple R-squared: 0.9526,     Adjusted R-squared: 0.9458 
F-statistic: 140.7 on 1 and 7 DF,  p-value: 6.871e-06 

to plot the graph of the above regression
we use a function 
plot(x, res)
qqnorm(res)
qqline(res)




Comment: Since the residual plot is not scattered but shows a parabolic pattern, we can say that linearity is not applicable in this case.




ASSINMENT 3- 2:: Do the regression analysis on the data provided and comment on the applicability of regression 
The first picure is to retive data




The second graph is to plot the graph of the regression



This above screen shot is to show the residual values of the data





This is to plot the residual values of the data
plot(x, res)



The command used for this plot is as follows:
qqnorm(res)




this is a qq strightline plot:
qqline(res)



Comment:: As this is a random plot and satisfy linearity hence regression can be applied



Assignment 3-3:: To do the avova test and comment on the output


sol::
To retrieve the data
> z<- read.csv(file.choose(),header=T)
> z

   chair com chair1
1      1   2      a
2      1   3      a
3      1   5      a
4      1   3      a
5      1   2      a
6      1   3      a
7      2   5      b
8      2   4      b
9      2   5      b
10     2   4      b
11     2   1      b
12     2   3      b
13     3   3      c
14     3   4      c
15     3   4      c
16     3   5      c
17     3   1      c
18     3   2      c
> z.anova<- aov(z$com~z$chair1)
summary(z.annova)

then we get a plot ::

Conclusion:: assume that the significance level is 5% and confidence interval is 95% then, if p=.687 we can reject the null hypothesis which is all means are the same

No comments:

Post a Comment