<jupyter_start><jupyter_text>Examining Racial Discrimination in the US Job Market BackgroundRacial discrimination continues to be pervasive in cultures throughout the world. Researchers examined the level of racial discrimination in the United States labor market by randomly assigning identical résumés to black-sounding or white-sounding names and observing the impact on requests for interviews from employers. DataIn the dataset provided, each row represents a resume. The 'race' column has two values, 'b' and 'w', indicating black-sounding and white-sounding. The column 'call' has two values, 1 and 0, indicating whether the resume received a call from employers or not.Note that the 'b' and 'w' values in race are assigned randomly to the resumes when presented to the employer.  Analysis Let's look at the data, shall we?<jupyter_code>import pandas as pd
import numpy as np
from scipy import stats
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.io.stata.read_stata('data/us_job_market_discrimination.dta')
data.call.describe()
black = sum(data[data.race=='b'].call)/len(data)
white = sum(data[data.race=='w'].call)/len(data)
white_black = sum(data.call)/len(data)
b_percent = black/white_black*100
w_percent = white/white_black*100
difference = (white/white_black - black/white_black)*100
print "Percentage of black-sounding resumes ", b_percent
print "Percentage of white-sounding resumes ", w_percent
print "Difference between these two percentages ", difference<jupyter_output>Percentage of black-sounding resumes  40.0510204082
Percentage of white-sounding resumes  59.9489795918
Difference between these two percentages  19.8979591837<jupyter_text>White sounding names were more likely to be called back than black sounding names by 19.90%   Calculating the margin of errors and confidence interval<jupyter_code>z_critical = stats.norm.ppf(0.975)
p = white/white_black 
margin_of_error = np.sqrt((p*(1-p)/len(data)))*z_critical
min_CI = p - margin_of_error
max_CI = p + margin_of_error 

print "White-sounding names"
print "Mean: ", b_mean
print "Margin of error: ", margin_of_error
print "Confidence interval: ", confidence_interval

z_critical = stats.norm.ppf(0.975)
p = black/white_black
margin_of_error = np.sqrt((p*(1-p)/len(data)))*z_critical
min_CI = p - margin_of_error
max_CI = p + margin_of_error

print "Black-sounding names" 
print "Mean: ", p 
print "Margin of error: ", margin_of_error 
print "Confidence interval: ", min_CI, ',', max_CI<jupyter_output>Black-sounding names
Mean:  0.400510204082
Margin of error:  0.0137619919899
Confidence interval:  0.386748212092 , 0.414272196072
{'fraction_non_alphanumeric': 0.08406238113351085, 'fraction_numerical': 0.043362495245340436, 'mean_word_length': 5.743589743589744, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '54346', 'license': 'MIT', 'n_tokens_mistral': 896, 'n_tokens_neox': 807, 'n_words': 278, 'path': 'racial_disc/sliderule_dsi_inferential_statistics_exercise_2.ipynb', 'repo_name': 'sdf94/Springboard', 'size': '2629'}