You are on page 1of 7

> dat1 = read.table("Prob13_9.

txt", header=TRUE)
> r = c(t(as.matrix(dat1))) # response data
> f = c("1", "2", "3", "4", "5") # treatment levels
> k = 5 # number of treatment levels
> n = 4 # observations per treatment
> tm = gl(k, 1, n*k, factor(f)) # matching treatments
> tm
[1] 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Levels: 1 2 3 4 5
> fit1 = aov(r ~ tm)
> summary(fit1)
Df Sum Sq Mean Sq F value Pr(>F)
tm 4 1060.5 265.13 16.35 2.41e-05 ***
Residuals 15 243.3 16.22
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1

> confint(fit1 , level=0.95)


2.5 % 97.5 %
(Intercept) 140.708335 149.291665
tm2 -5.819331 6.319331
tm3 -19.569331 -7.430669
tm4 -21.819331 -9.680669
tm5 -5.819331 6.319331

> TukeyHSD(fit1, which="tm", conf.level=0.95)


Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = r ~ tm)

$tm
diff lwr upr p adj
2-1 0.25 -8.542907 9.042907 0.9999848
3-1 -13.50 -22.292907 -4.707093 0.0020819
4-1 -15.75 -24.542907 -6.957093 0.0004735
5-1 0.25 -8.542907 9.042907 0.9999848
3-2 -13.75 -22.542907 -4.957093 0.0017610
4-2 -16.00 -24.792907 -7.207093 0.0004032
5-2 0.00 -8.792907 8.792907 1.0000000
4-3 -2.25 -11.042907 6.542907 0.9295416
5-3 13.75 4.957093 22.542907 0.0017610
5-4 16.00 7.207093 24.792907 0.0004032

> TukeyHSD(fit1, which="tm", conf.level=0.99)


Tukey multiple comparisons of means
99% family-wise confidence level

Fit: aov(formula = r ~ tm)

$tm
diff lwr upr p adj
2-1 0.25 -10.936528 11.436528 0.9999848
3-1 -13.50 -24.686528 -2.313472 0.0020819
4-1 -15.75 -26.936528 -4.563472 0.0004735
5-1 0.25 -10.936528 11.436528 0.9999848
3-2 -13.75 -24.936528 -2.563472 0.0017610
4-2 -16.00 -27.186528 -4.813472 0.0004032
5-2 0.00 -11.186528 11.186528 1.0000000
4-3 -2.25 -13.436528 8.936528 0.9295416
5-3 13.75 2.563472 24.936528 0.0017610
5-4 16.00 4.813472 27.186528 0.0004032

> summary.lm(fit1)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 145.00 2.013496 72.0140445 1.808147e-20
tm2 0.25 2.847514 0.0877959 9.312003e-01
tm3 -13.50 2.847514 -4.7409783 2.626399e-04
tm4 -15.75 2.847514 -5.5311414 5.759637e-05
tm5 0.25 2.847514 0.0877959 9.312003e-01
> with(dat1, pairwise.t.test(x=r, g=tm, p.adjust="none"))

Pairwise comparisons using t tests with pooled SD

data: r and tm

1 2 3 4
2 0.93120 - - -
3 0.00026 0.00022 - -
4 5.8e-05 4.9e-05 0.44175 -
5 0.93120 1.00000 0.00022 4.9e-05

P value adjustment method: none


___________________________________________________________________________________
________

> dat1 = read.table("Prob13_13.txt", header=TRUE)


> r = c(t(as.matrix(dat1))) # response data
> f = c("1", "2", "3") # treatment levels
> k = 3 # number of treatment levels
> n = 8 # observations per treatment
> tm = gl(k, 1, n*k, factor(f)) # matching treatments

> fit1 = aov(r ~ tm)


> summary(fit1)
Df Sum Sq Mean Sq F value Pr(>F)
tm 2 1230 615.1 8.303 0.0022 **
Residuals 21 1556 74.1
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
>

> confint(fit1,level=0.95)
2.5 % 97.5 %
(Intercept) 86.54654 99.203459
tm2 -19.69979 -1.800208
tm3 -26.32479 -8.425208
>

> TukeyHSD(fit1, which="tm", conf.level=0.95)


Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = r ~ tm)

$tm
diff lwr upr p adj
2-1 -10.750 -21.59749 0.09748522 0.0523749
3-1 -17.375 -28.22249 -6.52751478 0.0016511
3-2 -6.625 -17.47249 4.22248522 0.2934856

