ATWOB
Analyzes a randomized block design or a two-way balanced design.
Required Arguments
NBLK — Number of blocks. (Input)
NTRT — Number of treatments. (Input)
NRESP — Number of repeated responses within each block-treatment combination. (Input)
Y — Vector of length NBLK * NTRT * NRESP containing the responses. (Input)
The first NRESP elements of Y contain the responses for block one, treatment one, the second NRESP elements of Y contain the responses for block one, treatment two; …; the last NRESP elements of Y contain the responses for block NBLK, treatment NTRT.
AOV — Vector of length 15 containing statistics relating to the analysis of variance. (Output)
I |
AOV(I) |
1 |
Degrees of freedom for the model (blocks and treatments) |
2 |
Degrees of freedom for error (interaction is pooled with the within-cell error) |
3 |
Total (corrected) degrees of freedom |
4 |
Sum of squares for the model (blocks and treatments) |
5 |
Sum of squares for error (interaction is pooled with the within-cell error) |
6 |
Total (corrected) sum of squares |
7 |
Model mean square |
8 |
Error mean square |
9 |
F -statistic |
10 |
p-value |
11 |
R2 (in percent) |
12 |
Adjusted R2 (in percent) |
13 |
Estimated standard deviation of the model error |
14 |
Overall mean of Y |
15 |
Coefficient of variation (in percent) |
Optional Arguments
IPRINT — Printing option. (Input)
Default: IPRINT = 0.
IPRINT |
AOV(I) |
0 |
No printing is performed. |
1 |
Print AOV, EFSS, and TESTLF (if NRESP > 1). |
2 |
Print YMEANS only. |
3 |
All printing is performed. |
EFSS — Vector of length 8 containing statistics relating to the sums of squares for the effects in the model. (Output)
Elements of EFSS are described as follows:
Elem. |
Description |
1, 2 |
Degrees of freedom for blocks and treatments, respectively |
3, 4 |
Sum of squares for blocks and treatments, respectively |
5, 6 |
F-statistics for blocks and treatments, respectively. F-statistics are computed using AOV(8) as the estimated error variance. |
7, 8 |
p-values associated with the F -statistics |
TESTLF — Vector of length 10 containing statistics relating to the test for lack of fit of the two-way model without interaction. (Output if NRESP > 1)
If NRESP = 1, TESTLF is not referenced and can be a vector of length one. Elements of TESTLF are described as follows:
Elem. |
Description |
1 |
Degrees of freedom for interaction |
2 |
Degrees of freedom for within-cell error |
3 |
Degrees of freedom for error (TESTLF(1) + TESTLF(2)) |
4 |
Sum of squares for interaction |
5 |
Sum of squares for interaction |
6 |
Sum of squares for within-cell error |
7 |
Mean square for interaction |
8 |
Mean square for within-cell error |
9 |
F-statistic |
10 |
p-value |
YMEANS — Vector of length NBLK + NTRT + NBLK * NTRT containing the block means, treatment means and block-by-treatment means, respectively. (Output)
FORTRAN 90 Interface
Generic: CALL ATWOB (NBLK, NTRT, NRESP, Y, AOV [, …])
Specific: The specific interface names are S_ATWOB and D_ATWOB.
FORTRAN 77 Interface
Single: CALL ATWOB (NBLK, NTRT, NRESP, Y, IPRINT, AOV, EFSS, TESTLF, YMEANS)
Double: The double precision name is DATWOB.
Description
Routine ATWOB performs an analysis for a two-way classification design with balanced data. For balanced data, there must be an equal number of responses in each cell of the two-way layout. The basic model is the same as for the randomized block design. The block and treatment effects are additive, i.e., there are no interactions. The model is
yijk = μ + α i + βj + ɛ ij i = 1, 2, …, n1; j = 1, 2, …, n2; k = 1, 2, …, n3
where the observed value of yijk constitutes the k-th response in the ij-th cell of the two-way layout, μ + αi + βj is the population mean for the ij-th cell, and the ɛijk’s are identically and independently distributed normal errors with mean zero and variance σ2. This model assumes that the effects for the two factors are additive. Often in practice, there are interactions between the two factors. For this reason, in addition to summary statistics for the additive model, ATWOB computes a test for nonadditivity (lack of fit). The test used here requires at least two responses in each cell. Tests for nonadditivity with one response per cell are given by Tukey (1949) and Mandel (1961). Tukey’s test is discussed by Snedecor and Cochran (1967, pages 331‑334).
The routine ATWOB requires yijk’s as input into a single vector Y with the data for each cell occupying contiguous elements. The cells must be in standard order, i.e., (1, 1), (1, 2), …, (1, n2), (2, 1), (2, 2), …, (2, n2), …, (n1, 1), (n1, 2), …, (n1, n2):
Examples
Example 1
This example performs an analysis for a randomized block design using data discussed by Neter and Wasserman (1974,Table 23.2, pages 725‑730). Fifteen businessmen were shown one of three methods for quantifying the maximum risk premium they would be willing to pay to avoid uncertainty. The responses are a stated degree of confidence, on a scale of 0 (no confidence) to 20 (highest confidence). The fifteen businessmen were grouped into five blocks by age. The three businessmen in each block were randomly assigned to a rating method. The data are given in the following table:
|
Confidence Rating |
||
Block |
Method 1 |
Method 2 |
Method 3 |
1 |
1 |
5 |
8 |
2 |
2 |
8 |
14 |
3 |
7 |
9 |
16 |
4 |
6 |
13 |
18 |
5 |
12 |
14 |
17 |
USE ATWOB_INT
IMPLICIT NONE
INTEGER NBLK, NRESP, NTRT
PARAMETER (NBLK=5, NRESP=1, NTRT=3)
!
INTEGER IPRINT
REAL AOV(15), Y(NBLK*NTRT*NRESP)
!
DATA Y/1.0, 5.0, 8.0, 2.0, 8.0, 14.0, 7.0, 9.0, 16.0, 6.0, 13.0, &
18.0, 12.0, 14.0, 17.0/
!
IPRINT = 3
CALL ATWOB (NBLK, NTRT, NRESP, Y, AOV, IPRINT=IPRINT)
END
Output
Dependent R-squared Adjusted Est. Std. Dev. Coefficient of
Variable (percent) R-squared of Model Error Mean Var. (percent)
Y 94.003 89.506 1.727 10 17.27
* * * Analysis of Variance * * *
Sum of Mean Prob. of
Source DF Squares Square Overall F Larger F
Model 6 374.1 62.36 20.901 0.0002
Error 8 23.9 2.98
Corrected Total 14 398.0
* * * Decomposition of Variation Attributable to the Model * * *
Sum of Prob. of
Source DF Squares F Larger F
Blocks 4 171.3 14.358 0.0010
Treatment 2 202.8 33.989 0.0001
* * * Block Means * * *
Block Mean (N=3)
1 4.6667
2 8.0000
3 10.6667
4 12.3333
5 14.3333
* * * Treatment Means * * *
Treatment Mean (N=5)
1 5.6000
2 9.8000
3 14.6000
* * * Cell Means * * *
Block Treatment Mean (N=1)
1 1 1.0000
1 2 5.0000
1 3 8.0000
2 1 2.0000
2 2 8.0000
2 3 14.0000
3 1 7.0000
3 2 9.0000
3 3 16.0000
4 1 6.0000
4 2 13.0000
4 3 18.0000
5 1 12.0000
5 2 14.0000
5 3 17.0000
Example 2
This example fits an additive two-way analysis of variance model and performs a test for nonadditivity (lack of fit) using data discussed by Kirk (1982,Table 8.3-1, pages 354‑359). The data for the two-way layout is given in the following table:
|
BLOCK |
||
TREATMENT |
1 |
2 |
3 |
1 |
24, 33, 37, 29, 42 |
44, 36, 25, 27, 43 |
38, 29, 28, 47, 48 |
2 |
30, 21, 39, 26, 34 |
35, 40, 27, 31, 22 |
26, 27, 36, 46, 45 |
3 |
21, 18, 10, 31, 20 |
41, 39, 50, 36, 34 |
42, 52, 53, 49, 64 |
USE ATWOB_INT
IMPLICIT NONE
INTEGER NBLK, NRESP, NTRT
PARAMETER (NBLK=3, NRESP=5, NTRT=3)
!
INTEGER IPRINT
REAL AOV(15), Y(NBLK*NTRT*NRESP)
!
DATA Y/24.0, 33.0, 37.0, 29.0, 42.0, 30.0, 21.0, 39.0, 26.0, &
34.0, 21.0, 18.0, 10.0, 31.0, 20.0, 44.0, 36.0, 25.0, 27.0, &
43.0, 35.0, 40.0, 27.0, 31.0, 22.0, 41.0, 39.0, 50.0, 36.0, &
34.0, 38.0, 29.0, 28.0, 47.0, 48.0, 26.0, 27.0, 36.0, 46.0, &
45.0, 42.0, 52.0, 53.0, 49.0, 64.0/
!
IPRINT = 3
CALL ATWOB (NBLK, NTRT, NRESP, Y, AOV, IPRINT=IPRINT)
END
Output
Dependent R-squared Adjusted Est. Std. Dev. Coefficient of
Variable (percent) R-squared of Model Error Mean Var. (percent)
Y 33.206 26.526 9.336 35 26.68
* * * Analysis of Variance * * *
Sum of Mean Prob. of
Source DF Squares Square Overall F Larger F
Model 4 1733.3 433.3 4.971 0.0024
Error 40 3486.7 87.2
Corrected Total 44 5220.0
* * * Decomposition of Variation Attributable to the Model * * *
Sum of Prob. of
Source DF Squares F Larger F
Blocks 2 1543.3 8.853 0.0007
Treatment 2 190.0 1.090 0.3460
* * * Test for Lack of Fit * * *
Sum of Mean Prob. of
Source DF Squares Square F Larger F
Interaction 4 1236.7 309.2 4.947 0.0028
Within cell 36 2250.0 62.5
Error 40 3486.7
* * * Block Means * * *
Block Mean (N=3)
1 27.6667
2 35.3333
3 42.0000
* * * Treatment Means * * *
Treatment Mean (N=3)
1 35.3333
2 32.3333
3 37.3333
* * * Cell Means * * *
Block Treatment Mean (N=5)
1 1 33.0000
1 2 30.0000
1 3 20.0000
2 1 35.0000
2 2 31.0000
2 3 40.0000
3 1 38.0000
3 2 36.0000
3 3 52.0000