Attatched is the data set. Code and commentary in R is greatly appreciated. Than
ID: 3048224 • Letter: A
Question
Attatched is the data set. Code and commentary in R is greatly appreciated. Thank you!
12, ## Problem 1 13 As part of a study of its sheet metal assembly process, a major automobile manufacturer uses sensors that record the deviation from the nominal thickness (millimeters) at 4 locations on a car. Data on 30 cars are given in the 1-.1e car-body. csv (source: Data courtesy of Darek Ceglarek). 14 15 STEP 1 (Data Prepar ation) Download the data 1-.1e car-body. csv. from our course webpage. Read the 1-.1e into R, and reshape the data by using stack O function. You may use the variable names 'v1, v2, v3, v4' as treatment names. (Hint: see codes of previous 1ab.) 16 17 STEP 2 (ANOVA) Perform an ANOVA to test for the null hypothesis SHLOS: mu_1-mu_2-mu_3-mu_4$ vs. SHAS: SH_OS is not true at Salpha-0.055. Check all the appropriate assumptions. 18 19 STEP 3 (Tukey's method) use Tukey's method t1-.nd which individual locations seem to show a cause for concern. 200 21, {r, tidy= TRUE) 22 # Your code here 23 24Explanation / Answer
a)#Importing into R
> data1=read.csv(file.choose(),header=T)
> data1
V1 V2 V3 V4
1 -0.12 0.36 0.40 0.25
2 -0.60 -0.35 0.04 -0.28
3 -0.13 0.05 0.84 0.61
4 -0.46 -0.37 0.30 0.00
5 -0.46 -0.24 0.37 0.13
6 -0.46 -0.16 0.07 0.10
7 -0.46 -0.24 0.13 0.02
8 -0.13 0.05 -0.01 0.09
9 -0.31 -0.16 -0.20 0.23
10 -0.37 -0.24 0.37 0.21
11 -1.08 -0.83 -0.81 0.05
12 -0.42 -0.30 0.37 -0.58
13 -0.31 0.10 -0.24 0.24
14 -0.14 0.06 0.18 -0.50
15 0.61 0.35 0.24 0.75
16 -0.61 -0.30 -0.20 -0.21
17 -0.84 -0.35 -0.14 -0.22
18 -0.96 -0.85 0.19 -0.18
19 -0.90 -0.34 -0.78 -0.15
20 -0.46 0.36 0.24 -0.58
21 -0.90 -0.59 0.13 0.13
22 -0.61 -0.50 -0.34 -0.58
23 -0.61 -0.20 -0.58 -0.20
24 -0.46 -0.30 -0.10 -0.10
25 -0.60 -0.35 -0.45 0.37
26 -0.60 -0.36 -0.34 -0.11
27 -0.31 0.35 -0.45 -0.10
28 -0.60 -0.25 -0.42 0.28
29 -0.31 0.25 -0.34 -0.24
30 -0.36 -0.16 0.15 -0.38
> stack(data1)
values ind
1 -0.12 V1
2 -0.60 V1
3 -0.13 V1
4 -0.46 V1
5 -0.46 V1
6 -0.46 V1
7 -0.46 V1
8 -0.13 V1
9 -0.31 V1
10 -0.37 V1
11 -1.08 V1
12 -0.42 V1
13 -0.31 V1
14 -0.14 V1
15 0.61 V1
16 -0.61 V1
17 -0.84 V1
18 -0.96 V1
19 -0.90 V1
20 -0.46 V1
21 -0.90 V1
22 -0.61 V1
23 -0.61 V1
24 -0.46 V1
25 -0.60 V1
26 -0.60 V1
27 -0.31 V1
28 -0.60 V1
29 -0.31 V1
30 -0.36 V1
31 0.36 V2
32 -0.35 V2
33 0.05 V2
34 -0.37 V2
35 -0.24 V2
36 -0.16 V2
37 -0.24 V2
38 0.05 V2
39 -0.16 V2
40 -0.24 V2
41 -0.83 V2
42 -0.30 V2
43 0.10 V2
44 0.06 V2
45 0.35 V2
46 -0.30 V2
47 -0.35 V2
48 -0.85 V2
49 -0.34 V2
50 0.36 V2
51 -0.59 V2
52 -0.50 V2
53 -0.20 V2
54 -0.30 V2
55 -0.35 V2
56 -0.36 V2
57 0.35 V2
58 -0.25 V2
59 0.25 V2
60 -0.16 V2
61 0.40 V3
62 0.04 V3
63 0.84 V3
64 0.30 V3
65 0.37 V3
66 0.07 V3
67 0.13 V3
68 -0.01 V3
69 -0.20 V3
70 0.37 V3
71 -0.81 V3
72 0.37 V3
73 -0.24 V3
74 0.18 V3
75 0.24 V3
76 -0.20 V3
77 -0.14 V3
78 0.19 V3
79 -0.78 V3
80 0.24 V3
81 0.13 V3
82 -0.34 V3
83 -0.58 V3
84 -0.10 V3
85 -0.45 V3
86 -0.34 V3
87 -0.45 V3
88 -0.42 V3
89 -0.34 V3
90 0.15 V3
91 0.25 V4
92 -0.28 V4
93 0.61 V4
94 0.00 V4
95 0.13 V4
96 0.10 V4
97 0.02 V4
98 0.09 V4
99 0.23 V4
100 0.21 V4
101 0.05 V4
102 -0.58 V4
103 0.24 V4
104 -0.50 V4
105 0.75 V4
106 -0.21 V4
107 -0.22 V4
108 -0.18 V4
109 -0.15 V4
110 -0.58 V4
111 0.13 V4
112 -0.58 V4
113 -0.20 V4
114 -0.10 V4
115 0.37 V4
116 -0.11 V4
117 -0.10 V4
118 0.28 V4
119 -0.24 V4
120 -0.38 V4
> stacked=stack(data1)
> names(stacked)
[1] "values" "ind"
b)#One-way anova
> model=aov(values~ind,data=stacked)
> summary(model)
Df Sum Sq Mean Sq F value Pr(>F)
ind 3 3.647 1.2157 10.56 3.41e-06 ***
Residuals 116 13.352 0.1151
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Since p-value is very small, we reject H0 and conclude that the means of the 4 treatments are significantly different.
c)#TUKEY HSD
> TukeyHSD(model)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = values ~ ind, data = stacked)
$ind
diff lwr upr p adj
V2-V1 0.28200000 0.05365591 0.5103441 0.0089306
V3-V1 0.41966667 0.19132258 0.6480108 0.0000292
V4-V1 0.43400000 0.20565591 0.6623441 0.0000147
V3-V2 0.13766667 -0.09067742 0.3660108 0.3988596
V4-V2 0.15200000 -0.07634409 0.3803441 0.3103339
V4-V3 0.01433333 -0.21401075 0.2426774 0.9984327
Pairs (V1,V2), (V1,V3) and (V1,V4) are significant.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.