Outer Factor, Nested Factor, School Cells, Studytime Cells, F Test and Residual Diagnostics
Nested ANOVA: Formula, Nested Factors, SPSS, Python, R and Excel Guide
Nested ANOVA is used when one factor is arranged inside another factor instead of being fully crossed with it. In this worked example, school is the outer factor, studytime is treated as nested within school, and G3 final grade is the numeric outcome. The chart set includes nested group means, nested cell boxplots, outer factor means, nested effect F distribution, p-value decision summary, residual diagnostics, cell size with standard deviation, Python report, R report and SPSS output.
Google AdSense top placement reserved here
Quick Answer: Nested ANOVA Result
The worked Nested ANOVA example shows a strong outer factor result and a significant nested factor result. The p-value decision chart reports outer factor p = 4.202e-14 and nested factor p = 1.478e-06. Both values are far below alpha = .05, so the outer school effect and the studytime-within-school nested effect are statistically significant.
The nested F distribution chart reports nested F = 6.397, df1 = 6, df2 = 641, and right-tail p-value = 1.478e-06. The observed F statistic is far into the right tail, so the nested studytime-within-school cells do not have equal mean G3 scores.
Final interpretation: G3 final grades differ by school, and the studytime cells inside each school also differ significantly. GP cells generally have higher mean G3 values than MS cells. Inside both schools, the lowest studytime cells are lower than the higher studytime cells, but the cell sizes are uneven, so the result should be reported with the cell-size and standard-deviation chart.
Important reporting point: A nested design is not the same as a factorial design. In this article, studytime cells are interpreted as school-specific nested cells. Do not report this as a simple crossed school × studytime factorial ANOVA unless the research design truly treats the same studytime levels as crossed across all schools.
Table of Contents
- What Is Nested ANOVA?
- Nested ANOVA Formula
- Nested ANOVA Hypotheses
- Dataset and Variables Used
- Python Chart-by-Chart Interpretation
- R Chart-by-Chart Validation
- SPSS Output and Report PDFs
- SPSS, R, Python and Excel Workflows
- Code Blocks for Nested ANOVA
- APA Reporting Wording
- Common Mistakes
- When to Use Nested ANOVA
- Downloads and Resources
- Related Guides
- FAQs
What Is Nested ANOVA?
Nested ANOVA is an analysis of variance design where one factor is contained inside another factor. The inner factor levels are interpreted within each level of the outer factor. This is different from a fully crossed Factorial ANOVA, where every level of one factor is crossed with every level of another factor in the same way.
In this worked example, school is the outer factor. Studytime cells are treated as nested inside each school, producing cells such as GP:1, GP:2, GP:3, GP:4, MS:1, MS:2, MS:3 and MS:4. The dependent variable is G3 final grade.
The outer factor chart shows that GP has a higher mean G3 than MS. The nested group means chart shows that studytime cells inside each school are not equal. The formal p-value summary confirms both conclusions: the outer school effect is significant, and the nested studytime-within-school effect is also significant.
Simple definition: Nested ANOVA tests an outer factor and a lower-level factor that is interpreted inside the outer factor. In this example, G3 is compared across school and studytime cells nested within each school.
Nested ANOVA is part of the wider ANOVA family. It should be compared with Fixed Effects ANOVA, Factorial ANOVA, Balanced ANOVA, Brown Forsythe ANOVA, ANOVA in Python, ANOVA in R, ANOVA in SPSS, and ANOVA Assumptions.
Nested ANOVA Formula
A nested ANOVA model separates the outer factor effect from the nested factor effect. The nested term is written inside parentheses to show that it belongs within the outer factor.
For this worked example, the model becomes:
The school term tests whether the outer school means differ. The studytime(school) term tests whether the studytime cells inside schools differ after the outer school structure is considered.
Outer Factor Test
The p-value decision chart reports outer p = 4.202e-14. This value is below .05, so the outer school means are not equal.
Nested Factor Test
The nested F distribution reports nested F = 6.397, df1 = 6, df2 = 641 and p = 1.478e-06. This shows that the nested studytime-within-school cells differ significantly.
| Model Source | Result in This Output | Decision | Interpretation |
|---|---|---|---|
| Outer factor: school | p = 4.202e-14 | Significant | GP and MS have different mean G3 scores. |
| Nested factor: studytime(school) | F = 6.397, p = 1.478e-06 | Significant | Studytime cells inside schools differ. |
| Nested degrees of freedom | df1 = 6, df2 = 641 | Used for F decision | Eight nested cells produce six nested-effect degrees of freedom. |
| Alpha level | .05 | Decision boundary | Both tested p-values are below alpha. |
Nested ANOVA Hypotheses
Nested ANOVA has a hypothesis for the outer factor and a hypothesis for the nested factor. The two hypotheses answer different questions and should not be mixed together.
| Effect | Null Hypothesis | Alternative Hypothesis | Decision in This Output |
|---|---|---|---|
| school | The outer school means are equal. | GP and MS have different mean G3 values. | Reject H0 because p = 4.202e-14. |
| studytime nested within school | The nested studytime cells inside school have equal mean G3 after accounting for school. | At least one nested cell mean differs. | Reject H0 because p = 1.478e-06. |
Decision for this example: Both hypotheses are rejected at alpha = .05. There is a significant outer school effect and a significant nested studytime-within-school effect. The final interpretation should report both effects separately.
Dataset and Variables Used
The worked example uses student performance data. The outcome variable is G3 final grade. The outer factor is school, with GP and MS as the two school groups. The nested factor is studytime inside school, producing eight nested cells.
| Nested Cell | Approximate Mean Pattern | Approximate Cell Size | Interpretation |
|---|---|---|---|
| GP:1 | About 11.5 | 119 | Lowest GP studytime cell. |
| GP:2 | About 12.7 | 206 | Large GP cell with higher mean than GP:1. |
| GP:3 | About 13.6 | 71 | Highest GP cell in the nested mean chart. |
| GP:4 | About 13.4 | 27 | High mean but wider confidence interval. |
| MS:1 | About 10.0 | 93 | Lowest MS cell. |
| MS:2 | About 10.8 | 99 | Higher than MS:1 but still below GP cells. |
| MS:3 | About 12.3 | 26 | Highest MS cell. |
| MS:4 | About 11.9 | 8 | Smallest cell and widest uncertainty. |
The cell-size chart shows why Nested ANOVA interpretation should include sample-size context. GP:2 is the largest cell, while MS:4 is very small. Small cells can produce wider confidence intervals and less stable mean estimates.
For supporting concepts, review Descriptive Statistics, Mean Median and Mode, Standard Deviation, Standard Error, Confidence Interval, F Distribution, P Value, and Null and Alternative Hypothesis.
Google AdSense middle placement reserved here
Python Chart-by-Chart Interpretation
The Python chart sequence explains the Nested ANOVA result through nested group means, nested cell distributions, outer school means, nested effect F distribution, p-value decision summary, residual diagnostics and cell-size context.
Python Chart 1: Nested Group Means with 95% Confidence Intervals