> summary.lm(fit1)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 92.875 3.043093 30.519932 7.005844e-19
tm2 -10.750 4.303584 -2.497918 2.087192e-02
tm3 -17.375 4.303584 -4.037333 5.942641e-04
>

> with(dat1, pairwise.t.test(x=r, g=tm, p.adjust="none"))

Pairwise comparisons using t tests with pooled SD

data: r and tm

1 2
2 0.02087 -
3 0.00059 0.13864

P value adjustment method: none


>
___________________________________________________________________________________
_____

> dat1 = read.table("Prob13_34.txt", header=TRUE)


> r = c(t(as.matrix(dat1))) # response data
> f = c("1","2","3","4") # treatment levels
> k = 4 # number of treatment levels
> n = 3 # observations per treatment
> tm = gl(k, 1, n*k, factor(f)) # matching treatments
> fit1 = aov(r ~ tm)
> summary(fit1)
Df Sum Sq Mean Sq F value Pr(>F)
tm 3 16.220 5.407 8.29 0.00775 **
Residuals 8 5.217 0.652
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
>

> TukeyHSD(fit1, which="tm")


Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = r ~ tm)

$tm
diff lwr upr p adj
2-1 -2.5333333 -4.644917 -0.4217497 0.0206120
3-1 -2.3800000 -4.491584 -0.2684164 0.0283387
4-1 -2.9900000 -5.101584 -0.8784164 0.0082686
3-2 0.1533333 -1.958250 2.2649170 0.9952095
4-2 -0.4566667 -2.568250 1.6549170 0.8971196
4-3 -0.6100000 -2.721584 1.5015836 0.7927948

> summary.lm(fit1)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.306667 0.4662558 9.236704 1.530541e-05
tm2 -2.533333 0.6593852 -3.841962 4.933436e-03
tm3 -2.380000 0.6593852 -3.609423 6.887443e-03
tm4 -2.990000 0.6593852 -4.534527 1.912928e-03
>

> summary.lm(fit1)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.306667 0.4662558 9.236704 1.530541e-05
tm2 -2.533333 0.6593852 -3.841962 4.933436e-03
tm3 -2.380000 0.6593852 -3.609423 6.887443e-03
tm4 -2.990000 0.6593852 -4.534527 1.912928e-03
> with(dat1, pairwise.t.test(x=r, g=tm, p.adjust="none"))

Pairwise comparisons using t tests with pooled SD

data: r and tm

1 2 3
2 0.0049 - -
3 0.0069 0.8220 -
4 0.0019 0.5082 0.3820

P value adjustment method: none


___________________________________________________________________________________
____

> dat1 = read.table("Prob13_36.txt", header=TRUE)


> r = c(t(as.matrix(dat1))) # response data
> f = c("1","2","3","4","5","6") # treatment levels
> k = 6 # number of treatment levels
> n = 5 # observations per treatment
> tm = gl(k, 1, n*k, factor(f)) # matching treatments
> fit1 = aov(r ~ tm)
> summary(fit1)
Df Sum Sq Mean Sq F value Pr(>F)
tm 5 56358 11272 4.598 0.0044 **
Residuals 24 58830 2451
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
> TukeyHSD(fit1, which="tm")
Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = r ~ tm)

$tm
diff lwr upr p adj
2-1 23 -73.817441 119.817441 0.9755182
3-1 59 -37.817441 155.817441 0.4351166
4-1 -7 -103.817441 89.817441 0.9999123
5-1 95 -1.817441 191.817441 0.0566135
6-1 -35 -131.817441 61.817441 0.8692420
3-2 36 -60.817441 132.817441 0.8555312
4-2 -30 -126.817441 66.817441 0.9266129
5-2 72 -24.817441 168.817441 0.2328963
6-2 -58 -154.817441 38.817441 0.4535356
4-3 -66 -162.817441 30.817441 0.3167183
5-3 36 -60.817441 132.817441 0.8555312
6-3 -94 -190.817441 2.817441 0.0605798
5-4 102 5.182559 198.817441 0.0348199
6-4 -28 -124.817441 68.817441 0.9442034
6-5 -130 -226.817441 -33.182559 0.0042948

