 0—Unequal numbers in the subgroups
0—Unequal numbers in the subgroups 1—Equal numbers in the subgroups
1—Equal numbers in the subgroups| Variable | Description | 
| LNL | n_levels(1) + ... + n_levels(0) * n_levels(1) * ... * n_levels(n_factors – 2) | 
| LNLNF | n_levels(0) * n_levels(1) * ...* n_levels(n_factors – 2) | 
| NOBS | The number of observations. NOBS equals n_levels(0) * n_levels(1) * ... * n_levels(n_factors-1) | 
 LNL—Length of n_levels.
LNL—Length of n_levels. LNLNF—Length of the subvector of n_levels for the last factor.
LNLNF—Length of the subvector of n_levels for the last factor. NOBS—Number of observations. NOBS equals the sum of the last LNLNF elements of n_levels. n_levels(n_factors-1).
NOBS—Number of observations. NOBS equals the sum of the last LNLNF elements of n_levels. n_levels(n_factors-1). 0—Degrees of freedom for the model
0—Degrees of freedom for the model 1—Degrees of freedom for error
1—Degrees of freedom for error 2—Total (corrected) degrees of freedom
2—Total (corrected) degrees of freedom 3—Sum of squares for the model
3—Sum of squares for the model 4—Sum of squares for error
4—Sum of squares for error 5—Total (corrected) sum of squares
5—Total (corrected) sum of squares 6—Model mean square
6—Model mean square 7—Error mean square
7—Error mean square 8—Overall F-statistic
8—Overall F-statistic 9—p-value
9—p-value 10—R2 (in percent)
10—R2 (in percent) 11—Adjusted R2 (in percent)
11—Adjusted R2 (in percent) 12—Estimate of the standard deviation
12—Estimate of the standard deviation 13—Overall mean of y
13—Overall mean of y 14—Coefficient of variation (in percent)
14—Coefficient of variation (in percent) 1—Degrees of freedom
1—Degrees of freedom 2—Sum of squares
2—Sum of squares 3—Mean squares
3—Mean squares 4—F-statistic
4—F-statistic 5—p-value for F test
5—p-value for F test 6—Variance component estimate
6—Variance component estimate 7—Percent of variance explained by variance component
7—Percent of variance explained by variance component 8—Lower endpoint for confidence interval on the variance component
8—Lower endpoint for confidence interval on the variance component 9—Upper endpoint for confidence interval on the variance component
9—Upper endpoint for confidence interval on the variance component| eq_option | Length of y means | 
| 0  | 1 + n_levels(0) + n_levels(1) + ... n_levels((LNL - LNLNF)-1)  (See description of argument n_levels for definitions of LNL and LNLNF.) | 
| 1 | 1 + n_levels(0) + n_levels(0) * n_levels(1) + ... + n_levels(0)* n_levels(1) * ... * n_levels (n_factors – 2) | 
 
  
 | Plant | Leaf | Samples | |
