In-Class Notebook, Mar 2, 2020

In [1]:
import pandas as pd
In [2]:
df = pd.read_csv("classdata/simulated_housing_test.csv")
In [3]:
from scipy.stats import binom_test
In [4]:
import numpy as np
In [5]:
overall_application_offer_proportion = 0.625
black_applicants_offered = 9
total_applicants_offered = 40
In [6]:
p=binom_test(black_applicants_offered, total_applicants_offered, overall_application_offer_proportion)
print(p)
4.6803413471549323e-07
In [10]:
from scipy.stats import ttest_ind
print(ttest_ind(df[df.race=="black"].rent, df[df.race=="white"].rent)[1])
1.26829227017898e-10

(For tomorrow: chi-square and sample sizes.)

links