between and within-subject factors

855 views
Skip to first unread message

glae...@gmail.com

unread,
Mar 20, 2017, 7:14:37 PM3/20/17
to hddm-users
Hi HDDM users,

I have read the paper and online documentation on the HDDM package and I am trying to figure out, if I can use it for my data. I have an experiment with between- and within-subject factors: there 3 groups of subjects, which differ in their attentional focus. Each subject (in each group) get the same task with 5 different conditions. Briefly, the task is a cross-modal integration task with a foreground picture, a sound, and a background picture. The subject has to indicate with a button press, whether the two stimuli in their focus of attention are congruent (i.e. a picture of a lion and a roar sound) or not.

Looking at the (model-free) correct/false responses and RTs, I see different effects on the within-subject factor "condition" interacting with the between-subject factor "attentional focus".

I have 2 questions:

1. In my understanding, I would need a 3-level model with different group distribution, from which all the subjects of each group are drawn. The within-subject factor "condition" is then drawn from the subject-specific distributions. Does HDDM support these 3-level hierarchies?

2. The same response (e.g. "congruent") to the same stimulus, can be both correct or false, depending on the between-subject factor (attentional focus). Does it make more sense to recode the "congruent/incongruent" rseponse into "correct" and "false", so that they are consistent across the different groups?

Any insight is greatly appreciated.
Jan

Thomas Wiecki

unread,
Mar 21, 2017, 8:02:25 AM3/21/17
to hddm-...@googlegroups.com
Hi Jan,

On Tue, Mar 21, 2017 at 12:14 AM, <glae...@gmail.com> wrote:
Hi HDDM users,

I have read the paper and online documentation on the HDDM package and I am trying to figure out, if I can use it for my data. I have an experiment with between- and within-subject factors: there 3 groups of subjects, which differ in their attentional focus. Each subject (in each group) get the same task with 5 different conditions. Briefly, the task is a cross-modal integration task with a foreground picture, a sound, and a background picture. The subject has to indicate with a button press, whether the two stimuli in their focus of attention are congruent (i.e. a picture of a lion and a roar sound) or not.

Looking at the (model-free) correct/false responses and RTs, I see different effects on the within-subject factor "condition" interacting with the between-subject factor "attentional focus".

I have 2 questions:

1. In my understanding, I would need a 3-level model with different group distribution, from which all the subjects of each group are drawn. The within-subject factor "condition" is then drawn from the subject-specific distributions. Does HDDM support these 3-level hierarchies?

Not possible.
 
2. The same response (e.g. "congruent") to the same stimulus, can be both correct or false, depending on the between-subject factor (attentional focus). Does it make more sense to recode the "congruent/incongruent" rseponse into "correct" and "false", so that they are consistent across the different groups?

Sure, that sounds fine.
 

Any insight is greatly appreciated.
Jan

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael J Frank

unread,
Mar 21, 2017, 7:41:43 PM3/21/17
to hddm-...@googlegroups.com
Hi Jan, just to follow up here: for your first question, I don't think you actually need a 3-level model: instead just use patsy for the within-subject effects (as per the hddm docs) and use the group level distributions above that. You could then decide to either (i) fit the model 3 times for each group (so you can then look at the within-subject effects of each of these group separately), or better (ii) just code the group as a between subjects ordinal variable (if that makes sense in your situation) and fit the model once to all subjects testing whether the between subjects factor interacts with the within-subjects one.  This is actually conceptually similar to a recent post to this list showing how to estimate between-subjects effects (and test if they are recoverable) - I can forward that if you can't find it.

Miichael 

Michael J Frank, PhD, Professor
Laboratory for Neural Computation and Cognition
Brown University
http://ski.clps.brown.edu
(401)-863-6872

Marjorie

unread,
Jul 12, 2017, 10:20:22 AM7/12/17
to hddm-users, Michae...@brown.edu
Hi HDDM professionals,

Your ii) suggestion Michael in your recent post might be usefull for my data. I have RT's on Go and No-Go stimulus of 2 groups, either on medication or on placebo, and have two sessions, resp baseline and 6 weeks after supplementation. Im interested in the differences of a, vGO and vNoGo and z(Go is more frequent than NoGo) between groups and over time. 

I have difficulty with formulating the code for the right model for this interest. Does anyone has a suggestion how to analyse this?

Best,
Marjorie
Yale MD/PhD student 

Mads Lund Pedersen

unread,
Jul 12, 2017, 10:28:02 AM7/12/17
to hddm-...@googlegroups.com, Michae...@brown.edu
Hi Marjorie,

I’m working on data very similar to yours, and think I’m on to something in terms of how to analyze. I’ll post here again (hopefully end of week) once I have an approach that satisfactorily recovers parameters.

Cheers,
Mads

--
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.

Mads Lund Pedersen

