Your hospital's patient experience dashboard shows Unit 3B scored 72 on communication and Unit 4A scored 78. Is that a real difference or sampling noise from small survey volumes? Your CNO wants to know whether the night shift actually performs worse than day shift, or whether the numbers just look that way because fewer patients respond at night. Quality improvement teams present bar charts to leadership without confidence intervals or effect sizes, which can make it difficult to judge whether observed gaps exceed sampling variation. Upload your HCAHPS or Press Ganey data and get group comparisons with statistical tests, effect sizes, and pairwise identification of which specific departments differ.
Worked Example: Three Units, Made-Up Scores
Question: Do the average scores differ across three hospital units?
Inputs: Made-up data, seed 41. The script makes 24 scores for each unit: Unit 3B, Unit 4A, and Unit 5C, on a 0 to 100 scale. These are made-up scores, not patient records. The script builds in unit averages of 72, 78, and 75 with a spread (SD) of 10, so the units differ by design. That includes a 6 point gap between Unit 3B and Unit 4A.
Method: The script finds each unit's average and score spread. It uses a one-way ANOVA, a test of three or more averages. Eta-squared shows the share of score spread linked to a unit. The script also uses a Welch test to compare Unit 3B with Unit 4A, and gives a 95% range, called a confidence interval, for the gap between their scores.
Result: The made-up averages were 71.34, 79.28, and 74.73. The ANOVA found a gap among the averages: F(2, 69)=4.577, p=0.0136, with eta-squared of 0.117. That fits the script, which builds in unit differences. Unit 3B's average was 7.94 points below Unit 4A's, larger than the 6 points built in; the 95% range for the gap was -13.38 to -2.50 points, which contains -6. With 24 scores per unit, a rerun could miss the built-in gap. These results apply only to this made-up group.
Limit: Made-up scores do not show what may happen with real patients. The example does not account for shifts, patient mix, or survey replies.
Complete script:
import numpy as np
from scipy import stats
# Made-up patient satisfaction scores, generated with seed 41.
# Scores are on a 0 to 100 scale for three units.
# Built-in unit means: 72, 78 and 75, with SD 10 in every unit.
rng = np.random.default_rng(41)
units = {
"Unit 3B": np.clip(rng.normal(72, 10, 24), 0, 100),
"Unit 4A": np.clip(rng.normal(78, 10, 24), 0, 100),
"Unit 5C": np.clip(rng.normal(75, 10, 24), 0, 100),
}
for name, scores in units.items():
print(f"{name}: n={len(scores)}, mean={scores.mean():.2f}, "
f"SD={scores.std(ddof=1):.2f}")
f_stat, p_value = stats.f_oneway(*units.values())
all_scores = np.concatenate(list(units.values()))
grand_mean = all_scores.mean()
ss_between = sum(len(x) * (x.mean() - grand_mean) ** 2
for x in units.values())
ss_total = sum((all_scores - grand_mean) ** 2)
eta_sq = ss_between / ss_total
print(f"One-way ANOVA: F(2, 69)={f_stat:.3f}, p={p_value:.4f}, "
f"eta-squared={eta_sq:.3f}")
a = units["Unit 3B"]
b = units["Unit 4A"]
difference = a.mean() - b.mean()
se = np.sqrt(a.var(ddof=1) / len(a) + b.var(ddof=1) / len(b))
df = (a.var(ddof=1) / len(a) + b.var(ddof=1) / len(b)) ** 2 / (
(a.var(ddof=1) / len(a)) ** 2 / (len(a) - 1)
+ (b.var(ddof=1) / len(b)) ** 2 / (len(b) - 1)
)
t_crit = stats.t.ppf(0.975, df)
t_stat, pair_p = stats.ttest_ind(a, b, equal_var=False)
low, high = difference - t_crit * se, difference + t_crit * se
print(f"Unit 3B minus Unit 4A: {difference:.2f} points, "
f"95% CI [{low:.2f}, {high:.2f}], Welch p={pair_p:.4f}")
Output from running the script:
Unit 3B: n=24, mean=71.34, SD=9.18
Unit 4A: n=24, mean=79.28, SD=9.55
Unit 5C: n=24, mean=74.73, SD=8.61
One-way ANOVA: F(2, 69)=4.577, p=0.0136, eta-squared=0.117
Unit 3B minus Unit 4A: -7.94 points, 95% CI [-13.38, -2.50], Welch p=0.0052
Why Statistical Analysis of Patient Satisfaction Matters
Patient satisfaction scores are used to compare units, shifts, and facilities, so telling a real gap from noise matters. HCAHPS and similar surveys give hospitals more granular satisfaction data than before. The question is whether QI teams have the tools to analyze it properly.
Most hospital quality improvement teams rely on Press Ganey reports, Excel pivot tables, or SurveyMonkey summary statistics. They can calculate an average score per department. They cannot run a proper ANOVA with Tukey post-hoc tests to identify which specific departments differ significantly. They present bar charts to the C-suite without confidence intervals, making it impossible for leadership to distinguish actionable insights from statistical noise. The result is either paralysis (we cannot prove anything is different) or misdirected investment (we spent on training in a department where the difference was not real).
When to Analyze Patient Satisfaction Data
Comparing departments or units. Your five medical-surgical units each receive HCAHPS surveys. Is the variation in overall satisfaction scores meaningful, or is it within the range you would expect from random sampling? ANOVA tests this, and Tukey post-hoc tests tell you which specific unit pairs differ. A made-up example of what you might present to leadership: "Unit 3B scores significantly lower than Units 4A and 5C on communication, but does not differ from Units 2A or 6D."
Evaluating shift differences. Night shift satisfaction scores appear lower. Is that a staffing problem or a survey response bias? A t-test (or Mann-Whitney for ordinal data) with effect size tells you whether the difference is statistically significant and practically meaningful. Report the effect size along with the p-value, so readers can see how large the difference is.
Pre/post intervention assessment. You implemented bedside shift report in Q1. Did communication scores improve? Comparing pre- and post-intervention periods with proper statistical testing separates real improvement from regression to the mean. If the study does not show a clear gain, check how large the change was and its range. Check if the study had enough data to find a gain. Then decide whether to use the intervention more widely.
Multi-facility benchmarking. Health systems with many facilities need to know which locations are underperforming and by how much. ANOVA across facilities with effect sizes tells the VP of Patient Services whether facility averages differ overall and by how much. ANOVA alone does not rank facilities or say which pairs differ: that needs post-hoc pairwise comparisons with a multiple-comparison adjustment.
Domain-level analysis. HCAHPS measures domains such as communication with nurses, communication with doctors, responsiveness of hospital staff, pain management, communication about medicines, discharge information, care transition, and hospital environment. Cross-tabulation and chi-square tests reveal whether underperformance is concentrated in specific domains or spread across all of them. This determines whether the fix is domain-specific (nurse communication training) or systemic (staffing, culture).
What Data You Need
A CSV export from your HCAHPS survey platform, Press Ganey extract, post-discharge survey system (Qualtrics, SurveyMonkey), or EHR patient feedback module. The key columns:
- Response ID: unique identifier per survey response
- Department or unit: the primary grouping variable (department name, unit code, facility, shift, provider)
- Overall satisfaction score: numeric rating (1-10, 1-100, or Likert scale)
Columns that strengthen the analysis
- Domain-specific scores: communication, responsiveness, cleanliness, pain management, discharge information. Each additional score enables multi-domain comparison.
- Patient demographics: age group, visit type (inpatient, outpatient, ED), insurance type. These allow subgroup analysis and can serve as covariates.
- Time period: survey date or quarter for trend analysis and pre/post comparisons
- Provider: attending physician or primary nurse for provider-level comparison
Reply counts are estimates. Use the likely effect, the study plan, and the reply rate to plan how many replies you need.
How to Read the Report
Score distributions. Density curves for each satisfaction measure show the shape of your data. Heavily left-skewed distributions (most scores clustered at the top with a tail of low scores) are typical for patient satisfaction data. If distributions differ dramatically across departments, that itself is informative. One unit might have bimodal scores (happy patients and unhappy patients with few in between), suggesting two distinct patient experiences within the same unit.
Categorical distributions. Frequency breakdowns of each grouping variable show how many responses came from each department, shift, or facility. Severely unbalanced groups (one department with 200 responses, another with 15) reduce the statistical power of comparisons involving the smaller group.
ANOVA results. The F-statistic and p-value test whether at least one group mean differs from the others. If you set 0.05 as the threshold in advance, a p-value below it means the differences are statistically significant at that level. But statistical significance alone is not enough for decision-making. The eta-squared effect size tells you how much of the total variation in satisfaction scores is explained by department membership. Judge its value for care on its own, using a limit that fits the result and care setting.
Tukey HSD post-hoc comparisons. After ANOVA finds a significant overall difference, Tukey tests every pair of departments and tells you which specific pairs differ. This is the actionable output. Instead of "departments differ," you get a gap for each pair of departments, with a range around it. The worked example above shows this for one pair of made-up units. The forest plot visualizes these pairwise differences with confidence intervals.
Chi-square cross-tabulations. Tests whether categorical variables are independent. For example: is department associated with satisfaction tier (high/medium/low)? Is insurance type associated with response rate? Significant associations reveal structural patterns that explain satisfaction variation beyond the department effect.
Executive summary. Distills all findings into key takeaways with specific, actionable recommendations. This is the page you bring to the QI steering committee or the CNO's office.
What to Do With the Results
Immediate actions
- Focus interventions on statistically confirmed gaps. If Tukey HSD shows Unit 3B is significantly worse than three other units on communication, that is where training resources go. If the difference is not significant, check how large the gap was and whether the data had enough responses to show one before deciding.
- Present evidence-based findings to leadership. Replace "Unit 3B scores lower" with the size of the gap, its 95% range, and the p-value, as in the worked example above.
Quarterly monitoring
- Run the analysis quarterly to track whether interventions are working. Compare pre/post effect sizes, not just raw averages.
- Monitor domain-specific trends. Improvement in one domain often coincides with decline in another (the "squeaky wheel" effect). Multi-domain comparison catches this.
- Check with subgroup analysis. If the intervention targeted a specific patient population (e.g., post-surgical patients), filter the data and rerun to confirm the effect is in the target group.
When to Use Something Else
- Only two groups to compare (e.g., pre vs. post): A t-test gives the same answer with a simpler, directional result.
- Ordinal Likert data with normality concerns: The Kruskal-Wallis test is a rank-based comparison of group distributions that does not assume normality. It can be read as a comparison of medians only when the groups have similarly shaped distributions.
- Need to control for confounders: ANCOVA compares department scores while adjusting for patient age, acuity, and insurance type: critical when departments serve different patient populations.
- Want to predict individual satisfaction: Clinical outcome prediction with logistic regression predicts whether a specific patient will be satisfied or dissatisfied based on their characteristics.
- Measuring rater agreement, not patient outcomes: Inter-rater reliability analysis measures whether clinicians agree, which is a different question from whether patients are satisfied.
Your turn
Bring your own data and the question you actually need answered.
MCP AnalyticsData science by email Send us your data and your question, and we will reply. ds@mcpanalytics.ai