Exploring hddm


In [25]:
%matplotlib inline

Quick-Start Tutorial

As found in the hddm repo README file - see https://github.com/hddm-devs/hddm


In [11]:
import hddm

# Load csv data - converted to numpy array
data = hddm.load_csv('../examples/hddm_simple.csv')

# Create hddm model object
model = hddm.HDDM(data, depends_on={'v': 'difficulty'})

# Markov chain Monte Carlo sampling
model.sample(2000, burn=20)


/Users/constantinose/anaconda/envs/lang-dec/lib/python3.5/site-packages/pymc/Node.py:403: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  self.__name__ = input['__name__']
 [-----------------100%-----------------] 2000 of 2000 complete in 11.0 sec
/Users/constantinose/anaconda/envs/lang-dec/lib/python3.5/site-packages/numpy/core/fromnumeric.py:224: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  return reshape(newshape, order=order)
Out[11]:
<pymc.MCMC.MCMC at 0x113ad8fd0>

Notes on MCMC sampling:


In [19]:
# Model fitted parameters & summary stats
model.print_stats()

model.print_stats().__class__


             mean        std      2.5q       25q       50q       75q     97.5q       mc err
a         2.03131  0.0337733   1.96609   2.00749   2.03031   2.05436   2.09728   0.00110213
v(easy)  0.997186  0.0516955  0.895089  0.961048  0.997952    1.0317   1.09962   0.00126573
v(hard)  0.530634  0.0475509  0.439451  0.496399  0.530864  0.563646  0.622194    0.0010258
t        0.296775  0.0080045  0.280349  0.291433  0.296854  0.302214  0.312331  0.000271828
DIC: 2329.312114
deviance: 2325.380836
pD: 3.931277
             mean        std      2.5q       25q       50q       75q     97.5q       mc err
a         2.03131  0.0337733   1.96609   2.00749   2.03031   2.05436   2.09728   0.00110213
v(easy)  0.997186  0.0516955  0.895089  0.961048  0.997952    1.0317   1.09962   0.00126573
v(hard)  0.530634  0.0475509  0.439451  0.496399  0.530864  0.563646  0.622194    0.0010258
t        0.296775  0.0080045  0.280349  0.291433  0.296854  0.302214  0.312331  0.000271828
DIC: 2329.312114
deviance: 2325.380836
pD: 3.931277
/Users/constantinose/anaconda/envs/lang-dec/lib/python3.5/site-packages/numpy/core/fromnumeric.py:224: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  return reshape(newshape, order=order)
Out[19]:
NoneType

print_stats() is literally just a printer - it doesn't return a data structure. Could parse this info in a nice python data structure?


In [27]:
# Fit posterior RT distributions
model.plot_posteriors()


Plotting a
Plotting v(easy)
Plotting v(hard)
Plotting t

In [28]:
# Plot theoretical RT distributions
model.plot_posterior_predictive()