<jupyter_start><jupyter_text>Majority size ignoring the actual decision<jupyter_code>sns.set_style("whitegrid")

df_male = df_sel[df_sel['question.majLabel'] == 'male'].copy()
df_male['group size'] = df['question.majSize']
df_male['group'] = 'male personas'
df_female = df_sel[df_sel['question.majLabel'] == 'female'].copy()
df_female['group size'] = df['question.majSize']
df_female['group'] = 'female personas'

cyan = sns.color_palette()[9]
red = sns.color_palette()[3]

fig,ax = plt.subplots(figsize=(5,5))
g = sns.pointplot(data=pd.concat([df_male, df_female]), ax=ax, hue='group', dodge=.1, ci=90,
                  x='group size', y='rating', join=False, palette=[red, cyan], markers=['x','o'],
                  hue_order=['female personas', 'male personas'])
ax.set(xlim=(-0.5, 4.5), ylim=(0,1))
ax.legend(loc=4, title='majority')
g.set_title('User ratings by majority size')
sns.despine(left=True)
df_results = pd.DataFrame(columns=['group size','T','p-val'])
for i in [5, 6, 7, 8, 9]:
    results_ttest = pg.ttest(df_male[df_male['group size'] == i].rating,
                             df_female[df_female['group size'] == i].rating)
    new_row = {'group size': i, 'T': results_ttest['T']['T-test'], 'p-val': results_ttest['p-val']['T-test']}
    df_results = df_results.append(new_row, ignore_index=True)
df_results.set_index('group size')
pg.ttest(pd.concat([df_male[df_male['group size'] == 5], df_female[df_female['group size'] == 5]]).rating,
         pd.concat([df_male[df_male['group size'] == 9], df_female[df_female['group size'] == 9]]).rating)<jupyter_output><empty_output><jupyter_text>Generally, scenarios with a heavily skewed applicant population get rated better than those with an populationthat more closely resembles society (significant).Also, scenarios in which there are 9 times more female personas than male personas get rated better than vice versa(not significant).  Majority size and majority-minority parity<jupyter_code>df_0 = df_sel[df_sel['question.cv'] < 0.666].copy()
df_0['cv'] = '(0, 0.66]'
df_1 = df_sel[(df_sel['question.cv'] >= 0.666) & (df_sel['question.cv'] < 1.333)].copy()
df_1['cv'] = '(0.66, 1.33]'
df_2 = df_sel[df_sel['question.cv'] >= 1.333].copy()
df_2['cv'] = '(1.33, 2)'

fig,ax = plt.subplots(figsize=(5,5))
g = sns.pointplot(data=pd.concat([df_0, df_1, df_2]), ax=ax, hue='cv', dodge=.1, ci=90,
                  x='question.majSize', y='rating', join=False)
ax.set(xlim=(-0.5, 4.5), ylim=(0,1))
g.set_title('User ratings by majority size')
g.set(xlabel = 'majority size')
ax.legend(loc=4, title='maj-min parity')
sns.despine(left=True)
df_results = pd.DataFrame(columns=['group size','T','p-val'])
for i in [5, 6, 7, 8, 9]:
    results_ttest = pg.ttest(df_1[df_1['question.majSize'] == i].rating,
                             df_2[df_2['question.majSize'] == i].rating)
    new_row = {'group size': i, 'T': results_ttest['T']['T-test'], 'p-val': results_ttest['p-val']['T-test']}
    df_results = df_results.append(new_row, ignore_index=True)
df_results.set_index('group size')
df_results = pd.DataFrame(columns=['group size','T','p-val'])
for i in [5, 6, 7, 8, 9]:
    results_ttest = pg.ttest(df_0[df_0['question.majSize'] == i].rating,
                             df_2[df_2['question.majSize'] == i].rating)
    new_row = {'group size': i, 'T': results_ttest['T']['T-test'], 'p-val': results_ttest['p-val']['T-test']}
    df_results = df_results.append(new_row, ignore_index=True)
df_results.set_index('group size')<jupyter_output><empty_output><jupyter_text>Across all majority sizes, scenarios with selections that either benefit minority or majority(parity = 1.33) get rated worse than selections according to majority-minority distributionin the applicant population (significant).Only for medium majority sizes (6 and 7), it is considered better to benefit the minority unproportional to their representation (significant).  Group size and gender parity<jupyter_code>df_sel['female size'] = df_sel['question.minSize']
df_sel.loc[df_sel['question.majLabel'] == 'female', 'female size'] = df_sel['question.majSize']
df_0 = df_sel[df_sel['question.gender_cv'] < 0.666].copy()
df_0['cv'] = '(0, 0.66]'
df_1 = df_sel[(df_sel['question.gender_cv'] >= 0.666) & (df_sel['question.cv'] < 1.333)].copy()
df_1['cv'] = '(0.66, 1.33]'
df_2 = df_sel[df_sel['question.gender_cv'] >= 1.333].copy()
df_2['cv'] = '(1.33, 2)'
data = pd.concat([df_0, df_1, df_2]).reset_index(drop=True)

fig,ax = plt.subplots(figsize=(10,5))
g = sns.pointplot(data=data, ax=ax, hue='cv', dodge=.1, ci=90,
                  x='female size', y='rating', join=False)
