Tutorials › AP Statistics › Observational Studies and Confounding

Regression and context · Tutorial 924 of 1000

Observational Studies and Confounding

See how confounding can make variables appear associated in observational data, even when comparisons within relevant groups show a different pattern.

Intermediate 9 min read

What You'll Learn

  • Define confounding in an observational study.
  • Explain how group differences can create a pooled association.
  • Calculate and compare pooled and within-group patterns.
  • Describe how confounding can exaggerate, weaken, or reverse an association.
  • State what observational regression does and does not establish.

How an Observed Association Can Be Confounded

In “Association Versus Causation in Regression,” you learned that a fitted line summarizes an association but does not, by itself, establish cause and effect. A reason this caution matters is that an observational study may include other variables that differ systematically across cases. Those variables can help produce the association between the explanatory variable and the response.

For example, students who use a study app more often might also have different prior achievement from students who use it less. Prior achievement is relevant because it may be related both to app use and to later scores. If we compare all students together, a difference in prior achievement can become mixed up with the app-use pattern.

Definition: Confounding occurs when the effects or relationships of two or more variables with a response are mixed together, so their separate contributions are difficult to distinguish. A potential confounding variable is related to both the explanatory variable and the response and differs across the explanatory variable’s values or groups.

A third variable is not automatically a confounder just because it is present. It matters when it is related to the explanatory variable and also related to the response. In an observational study, researchers record what occurs rather than assigning the explanatory variable. As a result, cases with different explanatory-variable values may also differ in other relevant ways.

Confounding can create an association, exaggerate or weaken an association that is already present, or even make the overall pattern point in the opposite direction from patterns within groups. Looking at groups separately can reveal how the overall association is connected to differences among those groups. But doing so does not prove cause and effect or guarantee that every possible confounding variable has been accounted for.

Group Differences Can Drive a Pooled Pattern

Suppose an observational study looks at the relationship between weekly exercise hours and resting heart rate. Age could be a potential confounding variable: age may be related to typical exercise hours and to resting heart rate. If the younger and older people in the data differ on both measurements, their differences can contribute to the overall association.

The key idea is to distinguish a within-group pattern from a pooled pattern. A within-group pattern describes the association among cases in one group, such as younger people. A pooled pattern describes the association after combining groups. The pooled pattern can reflect differences between groups as well as patterns within them.

Key idea: When groups differ in both the explanatory variable and the response, combining them can produce an overall association that does not describe the relationship within each group. The overall regression pattern alone cannot separate these contributions.

This does not mean every observational association is entirely due to confounding. A confounder may explain part of a pattern, or it may help explain why an observed pattern is stronger, weaker, or different from a within-group pattern. The design and variables measured determine what comparisons are possible.

Worked Examples: Seeing Confounding in the Data

Worked Example: Exercise, Resting Heart Rate, and Age

A fictional observational study records weekly exercise hours \(x\), resting heart rate \(y\) in beats per minute, and age group for four people. The numbers below are invented solely to illustrate how age can be related to an overall regression pattern.

PersonAge groupExercise, \(x\) (hours per week)Resting heart rate, \(y\) (beats per minute)
AYounger672
BYounger872
COlder284
DOlder484

Describe the pooled association. Across all four people, higher exercise hours tend to occur with lower resting heart rates. To verify the direction numerically, the means are \(\bar{x}=(6+8+2+4)/4=20/4=5\) hours and \(\bar{y}=(72+72+84+84)/4=312/4=78\) beats per minute.

Calculate the pooled fitted line. The sum of products of deviations is \((6-5)(72-78)+(8-5)(72-78)+(2-5)(84-78)+(4-5)(84-78)=-6-18-18-6=-48\). The sum of squared deviations in exercise hours is \((6-5)^2+(8-5)^2+(2-5)^2+(4-5)^2=1+9+9+1=20\). Therefore the slope is \(-48/20=-2.4\) beats per minute per weekly exercise hour. The intercept is \(78-(-2.4)(5)=90\), so the fitted line is \(\hat{y}=90-2.4x\).

Compare age groups. Within the younger group, the two people have 6 and 8 exercise hours, but both have a resting heart rate of 72. Within the older group, the two people have 2 and 4 exercise hours, but both have a resting heart rate of 84. In this tiny illustration, there is no change in heart rate with exercise within either age group. The pooled negative slope comes from the difference between the groups: the younger people have more exercise and lower heart rates than the older people.

State the conclusion carefully. Age is a potential confounding variable here because it is connected to both exercise hours and resting heart rate in these data. The pooled line describes an association among these four people, but it does not show that increasing exercise causes a lower resting heart rate. The example also does not establish that age is the only explanation; it simply demonstrates how a group difference can produce an overall association.

Worked Example: Study-App Use and Prior Achievement

A fictional school compares exam scores for students who chose whether to use an optional study app. The table gives group sizes and mean scores, separated by prior achievement. These invented summaries illustrate how the overall comparison can differ from comparisons within groups.

Prior achievementApp-use groupNumber of studentsMean exam score (points)
HigherUsed app4088
HigherDid not use app1090
LowerUsed app1070
LowerDid not use app4072

Compare within each achievement group. Among students with higher prior achievement, the app users’ mean is \(88-90=-2\) points compared with nonusers. Among students with lower prior achievement, it is \(70-72=-2\) points. In both groups, app users have a mean score 2 points lower in this illustration.

Calculate the overall means. There are 50 app users, so their overall mean is \((40(88)+10(70))/50=(3520+700)/50=4220/50=84.4\) points. There are also 50 nonusers, with overall mean \((10(90)+40(72))/50=(900+2880)/50=3780/50=75.6\) points. The pooled mean difference, app users minus nonusers, is \(84.4-75.6=8.8\) points.

