Circles Metacog Analysis

Imports


In [ ]:
%matplotlib inline
from __future__ import unicode_literals
import pandas as pd
import numpy as np
from glob import glob
from matplotlib import pyplot as plt
import seaborn as sns
from metacog_utils import add_sdt_utils, metacog_dfs, jointplot_group
from IPython.display import display

Load Data

The metacog_dfs function creates 4 dataframes with metacognitive information


In [ ]:
dfs = []
for f in glob('data_anto/*.csv'):
    dfs.append(pd.read_csv(f, encoding='utf-8'))
df = pd.concat(dfs)
df = add_sdt_utils(df)
means, counts, proba, mecog = metacog_dfs(df)

Sanity check

Let's see if the scale converge in order to keep the performance level constant


In [ ]:
g = sns.FacetGrid(df[~df['TrialType'].str.contains('easy|hard')], col='Name', col_wrap=5)
g.map(plt.plot, 'Trial', 'Scale')

g = sns.FacetGrid(df[~df['TrialType'].str.contains('easy|hard')], col='Name', col_wrap=5)
g.map(plt.plot, 'trials.thisTrialN', 'Signal')

g = sns.FacetGrid(df[~df['TrialType'].str.contains('easy|hard')], col='Name', col_wrap=5)
g.map(plt.plot, 'trials.thisTrialN', 'cmax2')

It is also important to see that no subject has a Wager value of 1 (or 0)


In [ ]:
df.groupby('Name')[['Response', 'Signal', 'Confidence', 'Wager']].mean()

In [ ]:
sns.jointplot('Response', 'Wager', means, marginal_kws={'hist': False, 'kde': True}, stat_func=None)

In [ ]:
sns.jointplot('Response', 'Confidence', means, marginal_kws={'hist': False, 'kde': True}, stat_func=None)

In [ ]:
sns.jointplot('Wager', 'Confidence', means, marginal_kws={'hist': False, 'kde': True}, stat_func=None)

In [ ]:
df.groupby('Name')[['Response RT', 'Wager RT', 'Confidence RT']].mean()

In [ ]:
df.groupby('Name')[['Response', 'Wager', 'Confidence']].count()

In [ ]:
df[df['TrialType'].str.contains('easy|hard')].pivot_table(index='Name', columns='TrialType', values='Response')