clear all set more off input suppl batch deter purity 1 1 1 1 1 1 2 -1 1 1 3 0 1 2 1 -2 1 2 2 -3 1 2 3 -4 1 3 1 -2 1 3 2 0 1 3 3 1 1 4 1 1 1 4 2 4 1 4 3 0 2 1 1 1 2 1 2 -2 2 1 3 -3 2 2 1 0 2 2 2 4 2 2 3 2 2 3 1 -1 2 3 2 0 2 3 3 -2 2 4 1 0 2 4 2 3 2 4 3 2 3 1 1 2 3 1 2 4 3 1 3 0 3 2 1 -2 3 2 2 0 3 2 3 2 3 3 1 1 3 3 2 -1 3 3 3 2 3 4 1 3 3 4 2 2 3 4 3 1 end label variable suppl "Suppliers" label variable batch "Batches" label variable deter "Determinations of purity" label variable purity "Purity (coded)" ******************************************************************* * Table 14-3 Coded Purity data for Example 14-1 * (Code: yijk = purity-93) ******************************************************************* tabdisp deter batch suppl, cellvar(purity) ******************************************************************* * Table 14-5 Incorrect Analysis of the Two_stage Nested Design * in Example 14-1 as a Factorial (Suppliers Fixed, Batches Random) ******************************************************************* anova purity suppl batch suppl#batch ******************************************************************* * Table 14-4 Correct Analysis of Variance for the data * in Example 14-1 ******************************************************************* anova purity suppl / batch|suppl / ************************ * Diagnostic checking ************************ predict purity_pred, xb label variable purity_pred "Predicted values" predict resid, res label variable resid "Residuals" list purity purity_pred resid, noobs clean ******************************************************************* * Figure 14-3 (a) * Plot of residuals versus the predicted values ******************************************************************* scatter resid purity_pred, yline(0, lc(black)) ******************************************************************* * Figure 14-3 (b) * Plot of residuals versus supplier ******************************************************************* scatter resid suppl, yline(0, lc(black))