Assignment 1(a):
Given is data set Mileage & Groove. Groove Impacts Mileage.Fit Linear Model and comment on the applicability of Linear Model
> data<-read.csv(file.choose(),header=T)
> data
mileage groove
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
> reg1<-lm(data$mileage~data$groove)
> reg1
Call:
lm(formula = data$mileage ~ data$groove)
Coefficients:
(Intercept)
data$groove
47.9446 -0.1308
> res<-resid(reg1)
> res
1 2 3 4 5 6 7 8 9
3.6502499 -0.8322206
-1.8696280 -2.5576878 -1.9386386 -1.1442614 -0.5239038 1.4912269
3.7248633
> plot(data$groove,res)
Residual plot is parabolic,hence we cannot do linear regression.
Assignment 1(b):
Given is data set Alpha & Pluto.Fit Linear Model and comment on the applicability of Linear Model
ab<-read.csv(file.choose(),header=T)
ab
alpha
pluto
1 0.150
20
2 0.004
0
3 0.069
10
4 0.030
5
5 0.011
0
6 0.004
0
7 0.041
5
8 0.109
20
9 0.068
10
10 0.009
0
11 0.009
0
12 0.048
10
13 0.006
0
14 0.083
20
15 0.037
5
16 0.039
5
17 0.132
20
18 0.004
0
19 0.006
0
20 0.059
10
21 0.051
10
22 0.002
0
23 0.049
5
> y<-ab$pluto
> x<-ab$alpha
> x
[1] 0.150 0.004
0.069 0.030 0.011 0.004 0.041 0.109 0.068 0.009 0.009 0.048 0.006 0.083 0.037
0.039 0.132 0.004 0.006 0.059 0.051 0.002 0.049
> y
[1] 20 0
10 5 0 0 5 20 10 0 0 10 0 20 5
5 20 0 0 10 10 0 5
> reg<-lm(y~x)
>
res<-resid(reg)
> res
1 2
3 4 5
6 7
8 9
10 11 12
13 14
-4.2173758 -0.0643108
-0.8173877 0.6344584 -1.2223345 -0.0643108 -1.1852930 2.5653342
-0.6519557 -0.8914706 -0.8914706 2.6566833 -0.3951747
6.8665650
15 16 17
18 19
20 21 22
23
-0.5235652 -0.8544291
-1.2396007 -0.0643108 -0.3951747 0.8369318 2.1603874
0.2665531 -2.5087486
>plot(x,res)
>plot(x,res)
Assignment 3:Justify Null Hypothesis Using ANOVA
As P=0.687 and it is >5%, we cannot reject Null Hypothesis





No comments:
Post a Comment