ax.set(xlim=(-0.5, 8.5), ylim=(0,1))
g.set_title('User ratings by female group size and gender parity')
g.set(xlabel = 'female personas group size')
ax.legend(loc=4, title='gender parity')
sns.despine(left=True)
df_results = pd.DataFrame(columns=['group size','T','p-val'])
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    results_ttest = pg.ttest(df_1[df_1['female size'] == i].rating,
                             df_2[df_2['female size'] == i].rating)
    new_row = {'group size': i, 'T': results_ttest['T']['T-test'], 'p-val': results_ttest['p-val']['T-test']}
    df_results = df_results.append(new_row, ignore_index=True)
df_results.set_index('group size')
df_results = pd.DataFrame(columns=['group size','T','p-val'])
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    results_ttest = pg.ttest(df_0[df_0['female size'] == i].rating,
                             df_2[df_2['female size'] == i].rating)
    new_row = {'group size': i, 'T': results_ttest['T']['T-test'], 'p-val': results_ttest['p-val']['T-test']}
    df_results = df_results.append(new_row, ignore_index=True)
df_results.set_index('group size')<jupyter_output><empty_output><jupyter_text>For female majorities (female group size > 5), users rate selections with even and uneven gender parity more similar than for female minorities (still significant, except for female group size = 9).Only for medium female minorities (female group size in {2, 3, 4}) and a strong female majority (female group size = 9), users significantly rate selections that benefit female personas better than selections that benefit male personas.The minimal rating for selections that benefit male personas is found at a slight female minority (female group size = 4). In contrast, the minimal rating for selections that benefit female personas as well as for selections with even gender parity is found at a medium female minority (female group size = 7).**-> no particular protection for very small groups?!**  Group size by participant gender  Selections that benefit female personas<jupyter_code>df_male = df_sel[(df_sel['user.gender'] == 'male') & (df_sel['question.gender_cv'] >= 1.33)].copy()
df_male['participant gender'] = 'male'
df_female = df_sel[(df_sel['user.gender'] == 'female') & (df_sel['question.gender_cv'] >= 1.33)].copy()
df_female['participant gender'] = 'female'
data = pd.concat([df_male, df_female]).reset_index(drop=True)

fig,ax = plt.subplots(figsize=(10,5))
g = sns.pointplot(data=data, ax=ax, hue='participant gender', dodge=.1, ci=90,
                  x='female size', y='rating', join=False)
ax.set(xlim=(-0.5, 8.5), ylim=(0,1))
g.set_title('Selection that benefit women by female group size and participant gender')
g.set(xlabel = 'female personas group size')
ax.legend(loc=4, title='participant gender')
sns.despine(left=True)

df_results = pd.DataFrame(columns=['group size','T','p-val'])
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    results_ttest = pg.ttest(df_male[df_male['female size'] == i].rating,
                             df_female[df_female['female size'] == i].rating)
    new_row = {'group size': i, 'T': results_ttest['T']['T-test'], 'p-val': results_ttest['p-val']['T-test']}
    df_results = df_results.append(new_row, ignore_index=True)
df_results.set_index('group size')<jupyter_output><empty_output><jupyter_text>Female participants give a bonus to selections that benefit women over male participants, when the female group size is very small (female group size = 1) as well as for selections in scenarios with slightly more women / men (female group size in {4, 6}). Hence female users protect very small female groups. All this is however insignificant.  Selection that benefit male personas<jupyter_code>df_male = df_sel[(df_sel['user.gender'] == 'male') & (df_sel['question.gender_cv'] < 0.66)].copy()
df_male['participant gender'] = 'male'
df_female = df_sel[(df_sel['user.gender'] == 'female') & (df_sel['question.gender_cv'] < 0.66)].copy()
df_female['participant gender'] = 'female'
data = pd.concat([df_male, df_female]).reset_index(drop=True)

fig,ax = plt.subplots(figsize=(10,5))
g = sns.pointplot(data=data, ax=ax, hue='participant gender', dodge=.1, ci=90,
                  x='female size', y='rating', join=False)
ax.set(xlim=(-0.5, 8.5), ylim=(0,1))
g.set_title('Selection that benefit men by female group size and participant gender')
g.set(xlabel = 'female personas group size')
ax.legend(loc=4, title='participant gender')
sns.despine(left=True)

df_results = pd.DataFrame(columns=['group size','T','p-val'])
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
    results_ttest = pg.ttest(df_male[df_male['female size'] == i].rating,
                             df_female[df_female['female size'] == i].rating)
    new_row = {'group size': i, 'T': results_ttest['T']['T-test'], 'p-val': results_ttest['p-val']['T-test']}
    df_results = df_results.append(new_row, ignore_index=True)
df_results.set_index('group size')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17579884756416972, 'fraction_numerical': 0.025458355159769512, 'mean_word_length': 5.060952380952381, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '456636', 'license': 'MIT', 'n_tokens_mistral': 3605, 'n_tokens_neox': 3315, 'n_words': 806, 'path': 'perception analysis/group sizes.ipynb', 'repo_name': 'cssh-rwth/fairceptron-notebooks', 'size': '9545'}