Explain the contrast. Eighty percent of app users have higher prior achievement \((40/50=0.80)\), while only 20% of nonusers do \((10/50=0.20)\). Higher prior achievement is associated with higher exam scores in these summaries, and the two app-use groups have very different achievement compositions. Those differences help produce the positive pooled gap even though the within-group gaps are both negative.

Give a defensible conclusion. The overall comparison shows an association between app use and higher mean scores in these records, but it does not show that app use caused higher scores. Prior achievement is a potential confounding variable because it is related to app-use group and exam score. Since students chose whether to use the app, other differences between users and nonusers may also matter. The within-group comparisons are informative, but they do not establish that the app lowers scores either.

Worked Example: Evening Phone Use and Sleep

A fictional observational record compares evening phone use \(x\), in hours, with sleep \(y\), in hours, for four student-days. Two records are weekdays and two are weekend days. Day type could be related to both phone use and sleep because routines and wake-up times may differ.

RecordDay typePhone use, \(x\) (hours)Sleep, \(y\) (hours)
1Weekday17
2Weekday36
3Weekend210
4Weekend49

Find the within-group patterns. On the weekdays shown, phone use increases from 1 to 3 hours while sleep decreases from 7 to 6 hours. The change in sleep per added phone-use hour is \((6-7)/(3-1)=-1/2=-0.5\) hour. On the weekend days shown, the corresponding change is \((9-10)/(4-2)=-1/2=-0.5\) hour. Both within-group patterns are negative.

Calculate the pooled pattern. Across all four records, \(\bar{x}=(1+3+2+4)/4=2.5\) hours and \(\bar{y}=(7+6+10+9)/4=8\) hours. The sum of products of deviations is \((1-2.5)(7-8)+(3-2.5)(6-8)+(2-2.5)(10-8)+(4-2.5)(9-8)=1.5-1-1+1.5=1\). The sum of squared deviations in phone use is \((1-2.5)^2+(3-2.5)^2+(2-2.5)^2+(4-2.5)^2=2.25+0.25+0.25+2.25=5\). The pooled slope is \(1/5=0.2\) hour of predicted sleep per additional hour of phone use, a positive slope. The intercept is \(8-(0.2)(2.5)=7.5\), giving \(\hat{y}=7.5+0.2x\).

Interpret the difference. The positive pooled slope does not match either of the negative within-day-type patterns. In these invented records, weekend days have both more sleep and more phone use overall than weekdays, and that difference contributes to the pooled association. Day type is a potential confounding variable. These few records illustrate a mechanism, not a conclusion about phone use and sleep in a larger population.

What an Observational Study Can Establish

An observational regression can describe the association among the observed cases and can be useful for prediction when used appropriately. But when a potential confounder varies with the explanatory variable, the fitted line does not separate the explanatory variable’s relationship with the response from the confounder’s relationship with the response.

If researchers measured a relevant third variable, they might compare cases within its categories, as in the examples. Such comparisons can help show whether a pooled pattern is also present within groups. However, group comparisons do not automatically remove all confounding. Groups may still differ in other ways, and a variable that was not measured cannot be examined in those comparisons.

This is why an observational study’s conclusion should describe the data as an association, not claim that changing the explanatory variable would produce a particular response. As discussed in “Association Versus Causation in Regression,” random assignment in a well-designed experiment can strengthen a causal conclusion by helping make treatment groups comparable. Simply measuring more variables in an observational study is not the same as randomly assigning the explanatory variable.

1
Describe the observed association.
Name the explanatory variable, response, direction, and context of the pattern.
2
Consider group composition.
Ask whether cases with different explanatory-variable values also differ in a relevant third variable.
3
Compare pooled and within-group patterns when possible.
A difference between them can show how group composition contributes to the overall association.
4
Limit the conclusion to the design.
For observational data, report an association and acknowledge that confounding prevents a simple causal interpretation.

Common Mistakes and AP Exam Tip

  • Calling every third variable a confounder. Explain how it is related to both the explanatory variable and the response. Merely naming another variable is not enough.
  • Assuming a pooled association describes every group. Compare the overall pattern with patterns within relevant groups when the information is available.
  • Claiming confounding proves there is no real relationship. Confounding may contribute to an association, but it does not by itself show that the explanatory variable has no relationship with the response.
  • Turning a within-group comparison into a causal claim. Comparing groups separately can clarify an association, but observational data still do not establish that changing the explanatory variable causes a change in the response.
  • Treating a regression line as an explanation. The slope summarizes the fitted pattern. It does not identify which variables produced that pattern.

For full credit, describe the association in context, identify how a potential confounder is connected to both variables, and state what the observational design cannot establish. For example: “In these records, app users had a higher overall mean score, but prior achievement differed between users and nonusers and was also related to score. Because students chose whether to use the app, this observational comparison does not show that app use caused higher scores.”

Key takeaway: In an observational study, a third variable related to both the explanatory variable and the response can contribute to an overall association. Compare pooled and within-group patterns when possible, but describe the result as an association rather than proof of cause and effect.

Check Your Understanding

Use the distinction between pooled and within-group patterns to answer each question.

  1. What makes a variable a potential confounder rather than simply another variable measured in the study?
  2. In the exercise example, why does the pooled regression slope not describe a within-age-group relationship?
  3. In the study-app example, how does prior achievement relate to both app-use group and exam score?
  4. In the phone-use example, what explains why the pooled slope is positive even though both within-day-type patterns are negative?
  5. Why does comparing cases within categories of a potential confounder not, by itself, establish a causal effect?