Extracting Information from Data
Your fitness tracker logs thousands of numbers every week: steps, heartbeats, minutes asleep. Alone, those numbers are just a pile. Then an app tells you, "You sleep better on days you walk more than 8,000 steps." Is that true? Can you trust it? In this page you will learn how computers turn raw data into information, and how to tell good conclusions from shaky ones.
Data, Metadata, and Information
Data are the raw values a computer stores. Information is the meaning we get when we find patterns in data. A list of 10,000 temperatures is data. "July is the hottest month in Phoenix" is information.
When you take a photo with your smartphone, the picture is the data. The phone also saves metadata with it:
Metadata can be useful. You can sort photos by date, search a map for where a picture was taken, or find all songs by one artist. But metadata can also reveal private details. Someone who gets a photo with GPS metadata could learn where you live or hang out. That is why many apps strip location data before you post.
Define metadata. Give three examples of metadata that might be stored with a photo taken on a smartphone, and explain one way someone could use this metadata.
Define metadata. Give three examples of metadata that might be stored with a photo taken on a smartphone, and explain one way someone could use this metadata.
Finding Patterns: Correlation and Causation
Computers are great at spotting patterns in huge datasets. One common pattern is correlation: two variables tend to change together.
-
Positive correlation: when one goes up, the other tends to go up.
-
Negative correlation: when one goes up, the other tends to go down.
-
No correlation: no clear relationship.
Look at Jayden's data: more hours studied, higher quiz score.
The points climb almost along a straight line, so this is a strong positive correlation. A pattern like this lets us make a prediction. The scores go up about 5.75 points per hour, so 6 hours might give about 91 (85 + 5.75 ≈ 90.75). But predictions outside the data you collected (here, beyond 5 hours) are risky. Scores can't go past 100, and extra hours might help less and less.
To say something causes something else, you usually need a carefully designed experiment, not just a pattern.
In the summer, ice cream sales and the number of sunburns both rise. Does this mean that eating ice cream causes sunburns? Explain the difference between correlation and…
In the summer, ice cream sales and the number of sunburns both rise. Does this mean that eating ice cream causes sunburns? Explain the difference between correlation and causation, and name a variable that could explain both trends.
Jayden recorded how many hours he studied and his quiz score for five quizzes: | Hours studied | 1 | 2 | 3 | 4 | 5 | |---|---|---|---|---|---| | Quiz score | 62 | 68 |…
Jayden recorded how many hours he studied and his quiz score for five quizzes:
| Hours studied | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Quiz score | 62 | 68 | 74 | 79 | 85 |
- a) Describe the correlation (positive, negative, or none) and how strong it looks.
- b) Use the pattern to estimate the score for 6 hours of studying. What makes this estimate risky?
- c) Do these data prove that studying more causes higher scores? Explain.
Filtering and Combining Data
Programs often pull out only the rows they need. Filtering keeps the rows that meet a condition. Grouping puts rows into categories so you can count or average them.
Here is a filtering example like the bus-rider data in the practice exercises, but with a different group:
| Student | Plays a sport | Hours of sleep |
|---|---|---|
| Aaliyah | Yes | 8 |
| Marcus | No | 6 |
| Chloe | Yes | 7 |
| Ethan | Yes | 5 |
| Priya | No | 9 |
A school collected this data: | Student | Rides the bus | GPA | |---|---|---| | Ava | Yes | 3.4 | | Noah | No | 2.8 | | Mia | Yes | 3.1 | | Ethan | Yes | 2.7 | | Zoe |…
A school collected this data:
| Student | Rides the bus | GPA |
|---|---|---|
| Ava | Yes | 3.4 |
| Noah | No | 2.8 |
| Mia | Yes | 3.1 |
| Ethan | Yes | 2.7 |
| Zoe | No | 3.6 |
| Mateo | Yes | 3.5 |
- a) How many students ride the bus and have a GPA above 3.0?
- b) What percent of the bus riders have a GPA above 3.0?
Data Quality and Bias
Any conclusion is only as good as the data behind it. Two main things can go wrong.
Dirty data
Real datasets are messy. Before a program analyzes data, you clean it. Common problems:
-
Inconsistent formats: "TX", "Texas", and "tx" all mean the same state, but a program sees three different values.
-
Missing values: blank cells.
-
Duplicates: the same person listed twice, which inflates counts.
-
Wrong values: an age of 250, or text where a number belongs.
A program that counts rows equal to exactly "TX" would miss "Texas" and "tx" and give a count that is too low. Cleaning means standardizing ("Texas" and "tx" become "TX"), removing duplicates, and deciding how to handle blanks (follow up, or leave them out and say so).
Biased data
Data is biased when it doesn't fairly represent the group you care about. Two common causes:
-
Sampling bias: the people you collected from are not typical. A survey sent only to AP students doesn't speak for the whole school.
-
Non-response bias: people who reply differ from those who don't. If only 40% reply, the other 60% are missing, and they may feel differently.
A better approach is a random sample: choose students by chance from the full school list, and follow up to raise the response rate.
The student council wants to know whether students like the cafeteria food. It sends an email survey only to students enrolled in AP courses, and 40% of those students…
The student council wants to know whether students like the cafeteria food. It sends an email survey only to students enrolled in AP courses, and 40% of those students reply.
- a) Identify two sources of bias in this data collection.
- b) Explain how the conclusions might differ from the opinions of the whole school.
- c) Suggest one way to collect better data.
A club collected the following sign-up data and wants to count how many different students signed up from Texas. | Row | Name | State | |---|---|---| | 1 | Emma | TX | |…
A club collected the following sign-up data and wants to count how many different students signed up from Texas.
| Row | Name | State |
|---|---|---|
| 1 | Emma | TX |
| 2 | Liam | Texas |
| 3 | Sofia | (blank) |
| 4 | Liam | Texas |
| 5 | Jayden | tx |
- a) Identify at least three problems with the data.
- b) How would a program that counts rows with State equal to "TX" differ from the correct count? What would you do to clean the data first?
Using Programs with Large Datasets
Some datasets are far too big to read by hand: millions of rows of trips, posts, or purchases. Programs make it possible to:
-
Clean thousands of rows automatically.
-
Filter and group to answer a question (for example, trips per hour).
-
Visualize the results with charts and graphs so patterns are easier to see.
A program that works on 100 rows should also work on 100 million. We call this scalability: the ability to keep working as the data grows. Large datasets can reveal patterns that small ones can't, but they also raise concerns about privacy (who has your data?) and about whether the data is representative. A giant dataset can still be biased.
A bike-share company in Denver recorded the number of trips on one Tuesday in October: | Time of day | Trips | |---|---| | 7-9 AM | 1,200 | | 12-2 PM | 400 | | 5-7 PM |…
A bike-share company in Denver recorded the number of trips on one Tuesday in October:
| Time of day | Trips |
|---|---|
| 7-9 AM | 1,200 |
| 12-2 PM | 400 |
| 5-7 PM | 1,500 |
| 9-11 PM | 200 |
- a) What percent of these trips happened during the commute periods (7-9 AM and 5-7 PM)? Round to the nearest tenth of a percent.
- b) The city wants to use this dataset to decide where to add more bikes. Describe at least three limitations of the data.
- c) Describe what additional data you would collect to make a better decision, and explain how it would reduce bias or error.
A company says that students who use its study app more than 5 hours per week have an average GPA of 3.4, while the average GPA of non-users is 2.9. The company surveyed…
A company says that students who use its study app more than 5 hours per week have an average GPA of 3.4, while the average GPA of non-users is 2.9. The company surveyed 200 users and 800 non-users.
- a) The company claims, "Our app raises your GPA." Evaluate this claim. Include at least two possible confounding variables.
- b) Explain how the way the students were chosen might bias the result.
- c) Design a better study that could provide stronger evidence about whether the app helps. Say what you would measure and how you would assign students to groups.
Back to the start: the app's claim about walking and sleep is a correlation. To trust it, check how the data were collected, whether it is a fair sample, and whether something else could explain both.