*! version 1.0.0 10aug2025

Title

surveycluster -- Calculate sample size for cluster-based surveys to achieve desired precision

Syntax

surveycluster
[, options]

Main
confidence(#) confidence level as percentage; default is confidence(95)

moe(#) margin of error in standard deviations; default is moe(0.10)

icc(#) intraclass correlation coefficient; default is icc(0.20)

cluster_size(#) average cluster size; default is cluster_size(25)

population(#) finite population size for correction; default is infinite

Description

surveycluster calculates the required sample size and number of clusters for
survey designs where the goal is to estimate a population mean with a specified
margin of error (precision). This command is designed for single-arm surveys using
cluster sampling, not for comparing groups or hypothesis testing.

The calculation accounts for the design effect due to clustering and optionally
applies finite population correction when sampling from small populations. The
design effect is calculated as DE = 1 + ICC × (cluster_size - 1).

Unlike clustersampsi (which is designed for cluster randomized controlled
trials), surveycluster focuses on achieving a desired precision for
estimating a single population parameter, making it ideal for survey planning
and monitoring & evaluation studies.

Options

Main

confidence(#) specifies the confidence level as a percentage between 10 and 99.99.
The default is confidence(95) for 95% confidence intervals.

moe(#) specifies the desired margin of error in standard deviations, which must be
between 0 and 1. The default is moe(0.10), meaning the estimate will be within
±0.10 standard deviations of the true mean. Smaller values require larger sample sizes.

icc(#) specifies the intraclass correlation coefficient, which must be between 0 and 1.
The default is icc(0.20). This measures how similar observations within the same
cluster are compared to observations in different clusters.

cluster_size(#) specifies the average number of observations per cluster.
The default is cluster_size(25). This should reflect your actual study design.

population(#) specifies the total population size for finite population correction.
By default, the population is assumed to be infinite. When specified, the command applies
finite population correction, potentially reducing the required sample size.

Examples

Basic usage with default settings:

. surveycluster

Typical health facility survey (10 patients per clinic):

. surveycluster, confidence(95) moe(0.15) icc(0.20) cluster_size(10)

School-based survey with higher cluster size:

. surveycluster, conf(90) moe(0.10) icc(0.15) cluster_size(30)

Using abbreviated syntax:

. surveycluster, co(95) mo(0.20) ic(0.10) cl(20)

Finite population correction for 200 total clinics:

. surveycluster, moe(0.20) icc(0.05) cluster_size(15) population(200)

Accessing stored results:

. surveycluster, moe(0.15) icc(0.20)

. * Number of clusters needed:

. di r(clusters)

. * Actual margin of error achieved:

. di %5.3f r(actual_moe)

Comparing different scenarios for cost planning:

. surveycluster, moe(0.10) icc(0.05) cluster_size(10)

. local cost1 = r(actual_n) * 50

. surveycluster, moe(0.10) icc(0.05) cluster_size(20)

. local cost2 = r(actual_n) * 50

. * Cost difference ($):

. di %8.0fc abs(`cost1' - `cost2')

Remarks

surveycluster is designed for planning surveys where observations are naturally
grouped into clusters, such as patients within clinics, students within schools, or
households within villages. The command calculates sample sizes for estimating a
population mean with specified precision.

Intraclass Correlation Coefficient (ICC) measures the similarity of observations within
clusters. Typical values vary by domain:

• Health facilities: 0.01-0.10

• Schools/education: 0.10-0.20

• Households/neighborhoods: 0.01-0.05

• Agricultural plots: 0.05-0.30

Design Effect quantifies the efficiency loss from cluster sampling compared to simple
random sampling. A design effect of 2.0 means you need twice as many observations as you
would with simple random sampling.

Actual vs. Requested MOE: Because the number of clusters must be a whole number, the
actual sample size may exceed what's minimally required, resulting in better precision
(smaller margin of error) than requested.

The command issues warnings for unusual parameter combinations but allows them, recognizing
that some study designs may have atypical characteristics.

If the required sample size exceeds the population, the program caps the sample at the population size. In such cases, the final cluster may be incomplete, so num_clusters × cluster_size may be greater than actual_n.

Comparison with clustersampsi

surveycluster and clustersampsi serve different purposes:

surveycluster (this command):

• For single-arm surveys - estimating one population mean

• Calculates sample size to achieve a specific precision (margin of error)

• No hypothesis testing or group comparisons

• Simple interface focused on survey design

• Includes finite population correction

• Shows actual margin of error achieved

clustersampsi (Hemming & Marsh):

• For cluster randomized controlled trials - comparing two groups

• Calculates power, sample size, or detectable difference between groups

• Requires specifying two means/proportions/rates to compare

• Complex options for varying cluster sizes, baseline correlations

• Designed for clinical trials and intervention studies

Choose surveycluster when you want to estimate a population parameter with
desired precision. Choose clustersampsi when you want to test whether two
groups differ significantly.

Stored results

surveycluster stores the following in r():

Scalars

r(n) required sample size

r(n_original) sample size before finite population correction

r(clusters) number of clusters needed

r(actual_n) actual total sample size (clusters × cluster_size)

r(de) design effect

r(confidence) confidence level

r(moe) requested margin of error

r(actual_moe) actual margin of error achieved

r(icc) intraclass correlation coefficient

r(cluster_size) average cluster size

r(z_value) critical z-value used

r(population) population size (if specified)

r(sampling_fraction) proportion of population sampled (if population specified)

Authors

Kabira Namit

World Bank

Email: knamit@worldbank.org

Cooper Allton

Program Management and Information Director

Samaritan's Purse