ALATN
Analyzes a Latin square design.
Required Arguments
NTRT — Number of treatments. (Input)
NTRT must also be the number of rows and the number of columns.
NRESP — Number of repeated responses within each row-column position. (Input)
Y — Vector of length NTRT * NTRT * NRESP containing the responses. (Input)
The first NRESP elements of Y contain the responses for row 1, column 1; the second NRESP elements of Y contain the responses for row 1, column 2. The last NRESP elements of Y contain the responses for row NTRT, column NTRT.
ITRT — Vector of length NTRT * NTRT containing the treatment numbers for the responses in Y. (Input)
The treatment numbers must be from the set 1, 2, …, NTRT. For I = 1, 2, …, NTRT**2, element numbers (I ‑ 1) * NRESP + 1 through (I ‑ 1) * NRESP + NRESP of Y correspond to treatment number ITRT(I).
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 (experimental error 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 | Action |
---|
0 | No printing is performed. |
1 | Print AOV, EFSS, and TESTLF (if NRESP > 1) only. |
2 | Print YMEANS only. |
3 | All print is performed. |
EFSS — Vector of length 12 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, 3 | Degrees of freedom for rows, columns, and treatments, respectively. |
4, 5, 6 | Sum of squares for rows, columns, and treatments, respectively. |
7, 8, 9 | F-statistics for rows, columns, and treatments, respectively. F-statistics are computed using AOV(8) as the estimated error variance. |
10‑12 | p-values associated with the F-statistics. |
TESTLF — Vector of length 10 containing statistics relating to the test for lack of fit of the model.(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 experimental error |
2 | Degrees of freedom for within-cell error |
3 | Degrees of freedom for error (TESTLF(1) + TESTLF(2)) |
4 | Sum of squares for experimental error |
5 | Sum of squares for within-cell error |
6 | Sum of squares for error |
7 | Mean square for experimental error |
8 | Mean square for within-cell error |
9 | F -statistic |
10 | p-value |
YMEANS — Vector of length 3 * NTRT + NTRT * NTRT containing the row means, column means, treatment means, and the row-column means, respectively. (Output)
FORTRAN 90 Interface
Generic: CALL ALATN (NTRT, NRESP, Y, ITRT, AOV [, …])
Specific: The specific interface names are S_ALATN and D_ALATN.
FORTRAN 77 Interface
Single: CALL ALATN (NTRT, NRESP, Y, ITRT, IPRINT, AOV, EFSS, TESTLF, YMEANS)
Double: The double precision name is DALATN.
Description
Routine ALATN performs an analysis for a Latin square design. The model is
yijkm = μ + α i + βj + δk + ɛijkm i, j, k = 1, 2, …, p; m = 1, 2, …, n
where the observed value of yijkm constitutes the m-th response on the k-th treatment in row i column j of the Latin square design; μ + αi + βj + δk is the population mean for the response, and the ɛ ijkm’s are identically and independently distributed normal errors with mean zero and variance σ2. This model assumes the row effects (αi), column effects (βj), and treatment effects (δk) are additive. Often in practice, there are interactions between two or more of these factors. For this reason, ALATN computes a test for nonadditivity (lack of fit), in addition to summary statistics for the additive model. This test requires at least two responses in each cell. A test for nonadditivity with one response per cell in a Latin square design is discussed by Snedecor and Cochran (1967, pages 334‑337).
Routine ALATN requires yijk’s to be entered in 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, p), (2, 1), (2, 2), …, (2, p), …, (p, 1), (p, 2), …, (p, p). A discussion of formulas and interpretations for the analysis of a Latin square design appears in many elementary statistics texts, e.g., Snedecor and Cochran (1967, pages 312‑317).
Example
This example performs an analysis for a Latin square design using data discussed by Kirk (1982, Table 7.3-2, pages 312‑317). The responses are thickness of tread remaining on each of 32 tires after 10,000 miles of driving. The tires are divided equally among four different types, labeled A, B, C, and D. Four cars are used in the study. The experiment is performed twice, sixteen tires are used in each experiment. Each of the sixteen tires occupies one of the four wheel positions on one of the cars. The data are given in the following table:
Wheel Position | Car 1 | Car 2 | Car 3 | Car 4 |
---|
Right Front | A: 1, 2 | B: 2, 3 | C: 5, 6 | D: 9, 8 |
Left Front | B: 3, 4 | C: 8, 6 | D: 9, 8 | A: 2, 3 |
Right Rear | C: 5, 7 | D: 10, 11 | A: 3, 2 | B: 5, 4 |
Left Rear | D: 7, 10 | A: 6, 3 | B: 3, 4 | C: 6, 6 |
USE ALATN_INT
IMPLICIT NONE
INTEGER NRESP, NTRT
PARAMETER (NRESP=2, NTRT=4)
!
INTEGER IPRINT, ITRT(NTRT*NTRT)
REAL AOV(15), Y(NTRT*NTRT*NRESP)
!
DATA Y/1.0, 2.0, 2.0, 3.0, 5.0, 6.0, 9.0, 8.0, 3.0, 4.0, 8.0, &
6.0, 9.0, 8.0, 2.0, 3.0, 5.0, 7.0, 10.0, 11.0, 3.0, 2.0, &
5.0, 4.0, 7.0, 10.0, 6.0, 3.0, 3.0, 4.0, 6.0, 7.0/
DATA ITRT/1, 2, 3, 4, 2, 3, 4, 1, 3, 4, 1, 2, 4, 1, 2, 3/
DATA IPRINT/3/
!
CALL ALATN (NTRT, NRESP, Y, ITRT, 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 89.809 85.640 1.044 5.375 19.43
* * * Analysis of Variance * * *
Sum of Mean Prob. of
Source DF Squares Square Overall F Larger F
Model 9 211.5 23.50 21.542 0.0000
Error 22 24.0 1.09
Corrected Total 31 235.5
* * * Decomposition of Variation Attributable to the Model * * *
Source Sum of Prob. of
DF Squares F Larger F
Row 3 9.2 2.826 0.0622
Column 3 7.8 2.368 0.0983
Treatment 3 194.5 59.431 0.0000
Test for Lack of Fit
Source Sum of Mean Prob. of
DF Squares Square F Larger F
Experimental Error 6 5 0.833 0.702 0.6525
Within Cell 16 19 1.188
Error 22 24
* * * Row Means * * *
Row Mean (N=4)
1 4.500
2 5.375
3 5.875
4 5.750
* * * Column Means * * *
Column Mean (N=4)
1 4.875
2 6.125
3 5.000
4 5.500
* * * Treatment Means * * *
Treatment Mean (N=4)
1 2.8
2 3.5
3 6.2
4 9.0
* * * Cell Means * * *
Row Column Mean (N=2)
1 1 1.500
1 2 2.500
1 3 5.500
1 4 8.500
2 1 3.500
2 2 7.000
2 3 8.500
2 4 2.500
3 1 6.000
3 2 10.500
3 3 2.500
3 4 4.500
4 1 8.500
4 2 4.500
4 3 3.500
4 4 6.500