# Example 3: Variance Component Estimation for a Hierarchically Nested Random Design

Specifying the Design. This example illustrates variance component estimation for a hierarchically nested random effects design. Unlike full factorial designs, in which every combination of every level of each factor occurs in the design, in nested designs each level of a nested factor occurs in only one level of the factor in which it is nested. Consider, as an example, students who have only one classroom teacher, and teachers who teach in only one school. In a study of the variation in achievement attributable to schools, to teachers, and to students, the student factor would be nested within the teacher factor, which in turn would be nested within the school factor. The design is hierarchically nested, because there is a hierarchy of nested factors.

Example 3 is based on a fictitious data set with three independent variables A, B, and C (coded in two different ways as described below) and a single dependent variable, Y. All three factors are considered to have random effects, and Factor C is nested within Factor B, which in turn is nested within Factor A, making the design a hierarchically nested random effects design. There are unequal Ns for all three factors. The data are shown below and are available in the file nested.sta. Open this data file via the File - Open Examples menu; it is in the Datasets folder.

As can be seen in the listing of the data set above, A1 and A2 are coded identically. B1, and C1 are coded with values identifying consecutive overall levels of the B and C nested factors, respectively, and B2 and C2 are coded with values identifying the levels within the other factors in which B and C are nested, respectively. Thus, the two sets of factors merely represent different codings of the levels of the nested factors. We will first estimate variance components for the factors in the hierarchically nested random effects design using the A1, B1, and C1 variables.

To perform the analysis, select Variance Components from the Statistics - Advanced Linear/Nonlinear Models menu to display the Variance Components & Mixed Model ANOVA Startup Panel. On the Quick tab, click the Variables button to display the standard variable selection dialog. Here, select variable Y as the Dependent vars, variables A1, B1, and C1 as Random factors, and then click the OK button. To specify the design and the coding of the independent variables, click on the Model tab and select the Hierarchically nested design and Codes identify consecutive overall levels option buttons. Then click the OK button on the Startup Panel to display the Variance Components and Mixed Model ANOVA/ANCOVA Results dialog.

Reviewing the Results.

Estimation of Variance Components. For this example we will perform an ANOVA and estimate variance components using the Type III Expected mean squares method (see Variance Components and Mixed Model ANOVA/ANCOVA Method Options). On the Advanced tab, select the Expected MS option button under Method, the Type III option button under SS Type, and the Denominator synthesis ANOVA check box. Then click the Summary: Components of variance button to display the Components of Variance and Denominator synthesis ANOVA spreadsheets shown below.

To perform the same analysis using the A2, B2, and C2 variables, click the Cancel button on the Results dialog to return to the Variance Components & Mixed Model ANOVA Startup Panel. On the Quick tab, click the Variables button, and change the Random factors to A2, B2, and C2. On the Model tab, select the Codes identify levels within other factors option button, and then click the OK button to display the Variance Components and Mixed Model ANOVA/ANCOVA Results dialog. Now, click the Summary: Components of variance button to display the Components of variance and Denominator synthesis ANOVA spreadsheets. You should find that the results are identical to those for the A1, B1, and C1 variables.

Summary. This example has shown how to estimate variance components for hierarchically nested random designs. Two methods of coding the nested factors were illustrated. The results are identical with both methods of coding, and indicate that the random factors do not significantly contribute to the variation on the dependent variable.