Key takeaway

Keep the cluster count and dependence assumption beside an uncertainty estimate. More repeated rows can shrink an inappropriate calculation while leaving the independent evidence unchanged.

Count the independent draws, then count the rows

An evaluation advertises 160 observations and a narrow uncertainty band. The observations come from four episodes, with 40 rows repeating each episode’s outcome. If all rows from one episode share the same underlying event, the row count alone cannot justify treating them as 160 independent trials. Ask which unit was independently sampled and what dependence remains inside that unit.

Statsmodels describes generalized estimating equations for data that can be correlated within clusters while clusters are uncorrelated. Its worked report displays observation count and cluster count separately. That supplies a useful review distinction, not a recommendation to fit that model to every archive. The uncertainty method must match the sampling, estimand and dependence actually supported by the records.

Four invented episodes, many repeated rows

This hypothetical teaching fixture samples four independent, equally weighted episode units. Their binary episode outcomes are 0, 0, 1 and 1. Each outcome is copied into 40 rows, so the file has 80 positive rows out of 160 and the same overall mean, 0.5. Within each episode the rows are completely dependent by construction. These are invented copies, not new measurements or a model test.

A naive binomial plug-in standard error that treats all 160 rows as independent is √(0.5×0.5/160), approximately 0.039528, or 3.95 percentage points. That independence assumption is false for the fixture. Merely duplicating each row ten more times produces 1,600 rows and a smaller naive standard error of 0.0125, although the four episode outcomes have not changed.

Hypothetical representationRowsIndependent episode unitsNaive row-independent SEEpisode-mean SEM
40 copies per episode16040.0395280.288675
400 copies per episode1,60040.0125000.288675

Calculate on the stipulated episode units

For the hypothetical episode fixture, the four means are still 0, 0, 1 and 1. Their sample variance with denominator 4−1 is (0.25+0.25+0.25+0.25)/3=1/3. The standard error of their equally weighted mean is √((1/3)/4), approximately 0.288675, or 28.87 percentage points. The author independently recomputed this and both naive values using local arithmetic.

SciPy’s sem documentation identifies its standard-error calculation and default ddof=1 convention. Applying that calculation to the four stipulated episode means exposes the effect of choosing the input unit. The function does not discover that these are independent episodes; the fixture states that assumption. Copying rows leaves their four means and this result unchanged.

This contrast is not a confidence interval, an estimate of a universal design effect or proof that four episodes support a precise population claim. It deliberately uses perfect within-episode dependence to make the mechanism visible. A real archive may have unequal cluster sizes, partial dependence, overlapping episodes or dependence between clusters, requiring an appropriate statistical design and reviewer.

Supporting referencesSciPy: sem

A grouped holdout does not settle uncertainty

Keeping an entire facility out of training addresses whether a prediction method travels to an unseen facility. It does not by itself establish how many independent evaluation units the held-out observations supply. A test set can be isolated from training and still contain highly dependent rows. Record those two boundaries separately rather than treating a leakage-free split as an independence certificate.

The same care applies to weights. Equal weighting of the four episode means targets the average of these stipulated episode outcomes. A target defined over workload rows can need another weighting and uncertainty procedure. Do not average cluster rates mechanically when the decision concerns a different estimand. Preserve cluster membership, selection method, sizes and weighting rationale with the cases.

Ask for the evidence the next estimate needs

For the fictional file, the accepted finding is that duplicating rows gives no additional independent episode evidence. The report retains 160 rows, four episode units, the constructed perfect dependence and the distinction between a false row-independent calculation and the episode-level teaching calculation. It leaves population acceptance unresolved rather than converting either number into a passing threshold.

For a real receiving evaluation, request the proposed independent unit, available identifiers that define it, cluster counts and size distribution, known cross-cluster links, sample selection and the analyst’s uncertainty method. Use synthetic membership fixtures where possible before any permitted source sample. If the archive cannot recover grouping, narrow the statistical claim instead of equating a large file with strong independent evidence.

Tools for this decision

Data inventory builder →Diligence question builder →