…
…
Compare the midterm scores of two sections with the mean, median, standard deviation, histogram, box plot, z-score and percentile, and show why a single average is not enough to answer "which section did better".
You are a student assistant to a department head at a university. Two sections of the same course took the same midterm exam on the same day, and the department head puts the results in front of you and asks: "Which section did better?" Most people would look at the two averages and answer. In this project you will do that first too, and then look at the distribution of the scores to find out what that first answer shows and what it hides.
Data: midterm_grades.csv (fictional sample data), one row for each student; Section A has 42 students and Section B has 40. Students appear by code, not by name.
| Column | Description |
|---|---|
student | Student code (like A-01, B-29) |
section | Section: A or B |
midterm | Midterm score (between 0 and 100, in points) |
Lessons used: reading CSV files, filtering and grouping (4–7), histogram (11), mean and median (12), standard deviation (14), percentiles, quartiles, IQR and box plot (15), skewness and z-score (16), charts with a legend (17).
The cells share one session: each step works with df, a, b and the other variables defined by the step before it.
What you'll do
Required topics
midterm_grades.csvDownload file
Reading file…
Code cells are for members
You can read the steps. Sign up free to run the code, complete the steps and save your progress.
Code cells are for members
You can read the steps. Sign up free to run the code, complete the steps and save your progress.
Make a prediction before you look at the chart:
Section A's average is about 4 points higher than Section B's. What do you expect to see in the histogram?
Then check the shape with a number: work out the skewness of each section (lesson 16). Finally, write in the variable left_tail which section has a long tail to the left, toward low scores.
This step's code cell is for members.Sign up free
You will take one summary table to the department head: the mean, median and standard deviation for each section (lessons 12 and 14). Once you build the table, look at two things:
Finally, write how many times larger A's standard deviation is than B's in the variable ratio.
This step's code cell is for members.Sign up free
The standard deviation is sensitive to extreme values; ask for a spread measure that is based on order as well. Work out each section's interquartile range (IQR = Q3 − Q1) and draw the two sections side by side in the same box plot (lesson 15).
Remember that the line inside the box is the median, not the mean. The height of the box shows how spread out the middle half is: where is the bottom edge of A's box, and where are all of B's scores?
This step's code cell is for members.Sign up free
In the department, a student who scores below 50 on the midterm gets a warning letter. For the department head this is a more concrete question than the average: how many students in each section are below the cutoff, and what share passed?
For each section, work out the number of students below the cutoff and the share who scored 50 or more. Did the averages in step 1 answer this question?
This step's code cell is for members.Sign up free
The department head is thinking of giving awards to two students: A-14 (midterm 88) from Section A and B-29 (midterm 75) from Section B. It is easy to say "88 is bigger than 75, so A-14 did better." But each student took the same exam as the classmates in their own section, so placing the score within the student's own section is a fairer comparison.
Work out two measures for each student:
Then write in the variable more_unusual the code of the student whose score is more unusual within their own section.
This step's code cell is for members.Sign up free
Now you can go back to the question from step 1. Here are your findings:
| Section A | Section B | |
|---|---|---|
| Mean | 69.0 | 64.6 |
| Median | 78.0 | 64.5 |
| Standard deviation | 20.9 | 5.1 |
| IQR | 32.5 | 7.25 |
| Below the cutoff | 11 students (26%) | 0 students |
1. What answer do you give the department head? Write its letter in the variable verdict.
2. Which statement does this data support? Write its letter in the variable supports.
This step's code cell is for members.Sign up free