DDM for matched controls

Check how controls fit DDM


In [1]:
%matplotlib inline
%cd ..

import warnings; warnings.filterwarnings('ignore')


/Users/celefthe/Programming/projects/language_decision

In [6]:
import hddm

data = hddm.load_csv('data/controls_clean.csv')

model = hddm.HDDM(data, depends_on={'v': 'stim'})
model.find_starting_values()
model.sample(6000, burn=20)


 [-----------------100%-----------------] 6000 of 6000 complete in 102.1 sec
Out[6]:
<pymc.MCMC.MCMC at 0x112e956a0>

In [7]:
model.print_stats()


                      mean        std       2.5q        25q        50q        75q     97.5q       mc err
a                  1.97919   0.123825    1.74986    1.90687    1.97371     2.0448   2.23047   0.00249048
a_std             0.243579   0.148476  0.0691908    0.15506   0.212682   0.295182  0.588057   0.00458231
a_subj.18439       1.98831   0.126877    1.75367    1.90218    1.98497    2.06852   2.25784   0.00375598
a_subj.18941       1.94927    0.11125     1.7345    1.87464    1.94779    2.02242   2.17011   0.00249918
a_subj.19621       1.91691   0.084864     1.7589    1.85841    1.91591    1.97285   2.08872   0.00165564
a_subj.19679        1.9785   0.105615    1.78286     1.9066    1.97438    2.04594   2.20001   0.00250165
a_subj.19718       1.77198  0.0970987    1.59262    1.70428    1.76878    1.83597   1.97309    0.0025864
a_subj.20373       2.25379   0.148355    1.99065    2.14568    2.24478    2.35334   2.56451   0.00448595
v(CP)             0.635722   0.309002  0.0355114   0.433664   0.633642   0.842519   1.25441   0.00402303
v(CS)              1.25447   0.300795    0.65772    1.06198    1.25463      1.451   1.84704   0.00397446
v(SS)              1.60069   0.307225    1.00307    1.39839    1.59594    1.79736    2.2203   0.00411307
v(US)              1.81924   0.306732    1.22377    1.61843     1.8185    2.01932   2.42501   0.00438252
v_std             0.701018   0.132268    0.48594   0.608457   0.684624   0.779267   1.00404   0.00263871
v_subj(CP).18439   1.59655   0.249554    1.11743    1.42759     1.5964    1.76908   2.07948   0.00430412
v_subj(CP).18941  0.971133   0.221317   0.548109   0.819515   0.968574    1.11982   1.41167   0.00339704
v_subj(CP).19621 -0.729913   0.231403   -1.17905  -0.885601  -0.729468  -0.575645 -0.266575    0.0035297
v_subj(CP).19679  0.889471   0.216794   0.463031    0.74398   0.889267    1.03459   1.33172   0.00307312
v_subj(CP).19718  0.231179   0.217003  -0.194026  0.0883756   0.232542   0.377045  0.655592   0.00278015
v_subj(CP).20373  0.760944   0.181293   0.402075   0.639033   0.760559    0.88271   1.11914   0.00227996
v_subj(CS).18439   1.82012   0.252108    1.31995    1.65475    1.82027    1.99038   2.33717   0.00404413
v_subj(CS).18941   1.42934   0.231257   0.976113    1.27445    1.43225    1.58495    1.8798   0.00398069
v_subj(CS).19621  0.378419   0.213669 -0.0250116   0.228461   0.375048   0.522219  0.801629   0.00303898
v_subj(CS).19679   1.33751   0.222706   0.904464    1.18936    1.33509    1.48757   1.76262   0.00341699
v_subj(CS).19718   1.39153   0.244613   0.918451    1.23007    1.38415    1.55439   1.87805   0.00359032
v_subj(CS).20373   1.15513   0.201925   0.750866    1.01922    1.15405    1.29311   1.54806   0.00349628
v_subj(SS).18439   2.10352   0.283734    1.55636    1.90992    2.10129     2.2944   2.65688   0.00494739
v_subj(SS).18941   1.88173   0.257385    1.37011    1.70536    1.88428     2.0543   2.37757    0.0036878
v_subj(SS).19621  0.713526   0.215611    0.29251   0.567794    0.71683   0.856713   1.13464   0.00343538
v_subj(SS).19679   1.75489   0.252237    1.26013    1.58216    1.75244    1.92954   2.24432   0.00358061
v_subj(SS).19718   1.46837   0.269427   0.939303    1.28611    1.47012    1.65535   1.98833   0.00429546
v_subj(SS).20373   1.65158   0.241471    1.17697    1.48887    1.65139     1.8173   2.11375   0.00373504
v_subj(US).18439   2.38964   0.296077    1.82353    2.18639    2.38587    2.58891   2.97847   0.00498478
v_subj(US).18941   2.49271   0.305323    1.91249    2.28515    2.48942    2.69623   3.09391   0.00489707
v_subj(US).19621  0.662205   0.190989   0.288254   0.533903   0.662926    0.79039   1.03354   0.00264969
v_subj(US).19679   1.84767   0.245148    1.38044    1.67936    1.84888    2.01132   2.33621   0.00367256
v_subj(US).19718   1.96393   0.272076    1.42467    1.78331    1.96188    2.14595   2.49149    0.0042894
v_subj(US).20373   1.54185   0.215525    1.12342    1.39547     1.5428    1.68706   1.96582   0.00313185
t                 0.663472   0.023299   0.615489   0.650939   0.663323   0.676296  0.709006  0.000359022
t_std             0.048382   0.026082  0.0170403  0.0316273  0.0425401  0.0572321  0.116672  0.000801701
t_subj.18439      0.669713   0.016405   0.633752   0.659592   0.670711   0.681093   0.69962  0.000451813
t_subj.18941      0.677598  0.0167124    0.64204    0.66669   0.678278   0.689564  0.706628  0.000359284
t_subj.19621      0.620502  0.0181958   0.579987   0.609293     0.6224   0.633693  0.650585  0.000390319
t_subj.19679      0.632388  0.0165237    0.59615   0.622198   0.633766   0.644021  0.660335  0.000396927
t_subj.19718      0.677583  0.0132966   0.648665   0.669214   0.678851   0.686957  0.700246   0.00031398
t_subj.20373      0.707378  0.0243468   0.656284   0.691554    0.70921   0.725247  0.749472  0.000680727
DIC: 801.955575
deviance: 770.068456
pD: 31.887119

In [8]:
model.plot_posteriors()


Plotting a
Plotting a_std
Plotting v(CP)
Plotting v(CS)
Plotting v(SS)
Plotting v(US)
Plotting v_std
Plotting t
Plotting t_std

In [9]:
v_SS, v_CP, v_CS, v_US = model.nodes_db.node[['v(SS)', 'v(CP)', 'v(CS)', 'v(US)']]

hddm.analyze.plot_posterior_nodes([v_SS, v_CP, v_CS, v_US])



In [11]:
print('P(SS > US) = ' + str((v_SS.trace() > v_US.trace()).mean()))
print('P(CP > SS) = ' + str((v_CP.trace() > v_SS.trace()).mean()))
print('P(CS > SS) = ' + str((v_CS.trace() > v_SS.trace()).mean()))
print('P(CP > CS) = ' + str((v_CP.trace() > v_CS.trace()).mean()))


P(SS > US) = 0.302341137124
P(CP > SS) = 0.0142140468227
P(CS > SS) = 0.203344481605
P(CP > CS) = 0.069397993311