This chart shows the mean G3 value for each nested school-by-studytime cell. GP cells are generally higher than MS cells. GP:1 is the lowest GP cell, while GP:3 and GP:4 are in the highest GP range. MS:1 is the lowest MS cell, while MS:3 has the highest MS mean.
The confidence intervals are not equal across cells. MS:4 has the widest interval because it is the smallest cell. GP:4 also has a wider interval than the larger GP cells. The chart therefore shows both mean differences and uncertainty around those means.
This chart gives the practical direction behind the formal Nested ANOVA result. The nested cell means are not flat, and the formal nested p-value confirms that these differences are statistically significant.
Python Chart 2: Distribution by Nested Cell

The boxplot chart shows that the nested cells differ not only in their means but also in their spread. GP:3 and GP:4 are centered higher than GP:1. MS:1 and MS:2 are centered lower, while MS:3 and MS:4 shift upward.
Several cells include very low outlying values, including zero values in GP:1, MS:1 and MS:2. These low values help explain why residual diagnostics later show lower-tail departures.
This chart supports a careful interpretation of Nested ANOVA. The means differ significantly, but the distributions are not identical and the presence of low outliers should be described in the assumptions section.
Python Chart 3: Outer Factor Means

This chart compares the two outer school means. GP has a higher mean G3 than MS. The GP bar is around the 12.5 to 12.6 range, while the MS bar is around the 10.6 to 10.7 range.
The confidence interval around GP is narrower than the MS interval. This reflects stronger precision for the GP mean and more uncertainty for the MS mean.
This chart explains the outer p-value result. The p-value decision chart reports outer p = 4.202e-14, which confirms that the school-level difference is statistically significant.
Python Chart 4: Nested Effect on F Distribution

