给你个上课的例子,后面部分用的是Minitab,但图粘不上来!
Today’s contents:
Multiple Comparisons . Page:87-105
(3-5.4 Contrasts, 3-5.5 Orthogonal Contrasts, and 3-5.6 Scheffe’s Methods for Comparing All Contrasts, are left to you to do exercises)
We still use the example 3-1.
Example 3.1 The Plasma Etching Experiment
Data is as followed:
RF Power(W) Observed Etch Rate(A/min)
1 2 3 4 5
160 575 542 530 539 570
180 565 593 590 579 610
200 600 651 610 637 629
220 725 700 715 685 710
3-5.7 Comparing Pairs of Treatment Means
First, I perform the Tukey’s Test ,also called Tukey’s Honestly Significant Difference Test( abbreviated as HSD).
We already knew that the HSD test focuses on the experiment wise error rate, a, and assumes that the number of replicates at each level are equal. To use the function, an aov object is required as the first argument.
> #eg 3-1
> X=c(575,542,530,539,570,
+ 565,593,590,579,610,
+ 600,651,610,637,629,
+ 725,700,715,685,710)
> A=factor(rep(1:4,each=5))
> #construct a data.frame
> shuju=data.frame(X,A)
> aov.shuju=aov(X~A,data=shuju)
> shuju.tukey=TukeyHSD(aov.shuju,ordered=T)
> shuju.tukey
Tukey multiple comparisons of means
95% family-wise confidence level
factor levels have been ordered
Fit: aov(formula = X ~ A, data = shuju)
$A
diff lwr upr p adj
2-1 36.2 3.145624 69.25438 0.0294279
3-1 74.2 41.145624 107.25438 0.0000455
4-1 155.8 122.745624 188.85438 0.0000000
3-2 38.0 4.945624 71.05438 0.0215995
4-2 119.6 86.545624 152.65438 0.0000001
4-3 81.6 48.545624 114.65438 0.0000146
We can see immediately that all pairs of means are significantly different. Therefore, each power setting results in a mean etch rate that differs from the mean etch rate at any other power setting.
We also can plot the confidence intervals, which is more explicitly.
> plot(shuju.tukey)
Conclusions are the same as before.
Now we perform the LSD test to our above example. The LSD test essentially involves performing a series of pair wise t test. It is important to note that with LSD, we have to specify the individual error rate, not the experimentwise or family error rate.
Assume here that we wish to find the LSD between level 1 and 3.
> n1=sum(aov.shuju$model$A=='1')
> n1
[1] 5
> n3=sum(aov.shuju$model$A=='3')
> n3
[1] 5
> s=sqrt(sum((aov.shuju$residuals)^2)/aov.shuju$df.residual)
> s
[1] 18.26746
> s^2
[1] 333.7
> tcrit=qt(0.025,aov.shuju$df.residual,lower.tail=F)
> tcrit
[1] 2.119905
> LSD=tcrit*s*sqrt(1/n1+1/n3)
> LSD
[1] 24.49202
> #and
> y1.bar=sum(shuju$X[A=='1'])/5
> y1.bar
[1] 551.2
> y3.bar=sum(shuju$X[A=='3'])/5
> y3.bar
[1] 625.4
> y1.bar-y3.bar
[1] -74.2
>
Because , so this implies that level 1 and level 3 ‘s means are significantly different. You can follow the exactly the same routine to compare the rest pair of means.
The Dunnett test can compare treatment means with a control, which is onerous to perform in R. Now I use the Minitab software to do this job.
Step1: Input the data.
Step2: Select the “比较”button ,and we can see that there are three commonly used multiple comparison test (include Fisher’s LSD, and Tukey’s HSD).
Step3: just press ok is ok. Below are the printed results.
————— 2009-4-29 16:04:49 ————————————————————
欢迎使用 Minitab,请按 F1 获得有关帮助。
单因子方差分析: X 与 A
来源 自由度 SS MS F P
A 3 66871 22290 66.80 0.000
误差 16 5339 334
合计 19 72210
S = 18.27 R-Sq = 92.61% R-Sq(调整) = 91.22%
平均值(基于合并标准差)的单组 95% 置信区间
水平 N 平均值 标准差 ---+---------+---------+---------+------
1 5 551.20 20.02 (--*---)
2 5 587.40 16.74 (--*---)
3 5 625.40 20.53 (--*---)
4 5 707.00 15.25 (--*---)
---+---------+---------+---------+------
550 600 650 700
合并标准差 = 18.27
* 错误 * Dunnett 的控制水平不是因子水平之一。
Tukey 95% 同时置信区间
A 水平间的所有配对比较
单组置信水平 = 98.87%
A = 1 减自:
A 下限 中心 上限 -----+---------+---------+---------+----
2 3.11 36.20 69.29 (---*--)
3 41.11 74.20 107.29 (--*---)
4 122.71 155.80 188.89 (---*--)
-----+---------+---------+---------+----
-100 0 100 200
A = 2 减自:
A 下限 中心 上限 -----+---------+---------+---------+----
3 4.91 38.00 71.09 (---*--)
4 86.51 119.60 152.69 (--*--)
-----+---------+---------+---------+----
-100 0 100 200
A = 3 减自:
A 下限 中心 上限 -----+---------+---------+---------+----
4 48.51 81.60 114.69 (--*--)
-----+---------+---------+---------+----
-100 0 100 200
Fisher 95% 两水平差值置信区间
A 水平间的所有配对比较
同时置信水平 = 81.11%
A = 1 减自:
A 下限 中心 上限 ----+---------+---------+---------+-----
2 11.71 36.20 60.69 (--*-)
3 49.71 74.20 98.69 (-*--)
4 131.31 155.80 180.29 (--*-)
----+---------+---------+---------+-----
-100 0 100 200
A = 2 减自:
A 下限 中心 上限 ----+---------+---------+---------+-----
3 13.51 38.00 62.49 (--*-)
4 95.11 119.60 144.09 (-*-)
----+---------+---------+---------+-----
-100 0 100 200
A = 3 减自:
A 下限 中心 上限 ----+---------+---------+---------+-----
4 57.11 81.60 106.09 (-*--)
----+---------+---------+---------+-----
-100 0 100 200
Determining Sample Size
Suppose that in the plasma etching experiment example, the experimenter wished to reject the null hypothesis with probability at least 0.90 if any two treatment means differed by as much as 75 A/min, and alpha=0.01. Then assuming that =25,
Now we first try the replicates is 4 ,then we obtain the below results:
Press ok, then
功效和样本数量
单因子方差分析
Alpha = 0.05 假定标准差 = 25 水平数 = 4
样本 最大
SS 平均值 数量 功效 差值
2812.5 4 0.867819 75
样本数量是指每个水平的。
So we can see we can’t reach the 0.90 power level. So we try replicate is 5, we get below:
功效和样本数量
单因子方差分析
Alpha = 0.05 假定标准差 = 25 水平数 = 4
样本 最大
SS 平均值 数量 功效 差值
2812.5 5 0.953578 75
样本数量是指每个水平的。
Now the power is 0.953578, exceeding 0.90, so we think each replicate is 5 is ok for this example.
We also can plot the OC curve, like below:
|