Controls: 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 control models
controls_data = hddm.load_csv('/lang_dec/data/controls_clean.csv')
controls_model = hddm.HDDM(controls_data, depends_on={'v': 'stim'}, bias=True)
controls_model.load_db(dbname='language_decision/models/controls', db='txt')

controls_model_threshold = hddm.HDDM(controls_data, depends_on={'v': 'stim', 'a': 'stim'})
controls_model_threshold.load_db(dbname='language_decision/models/controls_threshold', db='txt')


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

Reaction Time Distributions

RT distributions of each individual subject


In [4]:
fig = plt.figure()
ax = fig.add_subplot(111, xlabel='RT', ylabel='count', title='RT distributions')
for i, subj_data in controls_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 [8]:
controls_model.plot_posterior_predictive(figsize=(15, 10))