This chart gives the formal nested-effect test. The subtitle reports right-tail p-value = 1.478e-06, df1 = 6 and df2 = 641. The dashed vertical line marks nested F = 6.397.
The observed F statistic is far to the right of the main density region. This means the nested effect is much larger than expected under the equal nested-cell means null hypothesis.
The statistical decision is clear. The studytime cells nested within school differ significantly in mean G3.
Python Chart 5: P-Value Decision Summary

This decision chart places alpha = 0.05 next to the two tested p-values. The outer p-value is 4.202e-14, and the nested p-value is 1.478e-06.
Both p-values are essentially at the baseline compared with the alpha bar. This means both the outer factor and nested factor are statistically significant.
This chart should be used for the final decision paragraph. It confirms that school matters and that studytime cells inside school also matter.
Python Chart 6: Residuals vs Fitted Values

This chart shows residuals against fitted values from the nested model. The points form vertical bands because the fitted values come from nested cell means. Most residuals are spread around zero, but several negative residuals extend far below the center.
The lower-tail points show students whose observed G3 values were much lower than the nested cell fitted values. This pattern matches the low outlying points visible in the boxplot chart.
The diagnostic conclusion is balanced. The nested effects are statistically significant, but residual spread and lower-tail values should be reported as part of model checking.
Python Chart 7: Residual Q-Q Plot

The Q-Q plot shows visible departures from the normal reference line. The central residuals follow the general diagonal direction, but the lower tail bends away strongly.
The negative residual tail reaches far below the reference line. This means the residual distribution is not perfectly normal and contains strong low-end departures.
The final report should mention this diagnostic issue. The Nested ANOVA p-values are strong, but the residual normality assumption is approximate rather than perfect.
Python Chart 8: Cell Size and Standard Deviation

This chart shows that the nested cells are uneven in size. GP:2 is the largest cell with about 206 cases. GP:1 has about 119 cases. MS:2 and MS:1 are also large, while MS:4 is very small with about 8 cases.
The standard deviation line shows that spread differs across cells. MS:2 has one of the largest standard deviations, while GP:3 has one of the smaller spreads.
This chart is important for interpretation because significant nested differences should be read with cell-size and spread context. Very small cells can produce less stable mean estimates and wider intervals.
R Chart-by-Chart Validation
The R validation charts repeat the same Nested ANOVA workflow in a second software environment. They confirm the nested group mean pattern, cell boxplot structure, outer factor difference, nested F decision, p-value summary, residual diagnostics and cell-size context.
R Chart 1: Nested Group Means with 95% Confidence Intervals

The R chart confirms the same nested cell mean pattern. GP:1 is lower than the other GP cells, GP:3 and GP:4 are in the high range, MS:1 and MS:2 are lower, and MS:3 is the highest MS cell.
The confidence intervals again show that not all cells have the same precision. MS:4 is visibly the least stable cell because its interval is wide.
This validation chart supports the Python conclusion that the nested studytime-within-school cells differ meaningfully.
R Chart 2: Distribution by Nested Cell

