AP CSP Big Idea 2 Data Collection

AP CSP Topics › Data Collection & Sampling

AP CSP Data Collection, Sampling & Bias: Complete Guide (2025‑2026)

Data is only useful if it accurately represents the population you are studying. Sampling bias occurs when the group you collect data from is not representative of the broader population — making your conclusions wrong even if your analysis is perfect. AP CSP tests the causes of sampling bias, how to recognize it in scenarios, and the difference between correlation and causation. Biased data produces biased conclusions regardless of how sophisticated the analysis is.

1936Year Literary Digest poll predicted wrong U.S. election winner due to sampling bias (10M surveys sent)
r=1.0Correlation between Nicolas Cage films released/year and pool drownings — correlation is not causation
3Questions to ask about any dataset: Who collected it? How? Who was excluded?

Representative vs. Biased Sampling

Biased vs. Representative Sampling Biased Sample Survey sent only to email list subscribers 👨‍💻👨‍💻👨‍💻 Everyone surveyed is tech-savvy Excludes: elderly, low-income, non-English speakers Conclusion: does NOT represent population Representative Sample Random selection across all demographics 👨🏻👩🏽👴👱 Diverse ages, backgrounds, locations Proportional to actual population distribution Conclusion: findings generalize to population

A biased sample produces conclusions that cannot be generalized to the full population. The Literary Digest poll surveyed car and phone owners — wealthier demographics — and predicted the wrong winner.

Scenario — Identify the Bias

A social media company surveys users about their satisfaction with the platform by posting the survey in the app. 85% of respondents report being satisfied. The company claims ‘85% of users are satisfied.’

What sampling bias is present? Who is underrepresented?

Answer

Self-selection and availability bias. Only users who are actively engaged with the app see and respond to the survey. Users who are dissatisfied and have reduced or stopped using the app are systematically underrepresented — the most unhappy users left and therefore cannot be surveyed. The 85% satisfaction figure describes engaged users, not all users. The company’s generalization from the sample to all users is invalid.

Correlation vs. Causation

Correlation
Two variables change together
  • Ice cream sales and drownings both rise in summer
  • Nicolas Cage films and pool drownings correlate over years
  • Shoe size and reading level correlate in children
  • City size and crime count correlate globally
  • Pattern exists but no causal link
Causation
One variable directly causes the other
  • Smoking causes increased lung cancer risk
  • Exercise causes improved cardiovascular health
  • Lack of sleep causes reduced cognitive performance
  • Causation requires controlled experiments
  • Correlation alone is never sufficient to establish causation
Scenario — Correlation or Causation?

A study finds that cities with more coffee shops per capita have higher average incomes. A coffee chain uses this data to argue: ‘Opening more coffee shops in low-income areas will raise incomes there.’

What is the logical error? What likely explains the correlation?

Answer

Confusing correlation with causation. The correlation likely has a confounding variable: wealthy cities with higher incomes attract more coffee shops (because people can afford them) AND have higher incomes. Coffee shop density does not cause higher incomes — both are caused by a third variable (economic activity / wealth). Opening coffee shops in low-income areas will not raise incomes because the causal arrow points in the opposite direction from what the chain claims.

Data Collection Methods

Structured Data Collection
Controlled, comparable results
  • Surveys with fixed response options
  • Sensor readings at regular intervals
  • Transaction logs from a system
  • Lab measurements with standard protocols
  • Easy to analyze: consistent format
Unstructured Data Collection
Flexible, richer but harder to analyze
  • Open-ended survey responses
  • Social media posts and comments
  • Images, audio, video
  • Email and document text
  • Requires processing before analysis
Scenario — Evaluate the Study Design

A school wants to know if students prefer in-person or online learning. They email a survey to all students and receive 340 responses out of 1,200 students enrolled. 78% of respondents prefer in-person learning. The principal announces: ‘Our students overwhelmingly prefer in-person learning.’

What sampling concerns limit this conclusion?

Answer

Two concerns: (1) Non-response bias — only 28% responded. Students who feel strongly (in either direction) are more likely to respond; those with moderate opinions may have ignored the survey. (2) Mode of collection — email requires digital access and engagement. Students with less reliable tech access are less likely to see and respond. The 78% figure describes willing email respondents, not all students. The principal’s generalization is overconfident.

Common Exam Pitfalls

1
Concluding causation from correlation

This is the most common Big Idea 2 error. Even strong correlations (r close to 1.0) do not establish causation. Always ask: is there a confounding variable? Does the causal arrow point in the assumed direction?

2
Thinking a large sample size eliminates bias

