Dear HDDM experts,
I am trying to use HDDM to look at changes in parameters between two groups in a task with three conditions. As such, I think I need a within subjects model, as including ‘depends_on={'v': ['group', 'condition']}’ for example treats group and condition as independent. Additionally, it is likely that performance in one condition relates to performance in the other two.
However, I am unsure of how to specify the model to include the within subjects effect of condition and between subjects effect of group. I have read the patsy documentation and the tutorial on within subjects effects but I’m still not sure…
In the simplest case, assuming I was only interested in drift rate - is this the correct syntax? (In the below code, condition can take a value of {one, two, three} as categorical values)
from patsy import dmatrix
dmatrix("C(condition, Treatment('one'))",data)
m_within = hddm.HDDMRegressor(data,"v ~ 1+ group*C(condition, Treatment('one'))")
m_within.sample(5000,burn=250)
I’d be really grateful for any help with this!
Thanks in advance!
Tim
--
You received this message because you are subscribed to the Google Groups "hddm-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hddm-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hddm-users/b9e99227-5b81-4e2b-b75f-836bb16c738an%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hddm-users/2d091c67-8aa5-4bc9-9380-11d97146c98an%40googlegroups.com.
Hi Mads,
Thanks for getting back.
Yes sorry I meant HDDMRegressor = within, HDDM = between. Good to know that HDDM is faster, and thanks for the group_only_regressors tip - that has solved that problem.
Apologies for my lack of clarity. What I'm about to discuss is the output of a dataset with just one group, I just included a between subjects effect. There are 25-30 trials per person per each of the 3 levels of effect, with 28 participants. I have run a HDDMRegressor model with group_only_regressors = False. This took 20 hours on my PC - which seems like a long time.
Unfortunately I have had repeated issues with the Geweke statistic calculation which I can't seem to get round, but the chains from this model look pretty nasty so I suspect issues with convergence, and the autocorrelation looks very high. Is this a problem with lack of data that might crop up with HDDMRegressor?
I have also managed to get my hands on another computer, which I will try to run this code on to see if this is to do with my system.
Geweke error attached below.
Thanks so much,
Tim
***** Geweke error ********
I have come up with the following error when trying to calculate the Geweke statistic for my model. I have seen others have reported this problem, but I couldn’t see any solutions other than to check for NaN/extreme values (there weren’t any in my data).
As I understand it, if the chain has not converged, print check_geweke should return false. Instead I get the below errors.
In case this is useful - gr takes the value of either 0 or 1 (control/case) and stim takes the value of {bb,bd,tu} (different conditions).
AssertionErrorTraceback (most recent call last)
<ipython-input-6-4b1ae3ba7cfa> in <module>()
1 #b_3k.print_stats()
2 from kabuki.analyze import check_geweke
----> 3 print check_geweke(b_3k)
4
5 #b_3.gen_stats()
C:\Users\ts772\AppData\Local\Continuum\anaconda2\lib\site-packages\kabuki\analyze.pyc in check_geweke(model, assert_)
161 msg = "Chain of %s not properly converged" % param
162 if assert_:
--> 163 raise AssertionError(msg)
164 else:
165 print(msg)
AssertionError: Chain of knode_name a
stochastic True
observed False
subj False
node a(0.TU)
tag (0, TU)
depends [gr, stim]
hidden False
subj_idx NaN
stim TU
rt NaN
response NaN
trialInfo NaN
keypress NaN
gaze NaN
gr 0
correct NaN
mean 1.08191
std 0.0490583
2.5q 0.985729
25q 1.04933
50q 1.08188
75q 1.11475
97.5q 1.17916
mc err 0.000562783
map 1.37006
Name: a(0.TU), dtype: object not properly converged