Tutorials › Introduction to Statistics › Sample Proportions as Means of Indicator Variables

Sampling Distributions of Proportions and Means · Tutorial 518 of 996

Sample Proportions as Means of Indicator Variables

Learn how zero-one indicators turn a sample proportion into a sample mean, and use that representation to derive its center and standard error.

Intermediate 10 min read

What You'll Learn

  • Define a zero-one indicator for a binary outcome
  • Express a sample proportion as the mean of its indicators
  • Derive the expected value and variance of an indicator
  • Obtain the variance and standard error of a sample proportion under independent sampling
  • Apply the finite population correction when sampling without replacement
  • Distinguish an observed proportion from its sampling variability

Why a Proportion Can Be a Mean

A sample proportion is usually introduced as a count of successes divided by the sample size. That definition is simple, but it can hide a useful connection: every binary observation can be represented by a number, zero or one, and the average of those numbers is exactly the sample proportion. This makes the tools for understanding sample means directly useful for proportions.

The connection is more than an alternative way to calculate. It explains why the sample proportion is centered at the population proportion and why its standard error has the familiar form involving \(p(1-p)\). It also makes clear how sampling without replacement changes the variability.

Definition: For a binary outcome, define an indicator variable \(I_i\) for observation \(i\) by setting \(I_i=1\) if the outcome for that observation is a success, and \(I_i=0\) otherwise. If \(n\) such outcomes are observed, their sample proportion is $$ \hat{p}=\frac{1}{n}\sum_{i=1}^{n} I_i=\bar{I}, $$ where \(\bar{I}\) is the sample mean of the indicators. The value of \(\hat{p}\) is the number of successes divided by \(n\).

“Success” is simply the name assigned to the outcome of interest; it need not mean a desirable result. For example, a success might be a patient experiencing a specified side effect, a part failing inspection, or a respondent answering “yes.” The important condition is that each observation is classified into exactly one of two categories for this calculation.

What the Indicator’s Mean and Variance Tell Us

Suppose each sampled observation has probability \(p\) of being a success. Then an indicator \(I_i\) has value 1 with probability \(p\), and value 0 with probability \(1-p\). Its expected value and variance follow directly from these two possible values.

$$ E[I_i]=1\cdot p+0\cdot(1-p)=p $$

Because \(I_i^2=I_i\) whether \(I_i\) is zero or one, \(E[I_i^2]=p\). Therefore its variance is

$$ \operatorname{Var}(I_i)=E[I_i^2]-(E[I_i])^2=p-p^2=p(1-p). $$

So the mean of one zero-one indicator is the success probability, and its variance is \(p(1-p)\). Since \(\hat{p}\) is the mean of the indicators, the expected value and variance of a sample proportion can now be obtained using the corresponding rules for a sample mean.

Deriving the Independent-Sampling Formulas

First consider a model in which the \(n\) indicators are independent and each has the same success probability \(p\). This describes, for example, independent trials with a constant chance of success. Independence matters for the variance calculation: it makes the covariance between distinct indicators zero.

$$ E[\hat{p}] =E\left[\frac{1}{n}\sum_{i=1}^{n}I_i\right] =\frac{1}{n}\sum_{i=1}^{n}E[I_i] =\frac{1}{n}(np) =p. $$

For the variance, multiplying a random variable by \(1/n\) multiplies its variance by \(1/n^2\). Independence means the variance of the sum is the sum of the variances, so

$$ \operatorname{Var}(\hat{p}) =\operatorname{Var}\left(\frac{1}{n}\sum_{i=1}^{n}I_i\right) =\frac{1}{n^2}\sum_{i=1}^{n}\operatorname{Var}(I_i) =\frac{1}{n^2}\bigl(np(1-p)\bigr) =\frac{p(1-p)}{n}. $$
Theorem: If the \(n\) binary observations are independent and have a common probability \(p\) of success, then \(E[\hat{p}]=p\), \(\operatorname{Var}(\hat{p})=p(1-p)/n\), and the standard error of \(\hat{p}\) is $$ SE(\hat{p})=\sqrt{\frac{p(1-p)}{n}}. $$

These results give the center and spread of the sampling distribution: across repetitions of the same sampling process, the mean of the sample proportions is \(p\), and their standard deviation is \(\sqrt{p(1-p)/n}\). The formulas do not say that every sample proportion equals \(p\). Individual samples vary; the standard error describes the typical scale of that sampling variation.

Worked Example: Turning Recorded Responses Into an Indicator Mean

In a hypothetical sample of eight clinic visitors, the recorded response is whether each visitor brought a current medication list. The responses are Yes, No, Yes, Yes, No, No, Yes, No. Let Yes be the success outcome. Write the responses as indicators and calculate the observed sample proportion.

Assign 1 to Yes and 0 to No. In the order recorded, the indicators are \(1,0,1,1,0,0,1,0\). Their sum is 4, so

$$ \hat{p}=\bar{I} =\frac{1+0+1+1+0+0+1+0}{8} =\frac{4}{8} =0.500. $$

Thus, 50.0% of these eight visitors brought a current medication list. This calculation describes the observed sample. It does not, by itself, establish the population proportion or the standard error: those refer to a sampling model for how the sample was obtained.

Independent-Sampling Example: Finding the Standard Error

The independent-sampling formula is appropriate when observations can be treated as independent draws from a common population, or when a process specifies independent trials with the same success probability. If data come from a finite population sampled without replacement, independence does not hold exactly; the finite population correction is addressed below.

Worked Example: A Proportion Under Independent Sampling

Suppose, hypothetically, that a quality-control process selects \(n=100\) parts independently, and each part has probability \(p=0.08\) of failing a specified inspection. Find the expected sample proportion, its variance, and its standard error.

