In [1]:
%matplotlib inline
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style='ticks', context='poster', font_scale=1.5)
In [2]:
data = pd.read_csv('/Users/annakhazenzon/Documents/teaching/psych45/Psych45/WWW/demo_files/Psych45_stroop_stats_2017.csv')
data.drop('when', axis=1, inplace=True)
data.time_normal = data.time_normal.str.strip(' ms').str.replace(',', '').astype(float)
data.time_interfere = data.time_interfere.str.strip(' ms').str.replace(',', '').astype(float)
data['time_diff'] = data.time_interfere - data.time_normal
In [3]:
max_rt = data.time_interfere.mean() + 2*data.time_interfere.std()
data = data.loc[data.time_interfere < max_rt]
In [4]:
data.head()
Out[4]:
In [5]:
data.describe()
Out[5]:
In [6]:
g = sns.distplot(data.pct_correct, rug=True,
color='dodgerblue')
g.set_xlabel('% correct')
sns.despine(trim=True)
In [7]:
data_long = pd.melt(data, ['pct_correct'])
data_long = data_long.loc[data_long.variable.isin(['time_normal', 'time_interfere'])]
data_long.loc[data_long.variable == 'time_normal', 'variable'] = 'congruent'
data_long.loc[data_long.variable == 'time_interfere', 'variable'] = 'incongruent'
In [8]:
g = sns.factorplot(x='variable', y='value',
aspect=1.5, ci=95,
data=data_long, palette='Set2')
g.set_ylabels('RT (ms)')
g.set_xlabels('condition')
plt.locator_params(nbins=5)
How much longer does it take to respond to an incongruent vs. a congruent trial?
In [9]:
g = sns.distplot(data.time_diff, rug=True,
color='mediumpurple', vertical=True)
g.set_ylabel('RT for incongruent > congruent trials (ms)')
g.hlines(0, 0, .003, linestyles='dashed')
sns.despine(trim=True)
In [ ]:
In [ ]: