In the following example from Snedecor and Cochran (1967), an experiment is conducted to study the variability of calcium concentration in turnip greens. Four plants are selected at random; then three leaves are randomly selected from each plant. Two 100-mg samples are taken from each leaf. The amount of calcium is determined by microchemical methods.
Because the data are read in sorted order, it is not necessary to use PROC SORT on the CLASS variables. Leaf
is nested in Plant
; Sample
is nested in Leaf
and is left for the residual term. All the effects are random effects. The following statements read the data and invoke
PROC NESTED. These statements produce Output 68.1.1.
title 'Calcium Concentration in Turnip Leaves--Nested Random Model'; title2 'Snedecor and Cochran, ''Statistical Methods'', 1967, p. 286'; data Turnip; do Plant=1 to 4; do Leaf=1 to 3; do Sample=1 to 2; input Calcium @@; output; end; end; end; datalines; 3.28 3.09 3.52 3.48 2.88 2.80 2.46 2.44 1.87 1.92 2.19 2.19 2.77 2.66 3.74 3.44 2.55 2.55 3.78 3.87 4.07 4.12 3.31 3.31 ;
proc nested data=Turnip; class plant leaf; var calcium; run;
Output 68.1.1: Analysis of Calcium Concentration in Turnip Greens Using PROC NESTED
Nested Random Effects Analysis of Variance for Variable Calcium | ||||||||
---|---|---|---|---|---|---|---|---|
Variance Source | DF | Sum of Squares | F Value | Pr > F | Error Term | Mean Square | Variance Component | Percent of Total |
Total | 23 | 10.270396 | 0.446539 | 0.532938 | 100.0000 | |||
Plant | 3 | 7.560346 | 7.67 | 0.0097 | Leaf | 2.520115 | 0.365223 | 68.5302 |
Leaf | 8 | 2.630200 | 49.41 | <.0001 | Error | 0.328775 | 0.161060 | 30.2212 |
Error | 12 | 0.079850 | 0.006654 | 0.006654 | 1.2486 |
The results indicate that there is significant (nonzero) variation from plant to plant (Pr > F is 0.0097) and from leaf to
leaf within a plant (Pr > F is less than 0.0001). Notice that the variance component for Plant
uses the Leaf
mean square as an error term in the model rather than the error mean square.