Signature
m_w = (CV^2 + 1) * m_bar; DEFF_u = 1 + (m_w - 1) * rho
| Inputs | Definition | Unit |
|---|---|---|
CV | Standard deviation of cluster size divided by mean cluster size, zero for equal clusters | ratio |
m_bar | Mean number of people per cluster | people per cluster |
rho | Intracluster correlation coefficient, at least 0 and at most 1 | proportion |
m_w | The product (CV^2 + 1) m_bar, equal to the sum of squared sizes over the sum of sizes when CV uses divisor c, the number of clusters (derived) | people per cluster |
|---|---|---|
DEFF_u | Design effect allowing for the spread of cluster sizes | ratio |
Function
Design effect of a clustered or weighted sample and the effective sample size it implies
Maps the variance of an estimate under a complex sample, or the cluster size, intracluster correlation and survey weights behind that variance, to the design effect, its square root, the effective sample size and the sample size a precision target needs. The simple random sample variance of a proportion is the square of SE_p in HE-FM-BINOM-004, and the independence assumption of a binomial count, HE-AS-BINOM-002, fails under clustering. An interval around a survey estimate is HE-FM-AN-001 with the inflated standard error. A beta distribution for a clustered survey proportion is HE-FM-BETA-003 with that inflated standard error, and its parameters then sum to the effective sample size minus 1 (derived), so neither is restated here. The prevalence itself under survey weights is HE-FM-XSD-001. Notation follows the Design Effect article.
Computational function
Computational function for design effects from the size of each cluster
Takes the number of people in each cluster and the intracluster correlation, and returns the mean size, the coefficient of variation of size, two design effects and the effective sample size under each. DE_17 is HE-FM-DESE-003 with CV computed from the list. DE_15 is Rutterford and colleagues' equation 15, which needs each cluster's size and is for a cluster-level analysis with minimum variance weighting of continuous or binary outcomes, or for GEE with exchangeable correlation, robust variance estimators and binary outcomes. The inputs therefore differ from the formula's variables, which hold only a mean and a spread. The calculator line writes four clusters out term by term, and the Excel, R and Python code accept any number.
Inputs and outputs:
n_1ton_4are the people in each cluster, whole numbers of 1 or more.rhois the intracluster correlation, at least 0 and at most 1.n_baris the mean size.s2_nis the variance of size with divisor equal to the number of clusters.CVis the coefficient of variation of size.q_1toq_4are each size over its own equal-cluster inflation factor.DE_15andDE_17are the design effects (ratio).n_eff_15andn_eff_17are the total people divided by each design effect.Assumption: Cluster sizes are known in advance. A sample size built on either design effect needs enough clusters for the normal approximation (HE-AS-DESE-009), so the four clusters in the examples show the arithmetic only. In a trial the list holds the clusters of one group, because c in equation 15 counts clusters per group. DE_15 is not above DE_17 for rho of at least 0 and at most 1 (derived, no failure on 200,000 random lists), and the two agree when all sizes are equal.
Worked example (Illustrative sizes of 10, 15, 25 and 30): The spread is CV of 0.3953, above the 0.23 point, and the two forms give 2.0341 and 2.10625 at rho of 0.05.
n_1 = 10; n_2 = 15; n_3 = 25; n_4 = 30; rho = 0.05; n_bar = 20; s2_n = 62.5; CV = 0.3953; DE_17 = 2.10625; q_1 = 6.8966; q_2 = 8.8235; q_3 = 11.3636; q_4 = 12.2449; DE_15 = 2.0341; n_eff_15 = 39.33; n_eff_17 = 37.98Worked example (Equal sizes): Four clusters of 20 at rho of 0.05 return the first part of HE-FM-DESE-002 from both forms, a limiting case that checks an implementation.
n_1 = 20; n_2 = 20; n_3 = 20; n_4 = 20; rho = 0.05; n_bar = 20; s2_n = 0; CV = 0; DE_17 = 1.95; q_1 = 10.2564; q_2 = 10.2564; q_3 = 10.2564; q_4 = 10.2564; DE_15 = 1.95; n_eff_15 = 41.03; n_eff_17 = 41.03Excel:
=SUM(ClusterSizes)/SUMPRODUCT(ClusterSizes/(1+(ClusterSizes-1)*IntraclusterCorrelation))fills a cell named DesignEffectEqn15, and=1+(((STDEVP(ClusterSizes)/AVERAGE(ClusterSizes))^2+1)*AVERAGE(ClusterSizes)-1)*IntraclusterCorrelationfills a cell named DesignEffectEqn17. SUM, AVERAGE and STDEVP ignore blank cells, and SUMPRODUCT reads a blank as a size of 0, which adds nothing to its total unless rho is 1, where it returns #DIV/0!. A text cell in the range returns #VALUE! in the first formula, and an empty range returns #DIV/0! in both.R:
de_sizes <- function(sizes, rho) { if (length(sizes) == 0 || min(sizes) < 1) return(NULL); n_tot <- sum(sizes); n_bar <- mean(sizes); cv2 <- mean((sizes-n_bar)^2)/n_bar^2; de_17 <- 1+((cv2+1)*n_bar-1)*rho; de_15 <- n_tot/sum(sizes/(1+(sizes-1)*rho)); c(n_bar = n_bar, CV = sqrt(cv2), DE_15 = de_15, DE_17 = de_17, n_eff_15 = n_tot/de_15, n_eff_17 = n_tot/de_17) }Returns a named vector, and NULL for an empty list or a size below 1. A single cluster returns CV of 0 and both design effects equal to the first part of HE-FM-DESE-002.Python:
def de_sizes(sizes, rho): c = len(sizes); valid = c > 0 and min(sizes) >= 1; n_tot = sum(sizes); n_bar = n_tot/c if valid else None; cv2 = sum((x-n_bar)**2 for x in sizes)/c/n_bar**2 if valid else None; de_17 = 1+((cv2+1)*n_bar-1)*rho if valid else None; de_15 = n_tot/sum(x/(1+(x-1)*rho) for x in sizes) if valid else None; return (n_bar, cv2**0.5, de_15, de_17, n_tot/de_15, n_tot/de_17) if valid else NonePlain Python with no imports, returning a tuple in the order of the outputs and None for an empty list or a size below 1, so no input of valid sizes divides by zero.Test (Illustrative sizes): With ClusterSizes holding 10, 15, 25 and 30 and IntraclusterCorrelation 0.05, the two cells are compared with the hand values. The expected result is TRUE. Doubling or halving either cell gives FALSE, and a cell using STDEV in place of STDEVP returns 2.1583 and FALSE. Excel check
=AND(ABS(DesignEffectEqn15-2.0341)<0.0005,ABS(DesignEffectEqn17-2.10625)<0.0005)Test (Equal sizes): With four sizes of 20, both cells equal the first part of HE-FM-DESE-002 computed from the mean size. The expected result is TRUE. Doubling or halving either cell gives FALSE. Excel check
=AND(ABS(DesignEffectEqn15-(1+(AVERAGE(ClusterSizes)-1)*IntraclusterCorrelation))<1E-9,ABS(DesignEffectEqn17-(1+(AVERAGE(ClusterSizes)-1)*IntraclusterCorrelation))<1E-9)Common error (Sample standard deviation on a full list of clusters): STDEV with divisor c minus 1 gives CV of 0.4564 and 2.1583 in the example, against 0.3953 and 2.10625 with STDEVP. Only the divisor c makes the sizes form equal equation 16 (derived). A published CV should be used as reported, since its divisor may not be stated.
Source: Rutterford C, Copas A, Eldridge S. Methods for sample size determination in cluster randomized trials. International Journal of Epidemiology. 2015;44(3):1051-1067. doi:10.1093/ije/dyv113. Section Variable cluster sizes, equations 15, 16 and 17.
n_bar = (n_1 + n_2 + n_3 + n_4) / 4; s2_n = ((n_1 - n_bar)^2 + (n_2 - n_bar)^2 + (n_3 - n_bar)^2 + (n_4 - n_bar)^2) / 4; CV = sqrt(s2_n) / n_bar; DE_17 = 1 + ((CV^2 + 1) * n_bar - 1) * rho; q_1 = n_1 / (1 + (n_1 - 1) * rho); q_2 = n_2 / (1 + (n_2 - 1) * rho); q_3 = n_3 / (1 + (n_3 - 1) * rho); q_4 = n_4 / (1 + (n_4 - 1) * rho); DE_15 = 4 * n_bar / (q_1 + q_2 + q_3 + q_4); n_eff_15 = 4 * n_bar / DE_15; n_eff_17 = 4 * n_bar / DE_17
Try this function
Implementations
Excel
Unequal cluster design effect from named cells
With inputs in cells named ClusterSizeCV, MeanClusterSize and IntraclusterCorrelation, the two formulas fill cells named RaisedClusterSize and UnequalDesignEffect. A blank ClusterSizeCV is treated as 0 and returns the equal-cluster value with no warning.
=(ClusterSizeCV^2+1)*MeanClusterSize; =1+(RaisedClusterSize-1)*IntraclusterCorrelation
Assumptions
Weighted cluster-level analysis behind the unequal cluster form
Rutterford and colleagues state that this design effect can be used with an appropriately weighted cluster-level analysis for binary or continuous outcomes, and that because individual-level analyses are more efficient it overestimates the sample size required for most individual-level analyses.
Spread of cluster size above 0.23 and how the spread is measured
Rutterford and colleagues recommend methods for variable cluster size when CV is greater than 0.23 and say the standard design effect suffices below that. They note that the mean and standard deviation of the sampling distribution may differ from those of the population of all clusters. For a known full list of sizes, CV with divisor c makes DEFF_u equal to their equation 16 (derived, no mismatch on 200,000 random lists).
Worked examples
Practice survey with a cluster size coefficient of variation of 0.5
In the article's illustrative case the number of patients per practice varies around a mean of 20 with CV of 0.5, so m_w is 25 and the design effect 2.2. The effective sample size of 600 patients falls to 273 under HE-FM-DESE-001.
CV = 0.5; m_bar = 20; rho = 0.05; m_w = 25; DEFF_u = 2.2
Cluster size coefficient of variation at the 0.23 adjustment point
At a CV of 0.23 with the same illustrative mean and correlation, the design effect is 2.0029, about 2.7% above the equal-cluster 1.95 (derived). Rutterford and colleagues say that adjustment is not deemed necessary below this point.
CV = 0.23; m_bar = 20; rho = 0.05; m_w = 21.058; DEFF_u = 2.0029
Common errors
Mean cluster size used alone when cluster sizes vary
Rutterford and colleagues state that this underestimates the required sample size, more so as variation in cluster size increases. In the article's case the simple formula gives 1.95 in place of 2.2, so the effective sample size of 600 patients reads 307.7 in place of 272.7 (derived).
Largest cluster size used in place of the spread of sizes
Rutterford and colleagues warn that the maximum cluster size may be overly conservative. With illustrative sizes of 10, 15, 25 and 30 at rho of 0.05, the maximum gives 2.45 against 2.10625 from the mean and spread (derived).
Spread of cluster size treated as a spread of survey weights
The two coefficients of variation act differently. A value of 0.5 for cluster size gives 2.2 here, while 0.5 for survey weights in HE-FM-DESE-002 at the same m and rho gives 2.4375 (derived), so the coefficient has to be entered in the formula it belongs to.
Sources
Rutterford and colleagues on design effects for variable cluster sizes
Rutterford C, Copas A, Eldridge S. Methods for sample size determination in cluster randomized trials. International Journal of Epidemiology. 2015;44(3):1051-1067. doi:10.1093/ije/dyv113. The section Variable cluster sizes recommends methods for variable size when the coefficient of variation is greater than 0.23, prints equation 15 for a cluster-level analysis with minimum variance weighting of continuous or binary outcomes and for GEE with exchangeable correlation, robust variance estimators and binary outcomes, equation 16 for a working independence model when the true correlation is exchangeable, and equation 17, 1 + {(CV squared + 1) n bar minus 1} rho, and says of equation 17 that it can be used with an appropriately weighted cluster-level analysis and overestimates the sample size for most individual-level analyses.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