The R boxplot chart confirms that the distributions differ across nested cells. Higher GP and MS studytime cells tend to sit above the lower cells, but spread varies by cell.
Low outlying values remain visible in several cells. These outliers are important because they help explain the lower-tail departure in the residual Q-Q plot.
The R chart validates the same practical interpretation: Nested ANOVA detects mean differences, while boxplots show spread and outlier context.
R Chart 3: Outer Factor Means

The R outer factor chart confirms that GP has a higher mean G3 than MS. The gap between the two school bars is clear.
The confidence interval around MS is wider than GP, showing more uncertainty in the MS mean. The mean difference remains large enough to support the very small outer p-value.
This validation chart confirms the outer school effect in the same direction as the Python output.
R Chart 4: Nested Effect on F Distribution

The R F distribution chart repeats the same formal nested-effect result. The subtitle reports right-tail p-value = 1.478e-06, df1 = 6 and df2 = 641.
The observed nested F line is far into the right tail. This confirms that the nested-cell differences are statistically significant.
This chart validates the nested factor decision from the Python workflow.
R Chart 5: P-Value Decision Summary

The R decision chart confirms that the outer and nested p-values are both far below alpha = .05. The outer p-value is 4.202e-14, and the nested p-value is 1.478e-06.
This chart confirms the same final decision: both the school effect and studytime-within-school effect are statistically significant.
It should be used as the compact statistical decision figure after the detailed mean and distribution charts.
R Chart 6: Residuals vs Fitted Values

The R residuals-versus-fitted chart confirms that residuals are centered around zero but include strong negative residuals. The vertical banding appears because fitted values come from the nested cell means.
The lower residual tail shows that some students had observed G3 scores far below their fitted nested-cell expectation.
This chart validates the diagnostic caution reported from the Python residual chart.
R Chart 7: Residual Q-Q Plot

The R Q-Q plot confirms the same lower-tail departure. The central points follow the general reference direction, while the lower tail departs strongly from the line.
This means residual normality is approximate rather than perfect. The result remains statistically strong, but the assumption check should be reported.
The chart supports a transparent final report that includes both significance and diagnostic limitations.
R Chart 8: Cell Size and Standard Deviation