| 1 | 1 2 3 | 3.28 3.52 2.88 | 3.09 3.48 2.80 | 
| 2 | 1 2 3 | 2.46 1.87 2.19 | 2.44 1.92 2.19 | 
| 3 | 1 2 3 | 2.77 3.74 2.55 | 2.66 3.44 2.55 | 
| 4 | 1 2 3 | 3.78 4.07 3.31 | 3.87 4.12 3.31 | 
PRO print_results, p, at, ems, y_means, var_comp
anova_labels = ['degrees of freedom for model', $
'degrees of freedom for error', $
'total (corrected) degrees of freedom', $
'sum of squares for model', 'sum of squares for error', $
'total (corrected) sum of squares', 'model mean square', $
'error mean square', 'F-statistic', 'p-value', $
'R-squared (in percent)', $
'adjusted R-squared (in percent)', $
'est. standard deviation of within error', $
'overall mean of y', $
'coefficient of variation (in percent)']
ems_labels = ['Effect A and Error', 'Effect A and Effect B', $
'Effect A and Effect A', 'Effect B and Error', $
'Effect B and Effect B', 'Error and Error']
components_labels = ['degrees of freedom for A', $
'sum of squares for A', 'mean square of A', $
'F-statistic for A', 'p-value for A', $
'Estimate of A', 'Percent Variation Explained by A', $
'95% Confidence Interval Lower Limit for A', $
'95% Confidence Interval Upper Limit for A', $
'degrees of freedom for B', 'sum of squares for B', $
'mean square of B', 'F-statistic for B', 'p-value for B', $
'Estimate of B', 'Percent Variation Explained by B', $
'95% Confidence Interval Lower Limit for B', $
'95% Confidence Interval Upper Limit for B', $
'degrees of freedom for Error', $
'sum of squares for Error', 'mean square of Error', $
'F-statistic for Error', 'p-value for Error', $
'Estimate of Error', 'Percent Explained by Error', $
'95% Confidence Interval Lower Limit for Error', $
'95% Confidence Interval Upper Limit for Error']
means_labels = ['Grand mean', $
' A means 1', $
' A means 2', $
' A means 3', $
' A means 4', $
'AB means 1 1', $
'AB means 1 2', $
'AB means 1 3', $
'AB means 2 1', $
'AB means 2 2', $
'AB means 2 3', $
'AB means 3 1', $
'AB means 3 2', $
'AB means 3 3', $
'AB means 4 1', $
'AB means 4 2', $
'AB means 4 3']
PRINT, 'p value of F statistic =', p
PRINT, ' * * * Analysis of Variance * * *'
FOR i=0L, 14 DO $
PM, anova_labels(i), at(i), Format = '(A40, F20.5)'
PRINT, ' * * * Expected Mean Square Coefficients * * *'
FOR i=0L, 5 DO $
PM, ems_labels(i), ems(i), Format = '(A40, F20.2)'
PRINT, ' * * Analysis of Variance / Variance Components * *'
k = 0
FOR i=0L, 2 DO BEGIN
FOR j=0L, 8 DO BEGIN
PM, components_labels(k), var_comp(i, j), $
Format = '(A45, F20.5)'
k = k + 1
ENDFOR
ENDFOR
PRINT, 'means', Format = '(A20)'
FOR i=0L, 16 DO $
PM, means_labels(i), y_means(i), Format ='(A20, F20.2)'
END
y = [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]
n_levels = [4, 3, 2]
p = ANOVANESTED(3, 1, n_levels, y, Anova_Table = at, Ems=ems, $
Y_Means = y_means, Var_Comp = var_comp)
print_results, p, at, ems, y_means, var_comp
p value of F statistic = 0.00000
* * * Analysis of Variance * * *
degrees of freedom for model 11.00000
degrees of freedom for error 12.00000
total (corrected) degrees of freedom 23.00000
sum of squares for model 10.19054
sum of squares for error 0.07985
total (corrected) sum of squares 10.27040
model mean square 0.92641
error mean square 0.00665
F-statistic 139.21599
p-value 0.00000
R-squared (in percent) 99.22248
adjusted R-squared (in percent) 98.50976
est. standard deviation of within error 0.08158
overall mean of y 3.01208
coefficient of variation (in percent) 2.70826
* * * Expected Mean Square Coefficients * * *
Effect A and Error 1.00
Effect A and Effect B 2.00
Effect A and Effect A 6.00
Effect B and Error 1.00
Effect B and Effect B 2.00
Error and Error 1.00
* * Analysis of Variance / Variance Components * *
degrees of freedom for A 3.00000
sum of squares for A 7.56034
mean square of A 2.52011
F-statistic for A 7.66516
p-value for A 0.00973
Estimate of A 0.36522
cent Variation Explained by A 68.53015
95% Confidence Interval Lower Limit for A 0.03955
95% Confidence Interval Upper Limit for A 5.78674
degrees of freedom for B 8.00000
sum of squares for B 2.63020
mean square of B 0.32878
F-statistic for B 49.40642
p-value for B 0.00000
Estimate of B 0.16106
Percent Variation Explained by B 30.22121
95% Confidence Interval Lower Limit for B 0.06967
95% Confidence Interval Upper Limit for B 0.60042
degrees of freedom for Error 12.00000
sum of squares for Error 0.07985
mean square of Error 0.00665
F-statistic for Error NaN
p-value for Error NaN
Estimate of Error 0.00665
Percent Explained by Error 1.24864
95% Confidence Interval Lower Limit for Error 0.00342
95% Confidence Interval Upper Limit for Error 0.01813
means
Grand mean 3.01
A means 1 3.17
A means 2 2.18
A means 3 2.95
A means 4 3.74
AB means 1 1 3.18
AB means 1 2 3.50
AB means 1 3 2.84
AB means 2 1 2.45
AB means 2 2 1.89
AB means 2 3 2.19
AB means 3 1 2.72
AB means 3 2 3.59
AB means 3 3 2.55
AB means 4 1 3.82
AB means 4 2 4.10
AB means 4 3 3.31