> summary.lm(fit1)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1505 22.14159 67.9716322 5.861629e-29
tm2 23 31.31294 0.7345207 4.697479e-01
tm3 59 31.31294 1.8842053 7.170663e-02
tm4 -7 31.31294 -0.2235498 8.249996e-01
tm5 95 31.31294 3.0338898 5.724834e-03
tm6 -35 31.31294 -1.1177489 2.747387e-01
> with(dat1, pairwise.t.test(x=r, g=tm, p.adjust="none"))

Pairwise comparisons using t tests with pooled SD

data: r and tm

1 2 3 4 5
2 0.46975 - - - -
3 0.07171 0.26160 - - -
4 0.82500 0.34758 0.04568 - -
5 0.00572 0.03049 0.26160 0.00334 -
6 0.27474 0.07633 0.00618 0.38010 0.00036

P value adjustment method: none


>
__________________________________________________________________________________

>dat1 = read.table("Prob13_48.txt", header=TRUE)


> r = c(t(as.matrix(dat1))) # response data
> f = c("1","2","3","4") # treatment levels
> k = 4 # number of treatment levels
> n = 4 # observations per treatment
> tm = gl(k, 1, n*k, factor(f)) # matching treatments
> wm = gl(n,k,k*n)
> tm
[1] 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
Levels: 1 2 3 4
> fit1 = aov(r ~ tm+wm)
> summary(fit1)
Df Sum Sq Mean Sq F value Pr(>F)
tm 3 0.385 0.12833 14.44 0.000871 ***
wm 3 0.825 0.27500 30.94 4.52e-05 ***
Residuals 9 0.080 0.00889
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
>

> TukeyHSD(fit1, which="wm")


Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = r ~ tm + wm)

$wm
diff lwr upr p adj
2-1 0.025 -0.18311992 0.2331199 0.9809005
3-1 0.325 0.11688008 0.5331199 0.0039797
4-1 0.550 0.34188008 0.7581199 0.0000830
3-2 0.300 0.09188008 0.5081199 0.0066583
4-2 0.525 0.31688008 0.7331199 0.0001200
4-3 0.225 0.01688008 0.4331199 0.0341762

>
> summary.lm(fit1)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.350 0.06236096 149.9336 1.327609e-16
tm2 0.025 0.06666667 0.3750 7.163449e-01
tm3 -0.125 0.06666667 -1.8750 9.354966e-02
tm4 0.300 0.06666667 4.5000 1.488949e-03
wm2 0.025 0.06666667 0.3750 7.163449e-01
wm3 0.325 0.06666667 4.8750 8.774267e-04
wm4 0.550 0.06666667 8.2500 1.729604e-05
> with(dat1, pairwise.t.test(x=r, g=tm, p.adjust="none"))

Pairwise comparisons using t tests with pooled SD

data: r and tm

1 2 3
2 0.900 - -
3 0.532 0.455 -
4 0.148 0.182 0.049

P value adjustment method: none


>
__________________________________________________________________________________

> dat1 = read.table("Prob13_66.txt", header=TRUE)


> r = c(t(as.matrix(dat1))) # response data
> f = c("15","30","45") # treatment levels
> k = 3 # number of treatment levels
> n = 3 # observations per treatment
> tm = gl(k, 1, n*k, factor(f)) # matching treatments
> wm = gl(n,k,k*n)
> fit1 = aov(r ~ tm+wm)
> summary(fit1)
Df Sum Sq Mean Sq F value Pr(>F)
tm 2 18.8 9.4 3.797 0.119
wm 2 2231.8 1115.9 450.563 1.95e-05 ***
Residuals 4 9.9 2.5
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
>
> TukeyHSD(fit1, which="wm")
Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = r ~ tm + wm)

$wm
diff lwr upr p adj
2-1 -4.266667 -8.846234 0.312901 0.0620444
3-1 -35.333333 -39.912901 -30.753766 0.0000319
3-2 -31.066667 -35.646234 -26.487099 0.0000527

> summary.lm(fit1)$coef
Estimate Std. Error t value Pr(>|t|)
(Intercept) 78.033333 1.172999 66.524655 3.058911e-07
tm30 2.466667 1.284956 1.919651 1.273226e-01
tm45 3.433333 1.284956 2.671947 5.569303e-02
wm2 -4.266667 1.284956 -3.320478 2.936543e-02
wm3 -35.333333 1.284956 -27.497706 1.040270e-05
>

> with(dat1, pairwise.t.test(x=r, g=tm, p.adjust="none"))

Pairwise comparisons using t tests with pooled SD

data: r and tm

15 30
30 0.88 -
45 0.83 0.95

P value adjustment method: none


>

You might also like