The R cell-size chart confirms that the design is unbalanced. GP:2 is the largest cell, while MS:4 is the smallest cell.
The standard deviation line confirms that cell spread differs across nested cells. MS cells show higher spread in some levels than GP cells.
This validation chart supports the final recommendation to report cell size and spread together with the Nested ANOVA p-values.
SPSS Output and Report PDFs
The supplied report files support the Nested ANOVA workflow. The Python report provides the first chart set, the R report validates the chart sequence, and the SPSS output PDF provides the menu-based output for reporting and verification.
Download Nested ANOVA Python Report PDF
Download Nested ANOVA R Report PDF
Download Nested ANOVA SPSS Output PDF
Output Items to Read
| Output Item | What It Shows | How It Is Used | Reporting Meaning |
|---|---|---|---|
| Nested group means | Mean G3 by school-specific studytime cells. | Shows practical nested-cell pattern. | GP cells are generally higher than MS cells. |
| Cell boxplots | Distribution, median, mean marker and outliers. | Shows spread and unusual values. | Low outliers explain residual lower-tail issues. |
| Outer factor means | Mean G3 by school. | Tests outer school difference. | GP is higher than MS. |
| Nested F distribution | Nested F = 6.397, df1 = 6, df2 = 641. | Formal nested effect test. | Nested cells differ significantly. |
| P-value summary | Outer p = 4.202e-14 and nested p = 1.478e-06. | Decision summary. | Both effects are significant. |
| Residual diagnostics | Residuals versus fitted and Q-Q plot. | Assumption checking. | Lower-tail departures should be reported. |
| Cell size and SD | Sample size bars and standard deviation line. | Design-balance and spread context. | Cell sizes are uneven, especially MS:4. |
Report interpretation summary: The Nested ANOVA output supports a significant school effect and a significant studytime-within-school effect. The result is practically visible in the nested mean charts and statistically confirmed by the p-value decision summary. Residual diagnostics show lower-tail departures, and cell sizes are uneven, so the final report should include assumption and balance context.
Google AdSense in-content placement reserved here
SPSS, R, Python and Excel Workflows for Nested ANOVA
The same Nested ANOVA workflow can be reproduced in SPSS, R and Python. Excel can prepare nested means, cell sizes, standard deviations and charts, but the formal nested ANOVA model should be run in SPSS, R or Python.
SPSS Workflow
| Step | SPSS Menu or Syntax | Purpose |
|---|---|---|
| Open data | File > Open > Data | Load G3, school and studytime. |
| Create nested cell label | Transform > Compute Variable | Create school-studytime cell labels such as GP_1 and MS_1. |
| Run GLM | Analyze > General Linear Model > Univariate | Fit G3 as outcome. |
| Set outer factor | Fixed Factor: school | Test the outer school effect. |
| Set nested factor | Model term: studytime nested within school | Test the nested-cell effect. |
| Request descriptive statistics | Options > Descriptive statistics | Get cell means, standard deviations and cell sizes. |
| Request plots | Profile or custom charts | Show nested means and cell spread. |
| Export output | OUTPUT EXPORT | Save SPSS output PDF. |
R Workflow
| Step | R Action | Purpose |
|---|---|---|
| Read data | read.csv("dataset.csv") | Load dataset. |
| Convert factors | as.factor(school) and as.factor(studytime) | Define categorical factors. |
| Create nested label | interaction(school, studytime) | Create nested cells. |
| Fit nested ANOVA | aov(G3 ~ school + school:studytime) | Test outer and nested effects. |
| Read ANOVA table | summary(model) | Get F statistics and p-values. |
| Cell summaries | group_by(school, studytime) | Get cell means, SDs and sizes. |
| Diagnostics | Residual plots and Q-Q plots | Check model assumptions. |
Python Workflow
| Step | Python Action | Purpose |
|---|---|---|
| Read data | pandas.read_csv() | Load G3, school and studytime. |
| Create nested cell | school + ":" + studytime | Create school-specific studytime labels. |
| Fit model | ols("G3 ~ C(school) + C(school):C(studytime)") | Fit nested ANOVA model. |
| ANOVA table | sm.stats.anova_lm(model, typ=2) | Get outer and nested p-values. |
| F distribution | scipy.stats.f | Visualize nested F decision. |
| Cell summaries | groupby() | Calculate means, confidence intervals, SDs and counts. |
| Diagnostics | Residual plots and Q-Q plots | Check residual behavior. |
Excel Workflow
| Excel Task | Formula or Tool | Purpose |
|---|---|---|
| Create nested cell label | =school&":"&studytime | Create labels such as GP:1 and MS:1. |
| Cell mean table | PivotTable | Mean G3 by nested cell. |
| Cell size table | PivotTable count | Check unbalanced cell sizes. |
| Cell SD table | =STDEV.S() | Check spread by nested cell. |
| Outer means | PivotTable by school | Compare GP and MS means. |
| Formal Nested ANOVA | Use SPSS, R or Python | Excel is not recommended as the final test engine. |
Code Blocks for Nested ANOVA
SPSS Syntax for Nested ANOVA
* Nested ANOVA in SPSS.
* Outcome: G3.
* Outer factor: school.
* Nested factor: studytime nested within school.
TITLE "Nested ANOVA: G3 by Studytime Nested within School".
UNIANOVA G3 BY school studytime
/METHOD=SSTYPE(3)
/INTERCEPT=INCLUDE
/PRINT=DESCRIPTIVE ETASQ HOMOGENEITY
/EMMEANS=TABLES(school)
/EMMEANS=TABLES(school*studytime)
/CRITERIA=ALPHA(.05)
/DESIGN=school school*studytime.
OUTPUT EXPORT
/CONTENTS EXPORT=VISIBLE
/PDF DOCUMENTFILE="nested_anova_spss_output.pdf".Python Code for Nested ANOVA
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols
df = pd.read_csv("dataset.csv")
df["G3"] = pd.to_numeric(df["G3"], errors="coerce")
df["school"] = df["school"].astype("category")
df["studytime"] = df["studytime"].astype("category")
df_model = df.dropna(subset=["G3", "school", "studytime"]).copy()
df_model["nested_cell"] = df_model["school"].astype(str) + ":" + df_model["studytime"].astype(str)
# Nested ANOVA model
# school is the outer factor
# studytime is treated as nested within school through the school:studytime term
model = ols("G3 ~ C(school) + C(school):C(studytime)", data=df_model).fit()
anova_table = sm.stats.anova_lm(model, typ=2)
print(anova_table)
# Cell summaries
cell_summary = (
df_model
.groupby(["school", "studytime", "nested_cell"])["G3"]
.agg(["count", "mean", "std"])
.reset_index()
)
print(cell_summary)
# Outer factor summaries
outer_summary = (
df_model
.groupby("school")["G3"]
.agg(["count", "mean", "std"])
.reset_index()
)
print(outer_summary)
# Diagnostics
df_model["fitted"] = model.fittedvalues
df_model["residual"] = model.resid
print(df_model[["G3", "nested_cell", "fitted", "residual"]].head())R Code for Nested ANOVA
library(tidyverse)
df <- read.csv("dataset.csv")
df$G3 <- as.numeric(df$G3)
df$school <- as.factor(df$school)
df$studytime <- as.factor(df$studytime)
df_model <- df %>%
select(G3, school, studytime) %>%
drop_na() %>%
mutate(nested_cell = interaction(school, studytime, sep = ":"))
# Nested ANOVA
model <- aov(G3 ~ school + school:studytime, data = df_model)
summary(model)
# Cell summaries
df_model %>%
group_by(school, studytime, nested_cell) %>%
summarise(
n = n(),
mean = mean(G3),
sd = sd(G3),
.groups = "drop"
)
# Outer factor summaries
df_model %>%
group_by(school) %>%
summarise(
n = n(),
mean = mean(G3),
sd = sd(G3),
.groups = "drop"
)
# Residual diagnostics
plot(model)Excel Notes for Nested ANOVA
Excel can support Nested ANOVA reporting, but use SPSS, R or Python for the final test.
Useful Excel steps:
1. Keep columns: G3, school, studytime.
2. Create nested cell label:
=A2&":"&B2
where A2 contains school and B2 contains studytime.
3. Create PivotTable:
Rows = nested cell
Values = mean G3, count G3, standard deviation G3
4. Create another PivotTable:
Rows = school
Values = mean G3
5. Create bar charts for nested means and outer means.
6. Use SPSS, R or Python for the nested F test and p-values.
7. Report outer p-value, nested p-value, F statistic, df, residual diagnostics and cell-size context.APA Reporting Wording
When reporting Nested ANOVA, identify the outer factor, the nested factor, the dependent variable, the F statistic, degrees of freedom, p-values and diagnostic context. Also state that the nested factor is interpreted inside the outer factor.
APA-style report: A Nested ANOVA was conducted to examine G3 final grade by school and studytime nested within school. The outer school effect was statistically significant, p = 4.202e-14, showing that mean G3 differed between GP and MS. The nested studytime-within-school effect was also significant, F(6, 641) = 6.397, p = 1.478e-06. GP cells generally had higher mean G3 values than MS cells, and higher studytime cells tended to show higher means within schools. Residual diagnostics showed lower-tail departures, so the result was interpreted with diagnostic caution.
Short reporting version: Nested ANOVA showed a significant school effect and a significant studytime-within-school effect on G3. The nested effect was F(6, 641) = 6.397, p = 1.478e-06, indicating that studytime cells nested inside school differed in mean G3.
Common Mistakes
| Mistake | Why It Is Wrong | Correct Practice |
|---|---|---|
| Confusing nested and crossed factors | A nested factor is interpreted inside the outer factor. | Use nested notation such as studytime(school) when the design is nested. |
| Reporting only the nested p-value | The outer factor is also important. | Report both school and studytime-within-school results. |
| Ignoring cell sizes | The chart shows strong imbalance across nested cells. | Report cell counts and standard deviations. |
| Ignoring residual diagnostics | The Q-Q plot shows lower-tail departure. | Discuss residual normality and outlier context. |
| Overinterpreting tiny cells | MS:4 has a very small cell size and wide uncertainty. | Interpret small-cell means cautiously. |
| Using Excel as the final model | Excel does not provide a complete standard nested ANOVA workflow. | Use SPSS, R or Python for formal Nested ANOVA. |
When to Use Nested ANOVA
Use Nested ANOVA when lower-level groups are naturally contained within higher-level groups. Examples include students nested within classrooms, classrooms nested within schools, plots nested within farms, batches nested within factories, and samples nested within laboratories.
| Situation | Use Nested ANOVA? | Reporting Note |
|---|---|---|
| Lower-level groups exist inside higher-level groups | Yes | Use nested-factor notation. |
| Each inner level belongs to only one outer level | Yes | This is a true nested structure. |
| Every level of factor A appears with every level of factor B | No | Use factorial ANOVA instead. |
| Cell sizes are unequal | Yes, with caution | Report cell sizes and use appropriate sums of squares. |
| There is a covariate | Use nested ANCOVA or mixed model | Review ANCOVA. |
Nested ANOVA should be compared with Factorial ANOVA, Fixed Effects ANOVA, Balanced ANOVA, Brown Forsythe ANOVA, ANOVA in SPSS, ANOVA in R, ANOVA in Python, ANOVA Effect Size, and ANOVA Assumptions.
Downloads and Resources for Nested ANOVA
Use these resources to reproduce the Nested ANOVA workflow. The Python report, R report and SPSS output PDF are included as verification files. Script and workbook placeholders can be replaced after the final downloadable files are uploaded to the WordPress Media Library.
Download Dataset
Practice dataset with G3, school and studytime variables.
Download Nested ANOVA Python Report PDF
Python report PDF for nested means, F test, p-value decision and diagnostics.
Download Nested ANOVA R Report PDF
R validation PDF for nested means, cell boxplots, F decision and residual checks.
Download Nested ANOVA SPSS Output PDF
SPSS output PDF for nested ANOVA interpretation and reporting.
Download Python Script
Python code for Nested ANOVA, nested cells, p-values and diagnostics.
Download R Script and Excel Workbook
R workflow and Excel support workbook for Nested ANOVA summaries.
FAQs About Nested ANOVA
What is Nested ANOVA?
Nested ANOVA is an analysis of variance model where one factor is contained inside another factor. It tests the outer factor and the nested factor separately.
What variables were used in this Nested ANOVA example?
The dependent variable was G3 final grade. The outer factor was school, and studytime was treated as nested within school.
What was the outer factor result?
The outer school effect was significant, with p = 4.202e-14.
What was the nested factor result?
The nested studytime-within-school effect was significant, F(6, 641) = 6.397, p = 1.478e-06.
What did the nested group means chart show?
The nested group means chart showed that GP cells were generally higher than MS cells, and higher studytime cells tended to have higher G3 means.
Why is cell size important in Nested ANOVA?
Cell size affects the stability of means and confidence intervals. In this example, GP:2 was large, while MS:4 was very small and had wide uncertainty.
What did the residual Q-Q plot show?
The Q-Q plot showed lower-tail departures from the normal reference line, so residual normality was approximate rather than perfect.
Is Nested ANOVA the same as factorial ANOVA?
No. Nested ANOVA treats one factor as contained inside another factor. Factorial ANOVA treats factors as crossed.
Can Nested ANOVA be done in Excel?
Excel can prepare nested means, cell sizes and charts, but the formal Nested ANOVA model should be run in SPSS, R or Python.
How do I report this Nested ANOVA in APA style?
A concise report is: A Nested ANOVA showed a significant school effect and a significant studytime-within-school effect on G3, F(6, 641) = 6.397, p = 1.478e-06.
