14  Sampling Techniques and Sample Size Determination

A sample is a subset of a population selected to represent the whole. Because it is rarely feasible to survey or measure every unit in a population, analysts rely on carefully chosen samples to make inferences about the population as a whole. How a sample is drawn, and how large it is, directly determines how trustworthy those inferences are.

14.1 Population vs Sample

  • Population: The complete set of individuals, items, or events that the researcher is interested in studying.
  • Sample: A subset of the population that is actually observed or measured.
  • Sampling Frame: The list or source from which the sample is actually drawn (for example, a customer database), which may not perfectly match the target population.
  • Sampling Error: The natural difference between a sample statistic and the true population parameter, arising simply because a sample — not the whole population — was observed.

14.2 Probability Sampling Techniques

In probability sampling, every unit in the population has a known, non-zero chance of being selected, which allows the results to be generalised back to the population with a quantifiable margin of error.

Simple Random Sampling

Every member of the population has an equal chance of selection, typically using a random number generator. Example: Randomly selecting 200 customer IDs out of 10,000 for a satisfaction survey.

Systematic Sampling

Selecting every k-th unit from an ordered list after a random starting point. Example: Surveying every 20th customer who enters a store.

Stratified Sampling

Dividing the population into homogeneous subgroups (strata) — such as region or age band — and randomly sampling from each stratum, often in proportion to its size. Example: Sampling employees separately from each department to ensure every department is represented.

Cluster Sampling

Dividing the population into naturally occurring clusters (such as cities or branches), randomly selecting a few whole clusters, and sampling all (or a random subset of) units within them. Example: Randomly selecting 10 bank branches out of 200 and surveying every customer who visits those 10 branches.

14.3 Non-Probability Sampling Techniques

In non-probability sampling, units are selected based on convenience or judgement rather than random chance, which makes the results faster and cheaper to obtain but harder to generalise statistically.

Convenience Sampling

Selecting whichever units are easiest to reach. Example: Surveying shoppers who happen to be near the store entrance.

Judgemental (Purposive) Sampling

Selecting units based on the researcher’s expert judgement about who will provide the most useful information. Example: Interviewing only senior managers about a proposed strategy change.

Quota Sampling

Selecting a fixed number of units from each subgroup, similar to stratified sampling, but without random selection within the subgroup.

Snowball Sampling

Existing study subjects recruit future subjects from among their acquaintances, useful for hard-to-reach populations. Example: Studying a niche professional community by asking each participant to refer others.

14.4 Sample Size Determination

Choosing a sample size balances statistical precision against cost and time: larger samples give more precise estimates but are more expensive to collect. For estimating a population proportion, a commonly used formula is:

\[ n = \frac{Z^2 \, p (1-p)}{e^2} \]

Where:

  • \(n\) is the required sample size.
  • \(Z\) is the z-score corresponding to the desired confidence level (1.96 for 95% confidence).
  • \(p\) is the estimated proportion of the population having the attribute of interest (use 0.5 if unknown, which maximises the required sample size).
  • \(e\) is the desired margin of error (expressed as a decimal, e.g. 0.05 for ±5%).

For estimating a population mean, the analogous formula uses the population standard deviation \(\sigma\) in place of \(p(1-p)\):

\[ n = \left(\frac{Z \, \sigma}{e}\right)^2 \]

14.4.1 Worked Example

A researcher wants to estimate the proportion of customers who are satisfied with a service, with 95% confidence and a margin of error of ±5%. With no prior estimate of \(p\), the conservative value \(p = 0.5\) is used.

\[ n = \frac{(1.96)^2 \times 0.5 \times (1-0.5)}{(0.05)^2} = \frac{0.9604}{0.0025} \approx 384.16 \]

Rounding up, the researcher needs a sample of 385 respondents.

14.5 Sample Size and Sampling in R and Python

14.6 Common Challenges and Best Practices

Challenges
  • A poor sampling frame (an outdated customer list, for example) can bias results even with a large sample.
  • Non-probability samples cannot support formal margin-of-error claims.
  • Very small strata or clusters can leave some subgroups underrepresented.
Best Practices
  • Match the sampling technique to the structure of the population (use stratified sampling when meaningful subgroups exist).
  • Always report the sample size, margin of error, and confidence level alongside any estimate.
  • Prefer probability sampling whenever the goal is to generalise findings back to the full population.

Transition to Data Cleaning

Once the right individuals or records have been sampled, the raw data collected from them is rarely ready for analysis as-is. The next chapter covers data cleaning and preparation — the essential step that turns raw, messy data into an analysis-ready dataset.

Summary

Concept Description
Foundations
Population The complete set of individuals or items the researcher is interested in studying
Sample The subset of the population that is actually observed or measured
Sampling Frame The list or source from which the sample is drawn, which may not perfectly match the population
Sampling Error The natural difference between a sample statistic and the true population parameter
Probability Sampling
Simple Random Sampling Every population member has an equal chance of selection via random draw
Systematic Sampling Selecting every k-th unit from an ordered list after a random start
Stratified Sampling Dividing the population into homogeneous strata and sampling randomly within each
Cluster Sampling Randomly selecting whole naturally occurring clusters and sampling within them
Non-Probability Sampling
Convenience Sampling Selecting whichever units are easiest to reach, without randomisation
Judgemental Sampling Selecting units based on the researcher's expert judgement of usefulness
Quota Sampling Selecting a fixed quota from each subgroup without random selection within it
Snowball Sampling Existing subjects recruit future subjects, useful for hard-to-reach populations
Sample Size
Sample Size Formula (Proportion) n = Z-squared times p(1-p) divided by e-squared, used to size a proportion estimate
Sample Size Formula (Mean) n = (Z times sigma divided by e) squared, used to size a mean estimate
Margin of Error The desired precision of the estimate, expressed as plus-or-minus a percentage or value
Confidence Level (Z) The z-score corresponding to the desired confidence level, 1.96 for 95% confidence
In R and Python
R sample() Base R function used to draw a random sample from a vector or range
Python random.sample() Python standard-library function used to draw a random sample without replacement