Each part’s failure indicator has mean \(p=0.08\) and variance \(p(1-p)=0.08(0.92)\). The independent, common-probability model is part of the stated process, so the formulas apply:

$$ E[\hat{p}]=p=0.08 $$
$$ \operatorname{Var}(\hat{p}) =\frac{p(1-p)}{n} =\frac{0.08(0.92)}{100} =\frac{0.0736}{100} =0.000736 $$
$$ SE(\hat{p}) =\sqrt{0.000736} \approx 0.02713. $$

Across repeated samples of 100 parts under this model, the sample proportion failing inspection is centered at 0.08, or 8%, with a standard error of about 0.0271, or 2.71 percentage points. The standard error is in proportion units; multiplying by 100 expresses it in percentage points.

Sampling Without Replacement From a Finite Population

When a simple random sample is drawn without replacement from a fixed population of \(N\) units, the indicators are not independent: selecting one unit changes the probabilities for the remaining units. The sample proportion is still the mean of the sampled indicators, and its expected value is still the population proportion. Its variance, however, includes a finite population correction.

Let \(p_N\) be the fraction of the \(N\) population units with the success outcome. Using the finite population correction for a sample mean, the variance of the sample proportion is

$$ \operatorname{Var}(\hat{p}) =\frac{N-n}{N-1}\frac{p_N(1-p_N)}{n}, \qquad SE(\hat{p}) =\sqrt{\frac{N-n}{N-1}\frac{p_N(1-p_N)}{n}}. $$

To see why the same correction applies, treat the \(N\) fixed zero-one population values as the values of a variable. Their population mean is \(p_N\), and their variance when calculated with denominator \(N\) is \(p_N(1-p_N)\). Their finite-population sample variance, calculated with denominator \(N-1\), is therefore \(N p_N(1-p_N)/(N-1)\). The variance of the sample mean without replacement is \( (1-n/N)/n \) times that sample variance. Substituting and simplifying gives

$$ \operatorname{Var}(\hat{p}) =\frac{1-n/N}{n}\frac{N}{N-1}p_N(1-p_N) =\frac{N-n}{N-1}\frac{p_N(1-p_N)}{n}. $$

The correction reflects that sampling a substantial fraction of a fixed population leaves less uncertainty than taking the same number of independent draws from a population model. If \(n=N\), the sample includes the entire population and the variance is zero.

Worked Example: A Simple Random Sample Without Replacement

A hypothetical clinic has \(N=20\) patient files in a review batch. Exactly 8 files contain a specified documentation error. A simple random sample of \(n=5\) files is selected without replacement. Find the population proportion, the expected sample proportion, and the standard error.

The fixed population proportion is \(p_N=8/20=0.400\). Since the sample is a simple random sample, each file has the same chance of selection, so the sample proportion is centered at \(p_N\). Because selection is without replacement from a finite population, use the finite population correction:

$$ E[\hat{p}]=p_N=0.400 $$
$$ \operatorname{Var}(\hat{p}) =\frac{20-5}{20-1}\frac{0.400(1-0.400)}{5} =\frac{15}{19}\frac{0.240}{5} =\frac{15}{19}(0.048) \approx 0.03789 $$
$$ SE(\hat{p})=\sqrt{0.03789}\approx 0.1947. $$

Across repeated samples of five files drawn this way, the sample proportion is centered at 0.400, or 40.0%, with a standard error of about 0.195, or 19.5 percentage points. The correction is important here because one quarter of the batch is sampled. No claim is made that the observed sample itself must have a proportion of exactly 0.400.

When the Indicator Representation Is Useful

The representation links a proportion problem to a mean problem without changing what is being measured. Each indicator records one binary outcome, and their average records the fraction of successes. This viewpoint is useful for checking formulas, interpreting standard errors, and recognizing which sampling assumptions matter.

  • It explains the factor \(p(1-p)\). This is the variance of a single zero-one indicator, before averaging across observations.
  • It identifies the role of sample size. Under independent sampling, averaging \(n\) indicators gives variance \(p(1-p)/n\).
  • It makes the finite-population adjustment transparent. When the binary values are sampled without replacement, the sample-mean correction applies to their average, which is \(\hat{p}\).
  • It keeps the outcome definition explicit. Changing which outcome counts as success changes the indicator and the proportion being studied.

Common Mistake: Treating Every Sample Like Independent Trials

A frequent error is to use \(p(1-p)/n\) automatically whenever a proportion is calculated. That variance formula requires independent indicators with a common success probability. A simple random sample without replacement from a finite population has dependent indicators, so its variance requires the finite population correction. Another error is to treat the observed \(\hat{p}\) as if it were the population parameter \(p\): \(\hat{p}\) is a statistic that varies from sample to sample, while \(p\) is the model’s success probability or, in a fixed finite population, \(p_N\) is the population fraction.

Key takeaway: A sample proportion is the sample mean of zero-one indicators. Its center and variability follow from the indicators’ mean and variance, with the sampling design determining whether the independent-sampling formula or a finite population correction is appropriate.

Check Your Understanding

Answer each question using the indicator representation.

  1. A sample contains 12 binary outcomes, of which 9 are successes. Write the indicator-mean expression for \(\hat{p}\) and calculate its value.
  2. If one indicator has success probability \(p\), explain why \(E[I_i]=p\) and \(\operatorname{Var}(I_i)=p(1-p)\).
  3. For independent observations with \(p=0.25\) and \(n=40\), write the formula for \(E[\hat{p}]\), the variance, and the standard error. Which assumptions justify the variance formula?
  4. A sample is drawn without replacement from a fixed population and includes every population unit. What is the sampling variance of \(\hat{p}\), and why?
  5. Explain why an observed sample proportion and the population proportion are not interchangeable, even though the sample proportion estimates the population proportion.