The array has replicates, levels of factor , and levels of factor , giving . R vectorizes an array with the first index changing fastest, then the second, then the third. Accordingly,
gl(I,K,length(y)) repeats each level for the ten replicates and cycles over its two levels, while gl(J,K*I,length(y)) repeats each level for twenty observations. These factors align with the vectorized response.The first fit is the additive Analysis of variance model , with independent normal errors of common variance . Under the default treatment constraints , the four fitted coefficients estimate the baseline cell mean, the minus effect, and the contrasts with . Thus the baseline fitted mean is , the second level adds , and the second and third levels add and .
The summary tests compare each indicated coefficient with zero, using its standard error and residual variance estimate . They have 56 residual degrees of freedom. The three non-intercept contrasts are strongly significant; the intercept test asks whether the baseline mean is zero, not whether either factor matters overall. The Analysis of variance tests are joint nested-model tests: no main effect, with one numerator degree of freedom, and no main effect, with two. Their sequential sums of squares are and . In this balanced design the main-effect subspaces are orthogonal, so ordering does not change those sums of squares. The denominator is the same residual mean square ; both factor effects are highly significant.
The second fit expands
a*b to a+b+a:b, adding two interaction coefficients. It allows the effect to differ between levels and has six parameters, equivalently one mean per cell, with 54 residual degrees of freedom. The interaction adds only about to explained sum of squares; its statistic is with degrees of freedom and . There is no evidence against additivity, so the simpler first model is preferable on these data. This does not prove the true interaction is exactly zero.For the final expression, , , and . The fitted vectors are orthogonal projections onto nested model spaces, so is the additional sum of squares due to interaction. The final code computesthe same interaction test as the Analysis of variance row. The exact value uses the original, unrounded observations and fits. Using only the displayed rounded sums and gives about instead; that discrepancy is rounding, not a different test. The omitted observations prevent reconstructing more digits from the printed data alone.
Articles by others on the same topic
There are currently no matching articles.