unread,
Jul 14, 2017, 9:42:06 AM7/14/17
to hddm-...@googlegroups.com, Michae...@brown.edu
Hi,

I think this should be the correct model definition for your data (but see below for problems running this model with go/nogo data):

hddm.HDDMRegressor(data, ["v ~ C(condition):C(group):C(session)","a ~ C(group):C(session)”,”z ~ C(group):C(session)”], include='z’)

in which condition describes whether the trial was a go or no-go trial, and the response column is coded as whether a response was given (1) or not (0). This should give you an estimate of  bias in favor of responding (>0.5) (or withholding (<0.5)) irrespective of the type of trial/condition. Withheld responses should be coded 999, based on the modification to account for go/no-go data by Guido Biele, implemented by Jona Sassenhagen.

The problem is that I don’t get this model to run. Coding with 999 works for the basic hddm, but not with the hddm-regressor. I’d like to capture within-effects so running with the regressor would be ideal. Does anyone know why this doesn’t work, and how to fix it? Code (for a simpler model) with error message attached.

Cheers,
Mads

GoNoGoRegressionTest.html

Marjorie

unread,
Jul 14, 2017, 2:51:06 PM7/14/17
to hddm-users, Michae...@brown.edu
Hi Mads,

Yes, I think we are on the same thing. I tried some similar models, like;

model =  hddm.HDDMRegressor(data, "v ~ 0 + group + C(session, Treatment('BL'))", p_outlier = 0.05)


and


model = hddm.HDDMRegressor(data, {"v ~ C(session, Treatment('BL'))*C(group, Treatment('on')))"}, keep_regressor_trace=True, p_outlier=.05, is_group_model=True)


but got errors like that too. I will try your model on my data. I will report back.


Best,

Marjorie

Marjorie

unread,
Jul 14, 2017, 5:38:48 PM7/14/17
to hddm-users, Michae...@brown.edu
Hi Mads, 

How did you manage not to get the error complaining about missing columns in the design matrix when you use the C(group) in your hddmregression model? Because putting group inside of "v ~ C(group)" instead of as a depends_on argument makes the model look for group 'on' and 'off' for each subject, because it thinks it is a repeated measure and errors out, right?

That is the error I get when I run your model on my data.

Best,
Marjorie

Mads Lund Pedersen

unread,
Jul 15, 2017, 8:11:40 AM7/15/17
to hddm-...@googlegroups.com
Yes, you’re of course right, in my simulations all subjects were in both groups, but this wouldn’t work in groups with unique subjects. I don’t have time now to check how you should account for the between-effect, but will refer you to this thread on the forum which might be helpful  Using HDDMRegressor to fit between-person effects. And I’ll report again when I have something working.

In the meantime I’d still be interested to hear if anyone knows why coding with 999 (for no-go responses) does not work in HDDMRegressor.

Mads

Thomas Wiecki

unread,
Jul 17, 2017, 8:07:18 AM7/17/17
to hddm-...@googlegroups.com
On Sat, Jul 15, 2017 at 2:11 PM, Mads Lund Pedersen <kent...@gmail.com> wrote:

In the meantime I’d still be interested to hear if anyone knows why coding with 999 (for no-go responses) does not work in HDDMRegressor.

Are you on recent master? If yes, then you should not replace missing responses with 999 but with nans. 

Mads

On Fri,14-Jul,2017, at 17:38 , Marjorie <marjorie...@gmail.com> wrote:

Hi Mads, 

How did you manage not to get the error complaining about missing columns in the design matrix when you use the C(group) in your hddmregression model? Because putting group inside of "v ~ C(group)" instead of as a depends_on argument makes the model look for group 'on' and 'off' for each subject, because it thinks it is a repeated measure and errors out, right?

That is the error I get when I run your model on my data.

Best,
Marjorie

--
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+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.

Mads Lund Pedersen

unread,
Aug 2, 2017, 12:14:10 PM8/2/17
to hddm-...@googlegroups.com
Thanks Thomas,

However, I only get it working with nan with the hddm-function, not with hddmRegressor, where I get the step out procedure failed-error. This happens only when I include nans in the data. I found another thread discussing this (https://groups.google.com/forum/#!topic/hddm-users/BzPv66mgKkY), so I tried to revert to HDDM 0.6.0 but use the folders from 0.6.1, but I didn’t get that working either (then the hddm-function also failed for nan). 

Any suggestions?

Numpy version is 1.11.3 if that’s of any importance.

Cheers,
Mads


To unsubscribe from this group and stop receiving emails from it, send an email to hddm-users+...@googlegroups.com.

Thomas Wiecki

unread,
Aug 2, 2017, 12:19:03 PM8/2/17
to hddm-...@googlegroups.com
Missing values are not supported by the regression model.
Reply all
Reply to author
Forward
0 new messages