Pilot: Individual Subject Model Performance Analysis


In [1]:
# Environment setup
%matplotlib inline
%cd /lang_dec
# Imports
import warnings; warnings.filterwarnings('ignore')
import hddm
import numpy as np
import matplotlib.pyplot as plt
from utils import model_tools, signal_detection


/Users/celefthe/celefthe/projects/language_decision

In [2]:
# Import pilot models
pilot_data = hddm.load_csv('/lang_dec/data/pilot_clean.csv')
pilot_model = hddm.HDDM(pilot_data, depends_on={'v': 'stim'}, bias=True)
pilot_model.load_db(dbname='language_decision/models/pilot', db='txt')

pilot_model_threshold = hddm.HDDM(pilot_data, depends_on={'v': 'stim', 'a': 'stim'})
pilot_model_threshold.load_db(dbname='language_decision/models/pilot_threshold', db='txt')


Out[2]:
<hddm.models.hddm_info.HDDM at 0x116807390>

Reaction Time Distributions

RT distributions of each individual subject


In [5]:
fig = plt.figure()
ax = fig.add_subplot(111, xlabel='RT', ylabel='count', title='RT distributions')
for i, subj_data in pilot_data.groupby('subj_idx'):
    subj_data.rt.hist(bins=20, histtype='step', ax=ax)


Model Fitness

How well do the models fit our data?

Individual subject RT distributions are plotted in red on top of the predictive likelihood in blue

(see http://ski.clps.brown.edu/hddm_docs/tutorial_python.html)


In [10]:
pilot_model.plot_posterior_predictive(figsize=(15, 18))