In [ ]:
%matplotlib inline
import matchfuncs as mf
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
In [ ]:
prop_num = 9
resp_num = 4
prop_caps = [2, 2, 2, 1, 1, 1, 1, 1, 1]
resp_caps = [2, 2, 4, 4]
prop_prefs_cv = np.array([
[0, 3, 2, 1],
[0, 3, 1, 2],
[0, 3, 1, 2],
[0, 2, 3, 1],
[3, 0, 1, 2],
[0, 3, 2, 1],
[3, 2, 0, 1],
[3, 2, 0, 1],
[0, 2, 3, 1]])
resp_prefs_cv = np.array([
[0, 3, 2, 8, 7, 5, 1, 6, 4],
[0, 3, 2, 8, 7, 5, 1, 6, 4],
[0, 3, 2, 8, 7, 5, 1, 6, 4],
[0, 3, 2, 8, 7, 5, 1, 6, 4]])
prop_prefs_rd = np.array([
[3, 2, 1, 0],
[0, 1, 2, 3],
[0, 3, 1, 2],
[2, 0, 3, 1],
[2, 3, 0, 1],
[2, 0, 1, 3],
[3, 2, 0, 1],
[0, 2, 3, 1],
[2, 3, 1, 0]])
resp_prefs_rd = np.array([
[7, 4, 2, 8, 6, 3, 1, 5, 0],
[7, 4, 2, 8, 6, 3, 1, 5, 0],
[7, 4, 2, 8, 6, 3, 1, 5, 0],
[7, 4, 2, 8, 6, 3, 1, 5, 0]])
list_length = 3
In [ ]:
submit_bos_cv = np.zeros((prop_num, resp_num), dtype=int) + resp_num
submit_bos_rd = np.zeros((prop_num, resp_num), dtype=int) + resp_num
submit_da_cv = np.zeros((prop_num, resp_num), dtype=int) + resp_num
submit_da_rd = np.zeros((prop_num, resp_num), dtype=int) + resp_num
submit_daadd_cv = np.zeros((prop_num, resp_num), dtype=int) + resp_num
submit_daadd_rd = np.zeros((prop_num, resp_num), dtype=int) + resp_num
In [ ]:
data1 = pd.read_csv("data/bos_cv.csv", index_col='Player.id_in_group')
data2 = pd.read_csv("data/bos_rd.csv", index_col='Player.id_in_group')
data3 = pd.read_csv("data/da_cv.csv", index_col='Player.id_in_group')
data4 = pd.read_csv("data/da_rd.csv", index_col='Player.id_in_group')
data5 = pd.read_csv("data/daadd_cv.csv", index_col='Player.id_in_group')
data6 = pd.read_csv("data/daadd_rd.csv", index_col='Player.id_in_group')
In [ ]:
data1 = data1[data1["Subsession.round_number"] == 2]
data2 = data2[data2["Subsession.round_number"] == 2]
data3 = data3[data3["Subsession.round_number"] == 2]
data4 = data4[data4["Subsession.round_number"] == 2]
data5 = data5[data5["Subsession.round_number"] == 2]
data6 = data6[data6["Subsession.round_number"] == 2]
In [ ]:
for prop_id in range(prop_num):
for choice_num in range(resp_num):
submit_da_cv[prop_id][choice_num] = data3[u'Player.choice%s' % str(choice_num+1)][prop_id+1]
submit_da_rd[prop_id][choice_num] = data4[u'Player.choice%s' % str(choice_num+1)][prop_id+1]
for choice_num in range(list_length):
submit_bos_cv[prop_id][choice_num] = data1[u'Player.choice%s' % str(choice_num+1)][prop_id+1]
submit_bos_rd[prop_id][choice_num] = data2[u'Player.choice%s' % str(choice_num+1)][prop_id+1]
submit_daadd_cv[prop_id][choice_num] = data5[u'Player.choice%s' % str(choice_num+1)][prop_id+1]
submit_daadd_rd[prop_id][choice_num] = data6[u'Player.choice%s' % str(choice_num+1)][prop_id+1]
In [ ]:
BOS_CV = mf.Comp('BOS', submit_bos_cv, prop_prefs_cv, resp_prefs_cv, resp_caps, prop_caps, list_length)
BOS_RD = mf.Comp('BOS', submit_bos_rd, prop_prefs_rd, resp_prefs_rd, resp_caps, prop_caps, list_length)
DA_CV = mf.Comp('DA', submit_da_cv, prop_prefs_cv, resp_prefs_cv, resp_caps, prop_caps)
DA_RD = mf.Comp('DA', submit_da_rd, prop_prefs_rd, resp_prefs_rd, resp_caps, prop_caps)
DAAdd_CV = mf.Comp('DAAdd', submit_daadd_cv, prop_prefs_cv, resp_prefs_cv, resp_caps, prop_caps, list_length)
DAAdd_RD = mf.Comp('DAAdd', submit_daadd_rd, prop_prefs_rd, resp_prefs_rd, resp_caps, prop_caps, list_length)
In [ ]:
index = range(7)
titles = [
'Justified Envy',
'Truth Telling',
'Efficiency of the students',
'Efficiency of the seminars',
'None zemi',
'Vacant Quota',
'Interviews'
]
for i, title in zip(index, titles):
X1 = [1, 2, 3]
X2 = [1.4, 2.4, 3.4]
ymax = max([BOS_CV[i], BOS_RD[i], DA_CV[i], DA_RD[i], DAAdd_CV[i], DAAdd_RD[i]])
plt.bar(X1, [BOS_CV[i], DA_CV[i], DAAdd_CV[i]], color='b', label='CV', width=0.4, align="center")
plt.bar(X2, [BOS_RD[i], DA_RD[i], DAAdd_RD[i]], color='g', label='RD', width=0.4, align="center")
plt.xticks([1.2, 2.2, 3.2], ['BOS', 'DA', 'DAAdd'])
plt.axis([0.4, 4, 0, ymax+2])
plt.legend(loc=2)
plt.ylabel('Freq')
plt.title(title)
plt.show()
In [ ]: