9.1 The education minister

Download notebook Interact

Imagine for a moment that you are the minister of education in Cuba.

It is 2019. The final school exams have just finished, but the results are not out yet. Of course you do have the results from 2018.

You are particularly interested in this year’s results in Havana, because of recent problems that you have had with loss of teachers due to emigration.

In order to plan for the year ahead, you need to know if the mathematics results are holding steady. But the marking will take time, you won’t get the full results for 2019 for another month.

To help your decision-making, you very much want to get an idea of how good the results are this year. Being wise, you decided to take a random sample of 50 from all the exam papers from Havana this year (2019). You get them marked quickly. But - how much information will this sample give you about the eventual results for 2019?

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('fivethirtyeight')

Here are the actual school-leaver mathematics examination results from 2018.

You can download the file from havana_math_2018.csv.

havana_2018 = pd.read_csv('havana_math_2018.csv')
havana_2018.head()
school school_type id name mark
0 2300-VLADIMIR I. LENIN Institutos Preuniversitarios 92066898 ABREU ALBA DANIELA 99.0
1 2300-VLADIMIR I. LENIN Institutos Preuniversitarios 51166516 ACEN RAVELO THALIA 98.0
2 2300-VLADIMIR I. LENIN Institutos Preuniversitarios 121568242 ACOSTA MERIÑO YORDAN CESAR 85.0
3 2300-VLADIMIR I. LENIN Institutos Preuniversitarios 51975208 AGUADO VALDEZ IRAN DE JESUS 98.0
4 2300-VLADIMIR I. LENIN Institutos Preuniversitarios 122867542 AGUILAR CESPEDES DANILO 100.0

There are about 8000 marks in this table:

len(havana_2018)
7995

Here is the histogram, split into 100 bins to show more detail of the distribution — the default is 10 bins (question — how would you check this?).

havana_2018.hist('mark', bins=100);

png

Notice this is much unlike a normal distribution, In particular, you can see that the marks near 50% - appear to have been pushed upwards to 60%. Maybe the markers are being generous to students close to the pass mark.

Here are the various statistics for the 2018 marks:

havana_2018['mark'].describe()
count    7306.000000
mean       65.256091
std        26.697986
min         0.000000
25%        45.000000
50%        69.000000
75%        90.000000
max       100.000000
Name: mark, dtype: float64

We are particularly interested in the mean.

# Mean mark in 2018.
math_med_2018 = havana_2018['mark'].mean()
math_med_2018
65.25609088420477

Now we look at the sample of 50 exams from 2019 that you marked quickly.

You can download the sample file from havana_math_2019_sample.csv.

havana_2019_sample = pd.read_csv('havana_math_2019_sample.csv')
havana_2019_sample.head()
school school_type id name mark
0 2327-PRESENCIA DE CELIA Institutos Preuniversitarios 1101168160 RAMIREZ SANCHEZ NEYDER 89.0
1 2305-JOSE MIGUEL PEREZ Institutos Preuniversitarios 1101066782 LEIVA RAMOS SAMUEL ALEJANDRO 84.0
2 2313-VILMA ESPIN Institutos Preuniversitarios 1101167635 NODARSE CASTRO JENNIFER 25.0
3 2324-MANOLITO AGUIAR Institutos Preuniversitarios 1033165197 SCULL ORTIZ JESSICA 30.0
4 2306-TOMAS DAVID ROYO Institutos Preuniversitarios 1102668498 HERRERA GARCIA REGINA TERESA 97.0
len(havana_2019_sample)
50
havana_2019_sample['mark'].describe()
count    45.000000
mean     54.511111
std      24.015736
min       4.000000
25%      30.000000
50%      60.000000
75%      72.000000
max      97.000000
Name: mark, dtype: float64
# Mean mark in 2019 sample.
math_med_2019_samp = havana_2019_sample['mark'].mean()
math_med_2019_samp
54.51111111111111

The mean here is about 54.51. That seems a bit lower than the 2018 mean — but have I been deceived by the sample? Was I just unlucky? How confident can I be that the mean from the full results will in fact be near 54.51, rather than the 65.25 or so of the previous year?

We now enter the territory of confidence intervals.

My question is: how close is my sample mean of 54.51 likely to be to the eventual mean, once I have all 8000 or so results for 2019? How confident can I be in this sample mean of around 54.51?