The Literary Digest sent 10 million surveys and received 2.4 million responses — and predicted the wrong winner. Sample size does not fix sampling method. A biased sampling method applied at massive scale produces massively biased results.

3
Missing self-selection as a bias source

Voluntary surveys attract people who feel strongly about the topic. Passive data collection (transaction logs, sensor data) is often more representative than opt-in surveys.

4
Assuming publicly available data is representative

Data available for analysis was collected for some purpose and reflects that collection method’s biases. Wikipedia is written by people who edit Wikipedia. Twitter data reflects Twitter users. Always ask who produced the data and who is excluded.

Check for Understanding

1. A researcher surveys gym members about their exercise habits and finds they exercise 5 days per week on average. She concludes the average American exercises 5 days per week. What is wrong with this conclusion?

  • The sample size is too small to draw any conclusion.
  • The sample is biased: gym members are not representative of the general population’s exercise habits.
  • The researcher should have used a 10-day week for the survey.
  • Exercise frequency cannot be measured through surveys.
Gym members are a biased sample: people who joined a gym self-selected as people interested in exercise. They are not representative of the general population. This is availability/convenience sampling bias.

2. A study finds a strong positive correlation between students’ shoe sizes and their reading test scores. The most likely explanation is:

  • Larger feet indicate faster brain development, improving reading.
  • Reading practice strengthens the same neural pathways that control foot growth.
  • Both shoe size and reading score increase with age, making age the confounding variable.
  • The study was conducted at a school that selects students based on foot size.
Age is the confounding variable: older children have both larger feet and higher reading scores. Neither causes the other; both are caused by the same third variable (age/development).

3. Consider statements about sampling:
I. A biased sampling method applied to a larger sample will still produce biased results.
II. Random sampling helps ensure the sample is representative of the broader population.
III. Online surveys always produce unbiased data because anyone can respond.

Which are correct?

  • I only
  • I and II only
  • II and III only
  • I, II, and III
Statement I is correct — bias comes from method, not size. Statement II is correct — random selection reduces systematic exclusion. Statement III is false — online surveys exclude people without internet access, tech literacy, or time to respond, creating selection bias.

4. A data analyst finds that cities with more hospitals have higher death rates. She concludes hospitals cause deaths. What concept explains why this conclusion is wrong?

  • Sampling bias, because rural areas were excluded.
  • Correlation does not imply causation — sick people go to cities with hospitals, not the reverse.
  • The data was collected incorrectly using structured instead of unstructured methods.
  • The hospital count was measured in different units across cities.
The causal arrow points in the opposite direction: sick people travel to cities with hospitals, driving up both hospital counts and death rates. A confounding variable (sick population) explains both. Hospitals do not cause deaths.

5. A company surveys customers who called their help line to measure product satisfaction. The survey finds 60% are satisfied. Which limitation is most significant?

  • Phone surveys have lower response rates than email surveys.
  • Satisfied customers rarely call help lines, so the sample is biased toward dissatisfied users.
  • The 40% dissatisfied customers should have been excluded from the analysis.
  • 60% satisfaction is always below industry standards and indicates a problem.
Help-line callers self-selected because they had a problem. Satisfied customers rarely call support. The sample is biased toward the most dissatisfied users, making 60% satisfaction among help-line callers dramatically better than the overall satisfaction rate among all customers.

6. A researcher collects data showing ice cream sales and drowning incidents both peak in July. The best conclusion is:

  • Ice cream consumption causes drowning by impairing swimming ability.
  • Drowning causes increased ice cream consumption as a stress response.
  • Both variables are correlated because both increase in summer heat, not because one causes the other.
  • The correlation proves that beach concession stands should not sell ice cream.
Both ice cream sales and drowning increase in summer because of hot weather (confounding variable) driving both beach attendance and ice cream purchases. Neither causes the other.

Frequently Asked Questions

What makes a sample truly representative?
A representative sample reflects the distribution of relevant characteristics in the full population. For a national opinion survey, this means including proportional representation by age, income, geography, and other relevant demographics. Random selection from the full population is the gold standard.
How do you distinguish correlation from causation?
Correlation = the two variables move together. Causation requires: a plausible mechanism, the cause precedes the effect, the relationship holds when confounding variables are controlled for, and ideally a controlled experiment. On the AP exam, if a scenario presents a correlation and asks for the correct conclusion, the answer is almost always that correlation was established but causation was not.
What is a confounding variable?
A confounding variable is a third variable that causes both of the variables you are observing to change together, creating a spurious correlation. Age confounds shoe size and reading scores. Hot weather confounds ice cream sales and drowning. Identifying confounding variables is the key skill tested in AP CSP correlation questions.

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]