fitting the diffusion model to data with a response bias

406 views
Skip to first unread message

Guido Biele

unread,
Sep 10, 2012, 8:49:42 AM9/10/12
to hddm-...@googlegroups.com
Hi,

first thanks for publishing a new, improved version oh hddm!

the hddm manual suggests that one should not accuracy-code ata when estimating a response bias.
diverging from this recommendation, I just stumbled about 2 papers by ratcliff and colleagues, who do exactly this.*
is the recommendation (to not accuracy code for experiments with a response bias) due to a reason that has to do specifically with hddm?

Ratcliff and McKoon (2008) examine if prior probability influences the starting point or the drift rate. to test the effect on drift rate, they seem to decompose the total drift rate into 2 components, one due to stimulus quality and one due to prior probability.
Is this kind of analysis possible in the new version of hddm?
(I am happy to do some additional coding myself if this is required to get this working)


Cheers  - guido

* see
(a)  White, C. N., Ratcliff, R., Vasey, M. W., & McKoon, G. (2010). Using diffusion models to understand clinical disorders. Journal of Mathematical Psychology, 54(1), 39–52. 
page 42, section 4.1
(b) Ratcliff, R., & McKoon, G. (2008). The diffusion decision model: theory and data for two-choice decision tasks. Neural Computation, 20(4), 873–922. doi:10.1162/neco.2008.12-06-420
page 897, section 4.3

Thomas Wiecki

unread,
Sep 10, 2012, 9:23:34 AM9/10/12
to hddm-...@googlegroups.com
Hi,

I couldn't find those passages:

From White: "position of starting point relative to the boundaries (values
above .5 indicate bias to respond ‘‘word’’ and values below .5 indicate bias to respond ‘‘nonword""

From McKoon where they introduce response bias in exp 3: "Because the proportions of the two stimuli tested for the high- versus low-probability stimuli produced an asymmetry between re- sponses in accuracy of the two responses and also RTs for correct responses and error responses, they were not combined as they were for experiments 1 and 2."

You could use a hybrid (I think they do this in the last experiment where they have 2 conditions: left correct, right correct (i.e. stimulus coding)).

In left correct you could code left to represent the upper boundary (i.e. 1) and in right correct you could code right to represent the upper boundary. This way upper boundary would always be correct but you are still using stimulus coding. That way positive drift would always mean >50% accuracy.

I think it is helpful to think about this in terms of which boundary you want to mean what and that bias is relative to those boundaries. HDDM just estimates whatever you present it with.

Thomas

Guido Biele

unread,
Sep 10, 2012, 11:04:31 AM9/10/12
to hddm-...@googlegroups.com
Hi Thomas,

I'm not sure what to think of the White paper; The last sentence on page 42 / first on 43 is:
"The data entered into the routine were the number of observations, accuracy, and correct and error RT distributions for each condition. All data were fit simultaneously."
Based on this sentence it seemed to me that they modeled accuracy-coded data.
However, I also see that the note under table 1 you cite suggests that they could have modeled responses-coded data.
I think one potential resolution is, that they split that data according to conditions (high-frequency word, low-frequency words, nonwords) for the fitting (as suggested by my quote above and the fact that they report 3 drift rates). if one does this, one can still report a bias with interpretation word/non-word, after appropriate adjustment of the sign of the bias parameter.

About the Ratcliff & McKoon paper:
I read this quote so that they accuracy-coded the responses, but that they fit the data for the different conditions separately.
The reason why I am quite sure that they have used accuracy coding here too is that Figure 10--which displays the results of experiment 3--displays quantile probability plots split by accuracy (and conditions ..)

In your response you mention using a hybrid. I agree with the approach, even if I don't understand why you call it stimulus-coding, because 1 is always associated with the correct response, and not always with "left response" or always with "right response".*

More generally, when the data are from a task where correct and incorrect responses can be determined, I think one should always use accuracy coding, so that one can estimate the difficulty of a condition (or capability of a participant/group). I am not sure what the meaning of the drift rate would be if the data were stimulus/direction-coded.

Cheers - Guido


*c.f. your documentation: "There are two ways you can code subject responses (these are the values you put in the ‘response’ column in your data file). You can either use accuracy-coding where 1 means correct and 0 means error, or you can use direction-coding [GB: which i understand meaning the same as stimulus-coded] where 1 means left and 0 means right ..."
/Journal of Mathematical Psychology/, /54/(1), 39–52.

page 42, section 4.1
(b) Ratcliff, R., & McKoon, G. (2008). The diffusion decision
model: theory and data for two-choice decision tasks. /Neural
Computation/, /20/(4), 873–922. doi:10.1162/neco.2008.12-06-420
page 897, section 4.3





--

 Guido Biele 
 Email: g.p....@psykologi.uio.no 
 Phone: +47 228 45172 
 Website 

 Visiting Address 
 Psykologisk Institutt  
 Forskningsveien 3 A 
 0373 OSLO 
  Mailing Address 
  Psykologisk Institutt 
  Postboks 1094 
  Blindern 0317 OSLO

Thomas Wiecki

unread,
Sep 10, 2012, 11:17:04 AM9/10/12
to hddm-...@googlegroups.com
Hi Guido,

On Mon, Sep 10, 2012 at 11:04 AM, Guido Biele <g.p....@psykologi.uio.no> wrote:
In your response you mention using a hybrid. I agree with the approach, even if I don't understand why you call it stimulus-coding, because 1 is always associated with the correct response, and not always with "left response" or always with "right response".*

You are right, in fact it's accuracy (upper is correct) and stimulus (upper is left/right, depending on condition) coding simultaneously.

More generally, when the data are from a task where correct and incorrect responses can be determined, I think one should always use accuracy coding, so that one can estimate the difficulty of a condition (or capability of a participant/group). I am not sure what the meaning of the drift rate would be if the data were stimulus/direction-coded.

Agreed. I suppose I haven't thought too much about these issues because in our tasks there is no reason to assume a bias so I always use accuracy coding.

It does seems as if the hybrid should always be preferred over pure stimulus coding so maybe a convenience function to recode the responses to be in accordance this would be handy. This might also be better described in the howto. Let me know if you want to give either of those a crack.

Thomas

Guido Biele

unread,
Sep 10, 2012, 11:21:18 AM9/10/12
to hddm-...@googlegroups.com
hi thomas,

glad that we are agree!
I never exclude that I am missing something ;-)

I'll think about something for the how to, but I first want to test a
few things, because I think that this issues is really not so trivial
...

cheers - guido
>> <mailto:g.p....@psykologi.uio.no>
> ------------------------------------------------------------------------
>
> Guido Biele
> Email:g.p....@psykologi.uio.no <mailto:g.p....@psykologi.uio.no>
> Phone:+47 228 45172 <tel:%2B47%20228%2045172>
> Website <https://sites.google.com/a/neuro-cognition.org/guido/home>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>



--
------------------------------------------------------------------------

Guido Biele
Email: g.p....@psykologi.uio.no
Phone: +47 228 45172
Website <https://sites.google.com/a/neuro-cognition.org/guido/home>

DunovanK

unread,
Sep 11, 2012, 1:01:29 PM9/11/12
to hddm-...@googlegroups.com
Hello all,

I have some questions about this.  If accuracy coding is used, movement of the starting point bias does not impact the response distributions in the same manner as if the data were stimulus coded.  For example, in the case of Exp3 in the Ratcliff & McKoon paper, upwards bias in z increases the relative probability of reaching the A bound and decreases the probability of reaching the alternative bound.  If the data are accuracy coded the probability of correctly identifying each alternative increases, despite the experimental manipulation of one having a higher prior probability of occurring. Am I missing something crucial here?  

Best,

Kyle

Thomas Wiecki

unread,
Sep 11, 2012, 1:47:27 PM9/11/12
to hddm-...@googlegroups.com
On Tue, Sep 11, 2012 at 1:01 PM, DunovanK <duno...@gmail.com> wrote:
Hello all,

I have some questions about this.  If accuracy coding is used, movement of the starting point bias does not impact the response distributions in the same manner as if the data were stimulus coded.  For example, in the case of Exp3 in the Ratcliff & McKoon paper, upwards bias in z increases the relative probability of reaching the A bound and decreases the probability of reaching the alternative bound.  If the data are accuracy coded the probability of correctly identifying each alternative increases, despite the experimental manipulation of one having a higher prior probability of occurring. Am I missing something crucial here?  

Not sure what your question is but what you say sounds correct. The critical point is that bias influences the decision process before any accumulation happens. So if you use accuracy coding and the correct response in one condition is not constant (e.g. sometimes left, sometimes right or sometimes word, sometimes non-word) it is pretty hard to justify how you could be biased to make the correct response before you know which one will actually be correct.

Thomas

Joachim Vandekerckhove

unread,
Sep 11, 2012, 1:54:00 PM9/11/12
to hddm-...@googlegroups.com
Just to add my $.02, I don't think there are usually any disadvantages to using response coding. In those cases, the bias parameter has a sensible interpretation, and the only thing that gets a little trickier is that you need to keep in mind that in some conditions, high ability implies a strongly negative drift rate. It's trivial to just flip the drift rate for those conditions during postprocessing, though.
-- 
Joachim Vandekerckhove
Assistant Professor
Department of Cognitive Sciences
University of California, Irvine

Guido Biele

unread,
Sep 12, 2012, 3:13:15 AM9/12/12
to hddm-...@googlegroups.com
Hi,
I generally agree with your point, but I think that i omitted important details.

I think there are at least 2 ways to estimate bias in the starting point when data are accuracy coded:
1)  split the data by stimuli and then fit the accuracy coded data
in hddm this would be a model in which you estimate one v and where z depends on the stimulus (in the results you should find that one z parameter is above and the other below .5, consistent with the fact that bias leads to accuracy increase for one stimulus and for accuracy decrease for the other stimulus).
I think this approach is similar to the approach used by ratcliff and colleagues.

The (minor?) issue I have with this approach is that I don't think that the magnitude of the bias should be allowed to vary by stimulus type, which is what is implicitly happening in the approach I just described. I think bias magnitude is independent of stimulus type (because how should one set the magnitude of the bias dependent on stimulus before knowing what the stimulus is ...).
hence, I think an alternative way to set this up would be preferable:

2) split the data by stimuli and then fit the accuracy coded data
in hddm set up a model where with one v, and one z, but implement z for one condition as z and for the other condition as 1-z.
As far as i can tell this is not supported out of the box by hddm, but I am currently trying to figure out if I can find a way to make this (I think the bottle neck is my unfamiliarity with python ...)

In the best of worlds, one would not need approach 2) because the drift diffusion model is so stable that even in the first approach the results would show that z1 is very close to 1-z2, but the few tests I have made do not show this (which might be because the design includes a few more variables). Hence, I think it is worth looking into how approach 2) can be implemented in hddm.

cheers - guido
--

 Guido Biele 
 Email: g.p....@psykologi.uio.no 
 Phone: +47 228 45172 
 Website 

Guido Biele

unread,
Sep 12, 2012, 4:17:05 AM9/12/12
to hddm-...@googlegroups.com
Hi Joachim,

I don't understand the point with negative and positive drift rates and ability.

I would have thought that analyzing bias with response coded data in a simple experiment with 2 stimulus types and 2 response options A and B amounts to:
- coding response A to 1 and response B to 0
- "estimating" one drift rate and one bias parameter

I don't see how I get from there to a setup where one can interpret drift rate as an indicator of ability/difficulty, except one also splits the data by stimulus-type. but if one does that, it seem to me one would be back to accuracy coding. (true response coding to me is when the responses coded into one category contain both error and correct responses, which is why I have difficulties to understand how drift rate estimates from response coded data can be an indicator of ability/difficulty)

I must be missing something. Can you give me a hint what I am missing?

Cheers - Guido
--

 Guido Biele 
 Email: g.p....@psykologi.uio.no 
 Phone: +47 228 45172 
 Website 

Thomas Wiecki

unread,
Sep 12, 2012, 7:09:12 AM9/12/12
to hddm-...@googlegroups.com
On Wed, Sep 12, 2012 at 3:13 AM, Guido Biele <g.p....@psykologi.uio.no> wrote:
Hi,
I generally agree with your point, but I think that i omitted important details.

I think there are at least 2 ways to estimate bias in the starting point when data are accuracy coded:
1)  split the data by stimuli and then fit the accuracy coded data
in hddm this would be a model in which you estimate one v and where z depends on the stimulus (in the results you should find that one z parameter is above and the other below .5, consistent with the fact that bias leads to accuracy increase for one stimulus and for accuracy decrease for the other stimulus).
I think this approach is similar to the approach used by ratcliff and colleagues.

Wouldn't you also have to have v depend on stimulus? 

The (minor?) issue I have with this approach is that I don't think that the magnitude of the bias should be allowed to vary by stimulus type, which is what is implicitly happening in the approach I just described. I think bias magnitude is independent of stimulus type (because how should one set the magnitude of the bias dependent on stimulus before knowing what the stimulus is ...).
hence, I think an alternative way to set this up would be preferable:

2) split the data by stimuli and then fit the accuracy coded data
in hddm set up a model where with one v, and one z, but implement z for one condition as z and for the other condition as 1-z.
As far as i can tell this is not supported out of the box by hddm, but I am currently trying to figure out if I can find a way to make this (I think the bottle neck is my unfamiliarity with python ...)

In the best of worlds, one would not need approach 2) because the drift diffusion model is so stable that even in the first approach the results would show that z1 is very close to 1-z2, but the few tests I have made do not show this (which might be because the design includes a few more variables). Hence, I think it is worth looking into how approach 2) can be implemented in hddm.

Couldn't you have one z for both conditions in the hybrid approach?

Thomas

Michael J Frank

unread,
Sep 12, 2012, 7:14:14 AM9/12/12
to hddm-...@googlegroups.com
Hi Guido,

If you do response coding you can still model separately for each stimulus and also capture difficulty effects in drift rate. For example response A is correct for stimulus x and response B is correct for stimulus y. Then the drift toward boundary A in the stimulus x condition would be higher, more positive, as accuracy in that condition rises (because a greater proportion of trials are correct and hence more processes terminate on the A bound). For stimulus y, more accurate responses would be characterized by more negative drift rates because more processes terminate on boundary B. In this case, difficulty differences between stimuli would simply be fit by differences in the absolute value of the drift (or you could just flip the sign of the drift for stim y and then compare them as Joachim mentioned).

Michael


On Wednesday, September 12, 2012, Guido Biele wrote:
Hi Joachim,

I don't understand the point with negative and positive drift rates and ability.

I would have thought that analyzing bias with response coded data in a simple experiment with 2 stimulus types and 2 response options A and B amounts to:
- coding response A to 1 and response B to 0
- "estimating" one drift rate and one bias parameter

I don't see how I get from there to a setup where one can interpret drift rate as an indicator of ability/difficulty, except one also splits the data by stimulus-type. but if one does that, it seem to me one would be back to accuracy coding. (true response coding to me is when the responses coded into one category contain both error and correct responses, which is why I have difficulties to understand how drift rate estimates from response coded data can be an indicator of ability/difficulty)

I must be missing something. Can you give me a hint what I am missing?

Cheers - Guido

On 11/09/2012 19:54, Joachim Vandekerckhove wrote:
Just to add my $.02, I don't think there are usually any disadvantages to using response coding. In those cases, the bias parameter has a sensible interpretation, and the only thing that gets a little trickier is that you need to keep in mind that in some conditions, high ability implies a strongly negative drift rate. It's trivial to just flip the drift rate for those conditions during postprocessing, though.

On 09/11/2012 10:47 AM, Thomas Wiecki wrote:
On Tue, Sep 11, 2012 at 1:01 PM, DunovanK <duno...@gmail.com> wrote:
Hello all,

I have some questions about this.  If accuracy coding is used, movement of the starting point bias does not impact the response distributions in the same manner as if the data were stimulus coded.  For example, in the case of Exp3 in the Ratcliff & McKoon paper, upwards bias in z increases the relative probability of reaching the A bound and decreases the probability of reaching the alternative bound.  If the data are accuracy coded the probability of correctly identifying each alternative increases, despite the experimental manipulation of one having a higher prior probability of occurring. Am I missing something crucial here?  

Not sure what your question is but what you say sounds correct. The critical point is that bias influences the decision process before any accumulation happens. So if you use accuracy coding and the correct response in one condition is not constant (e.g. sometimes left, sometimes right or sometimes word, sometimes non-word) it is pretty hard to justify how you could be biased to make the correct response before you know which one will actually be correct.

Thomas
 
Best,

Kyle


On Monday, September 10, 2012 11:21:20 AM UTC-4, Guido Biele wrote:
hi thomas,

glad that we are agree!
I never exclude that I am missing something ;-)

I'll think about something for the how to, but I first want to test a
few things, because I think that this issues is really not so trivial
...

cheers - guido


On Mon Sep 10 17:17:04 2012, Thomas Wiecki wrote:
> Hi Guido,
>
> On Mon, Sep 10, 2012 at 11:04 AM, Guido Biele
> <g.p....@psykologi.uio.no <mailto:g.p....@psykologi.uio.no>> wrote:
>
>     In your response you mention using a hybrid. I agree with the
>     approach, even if I don't understand why you call it
>     stimulus-coding, because 1 is always associated with the correct
>     response, and not always with "left response" or always with
>     "right response".*
>
>
> You are right, in fact it's accuracy (upper is correct) and stimulus
> (upper is left/right, depending on condition) coding simultaneously.
>
>     More generally, when the data are from a task where correct and
--

 Guido Biele 
 Email: g.p....@psykologi.uio.no 
 Phone: +47 228 45172 
 Website 

 Visiting Address 
 Psykologisk Institutt  
 Forskningsveien 3 A 
 0373 OSLO 
  Mailing Address 
  Psykologisk Institutt 
  Postboks 1094 
  Blindern 0317 OSLO


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

Guido Biele

unread,
Sep 12, 2012, 7:36:55 AM9/12/12
to hddm-...@googlegroups.com
Hi Michael,

I agree with all you are saying. It is just that this is not what i
would have thought of as response coding, because if you split by
conditions and then within each condition by response, you end up with
4 RT distributions to "fit", where you have separate RT distribution
for correct and incorrect decisions:
stimulus a, correct (== response a)
stimulus a, incorrect (== response b)
stimulus b, correct (== response b)
stimulus b, incorrect (== response a)

as i wrote earlier, i had associated response coding with RT
distributions that contain only responses of one type, irrespective of
if this response was correct or not. it seems that this is a rather
unique view point.

anyhow, I see that we agree on the fundamental issue, which is that
when one splits by stimulus type, it doesn't matter if the data are
response or accuracy coded.

cheers - guido
> ------------------------------------------------------------------------
>
> Guido Biele
> Email:g.p....@psykologi.uio.no
> Phone: +47 228 45172
> Website <https://sites.google.com/a/neuro-cognition.org/guido/home>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>
> --
> Michael J Frank, PhD, Associate Professor
> Laboratory for Neural Computation and Cognition
> Brown University
> http://ski.clps.brown.edu
> (401)-863-6872



--
------------------------------------------------------------------------

Guido Biele
Email: g.p....@psykologi.uio.no
Phone: +47 228 45172
Website <https://sites.google.com/a/neuro-cognition.org/guido/home>

Michael J Frank

unread,
Sep 12, 2012, 7:54:41 AM9/12/12
to hddm-...@googlegroups.com
Hi Guido, but the main difference (I thought the core topic at stake in this thread but I might not have followed carefully enough)  is that with response coding and separate stimuli one can still estimate a single starting point bias which is plausible - a bias to respond A or B with higher frequency before even knowing the stimulus. This contrasts with the implausibility of a starting point bias toward a correct response (because this would require knowing what the stimulus is)
M
    ------------------------------------------------------------------------

Guido Biele

unread,
Sep 12, 2012, 8:31:00 AM9/12/12
to hddm-...@googlegroups.com
Hi Michael,

I agree. Though it seems to me that the different approaches have
different downsides. [if one implements an out of the box analysis in
hddm]

If one uses stimulus coding, one wins a bias parameter that has a very
clear interpretation and one has to give up the assumption that the
drift rate is independent of stimulus (because separate drift rates
have to be allowed for the 2 stimuli).*
If one uses accuracy coding, one gets by with one drift rate parameter,
but one has to estimate 2 bias parameters. I don't think it is good to
estimate 2 parameters here. Still,I also don't think that this approach
assumes that you know what the stimulus is before you start the
accumulation process, because the bias is not in favor of the correct
answer, but in favor of one response, which should be reflected in one
bias parameter being over .5 and the other below .5.

I think both downsides, that either drift rate or bias can depend on
the stimulus, are problematic.

That is why I was asked in a different thread where the model is
specified in hddm, so that one can try to set up a model in which one
has accuracy coded data and estimates one drift rate and one bias,
whereby the bias for one condition is just z and the bias for the other
condition is 1-z.
Equivalently, one could set up a model in which one has response coded
data and estimates one drift rate and one bias, whereby the drift rate
for one condition is just v and the drift rate for the other condition
is -v.

I hope we can agree on that this would be the best way (i.e. with the
least unreasonable assumptions) to estimate bias of the starting point
;-)

cheers - guido

* I actually tried this a while ago. the unwelcome result was that the
bias effect was mostly captured in the drift rates for the stimuli, as
opposed to the bias parameter, where I expected to find it because the
bias manipulation resulted a shift of mode and tail of the RT
distribution.
> ------------------------------__------------------------------__------------
>
> Guido Biele
> Email:g.p....@psykologi.uio.no
> Phone: +47 228 45172
> Website
> <https://sites.google.com/a/__neuro-cognition.org/guido/home
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>
> --
> Michael J Frank, PhD, Associate Professor
> Laboratory for Neural Computation and Cognition
> Brown University
> http://ski.clps.brown.edu
> (401)-863-6872
>
>
>
>
> --
> ------------------------------__------------------------------__------------
>
> Guido Biele
> Email: g.p....@psykologi.uio.no
> Phone: +47 228 45172
> Website
> <https://sites.google.com/a/__neuro-cognition.org/guido/home
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>

Thomas Wiecki

unread,
Sep 12, 2012, 9:15:22 AM9/12/12
to hddm-...@googlegroups.com
I'm not quite sure what'd be the best way to create a model like this. It certainly is possible to create a new knode like this:
Knode(pm.Deterministic, 'z_inv', eval=lambda z: 1-z, z=z_knode)
which would invert the z value. The problem is how to have part of the data use this node and other part of the data use the other.

Remind me again why you can't use the hybrid approach for this?

Guido Biele

unread,
Sep 12, 2012, 9:39:34 AM9/12/12
to hddm-...@googlegroups.com
Thanks!

I think if one splits by stimulus type and uses response coded data,
one has to fit separate drift rates for the 2 stimulus types. the
problem with this is that it seems implausible to me that the drift
rate should be allowed to have a different magnitude, dependent on
stimulus. More pragmatically (and maybe more relevant to some) this
allows that the bias effect is captured by the drift rates (such that
the more frequently choose stimulus with a lower mean RT has a drift
rate with a higher magnitude). This is especially unwelcome if you want
to compare a model which assumes effect of bias-manipulation on bias of
starting point with a model that assumes effect of bias-manipulation on
drift rate.

Similarly, if one splits by stimulus and uses accuracy coded data, one
allows for different magnitudes of |.5-z|, and I also think that it
implausible that the magnitude of the bias should be allowed to vary
dependent on stimulus type.

@data:
if the data are accuracy coded: can't one just calculate 2 likelihoods,
one for stimulus A, and the other for stimulus B, whereby the
likelihoods for RT distributions for A and B are generated from the
same parameters, except for z which is set to z for one condition and
to 1-z for the other condition?
I would have thought one approach is to first generate a model where z
depends on stimulus type, and where one then deletes one knode for z.
lets say z2, and replaces it with with 1-z2.
[this is admittedly all very general, and I don't know if it is
possible at all to remove nodes and replace parameters in the
likelihood function as easy as I am assuming. (with likelihood function
i mean the function that gives me the likelihood of the oberved RT
distribution given the model and the parameters.)]

cheers - guido
> <duno...@gmail.com <mailto:duno...@gmail.com>>
> ------------------------------____----------------------------__--__------------
>
>
> Guido Biele
> Email:g.p....@psykologi.uio.__no
> <mailto:Email%3Ag.p...@psykologi.uio.no>
> Phone: +47 228 45172 <tel:%2B47%20228%2045172>
> Website
>
> <https://sites.google.com/a/____neuro-cognition.org/guido/home <https://sites.google.com/a/__neuro-cognition.org/guido/home>
>
> <https://sites.google.com/a/__neuro-cognition.org/guido/home
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>
>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>
> --
> Michael J Frank, PhD, Associate Professor
> Laboratory for Neural Computation and Cognition
> Brown University
> http://ski.clps.brown.edu
> (401)-863-6872 <tel:%28401%29-863-6872>
>
>
>
>
> --
>
> ------------------------------____----------------------------__--__------------
>
>
> Guido Biele
> Email: g.p....@psykologi.uio.no
> <mailto:g.p....@psykologi.uio.no>
> Phone: +47 228 45172 <tel:%2B47%20228%2045172>
> Website
>
> <https://sites.google.com/a/____neuro-cognition.org/guido/home <https://sites.google.com/a/__neuro-cognition.org/guido/home>
>
> <https://sites.google.com/a/__neuro-cognition.org/guido/home
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>
>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
>
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>
>
> --
> Michael J Frank, PhD, Associate Professor
> Laboratory for Neural Computation and Cognition
> Brown University
> http://ski.clps.brown.edu
> (401)-863-6872 <tel:%28401%29-863-6872>
>
>
>
>
> --
> ------------------------------__------------------------------__------------
>
> Guido Biele
> Email: g.p....@psykologi.uio.no <mailto:g.p....@psykologi.uio.no>
> Phone: +47 228 45172 <tel:%2B47%20228%2045172>
> Website
> <https://sites.google.com/a/__neuro-cognition.org/guido/home
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
>
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>



--

Thomas Wiecki

unread,
Sep 12, 2012, 10:16:34 AM9/12/12
to hddm-...@googlegroups.com
On Wed, Sep 12, 2012 at 9:39 AM, Guido Biele <g.p....@psykologi.uio.no> wrote:
Thanks!

I think if one splits by stimulus type and uses response coded data, one has to fit separate drift rates for the 2 stimulus types. the problem with this is that it seems implausible to me that the drift rate should be allowed to have a different magnitude, dependent on stimulus. More pragmatically (and maybe more relevant to some) this allows that the bias effect is captured by the drift rates (such that the more frequently choose stimulus with a lower mean RT has a drift rate with a higher magnitude). This is especially unwelcome if you want to compare a model which assumes effect of bias-manipulation on bias of starting point with a model that assumes effect of bias-manipulation on drift rate.

Similarly, if one splits by stimulus and uses accuracy coded data, one allows for different magnitudes of |.5-z|, and I also think that it implausible that the magnitude of the bias should be allowed to vary dependent on stimulus type.


@data:
if the data are accuracy coded: can't one just calculate 2 likelihoods, one for stimulus A, and the other for stimulus B, whereby the likelihoods for RT distributions for A and B are generated from the same parameters, except for z which is set to z for one condition and to 1-z for the other condition?
I would have thought one approach is to first generate a model where z depends on stimulus type, and where one then deletes one knode for z. lets say z2, and replaces it with with 1-z2.
[this is admittedly all very general, and I don't know if it is possible at all to remove nodes and replace parameters in the likelihood function as easy as I am assuming. (with likelihood function i mean the function that gives me the likelihood of the oberved RT distribution given the model and the parameters.)]

That's a little hacky but it might work. Maybe the easiest way is to create a model with z depend on stim type and then use a new likelihood by overloading the knodes:
class KnodeWfptInvZ(Knode):
    def create_node(self, name, kwargs): #overloading original method
        if kwargs['z'].__name__.find('stim2'):
             kwargs['z_orig'] = copy(kwargs['z'])
             kwargs['z'] = 1-kwargs['z_orig']
        return selp.pymc_node(name=name, **kwargs)
And then replace Knode(wfpt, ...) with KnodeWfptInvZ(wfpt, ...) in your new model. This is pseudo code so it won't work out of the box but hopefully you get the idea.

Note that this requires the development branch of kabuki.

While this is a bit cleaner I think it's also easier than what you propose because rewiring an existing model could have some unforeseeable complications.

Thomas


                      Phone: +47 228 45172 <tel:%2B47%20228%2045172>
                      Website

         <https://sites.google.com/a/____neuro-cognition.org/guido/home <https://sites.google.com/a/__neuro-cognition.org/guido/home>

        <https://sites.google.com/a/__neuro-cognition.org/guido/home
        <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>



                      Visiting Address
                      Psykologisk Institutt
                      Forskningsveien 3 A
                      0373 OSLO



                       Mailing Address
                       Psykologisk Institutt
                       Postboks 1094
                       Blindern 0317 OSLO





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




            --

        ------------------------------____----------------------------__--__------------


             Guido Biele
             Email: g.p....@psykologi.uio.no
        <mailto:g.p.biele@psykologi.uio.no>

             Phone: +47 228 45172 <tel:%2B47%20228%2045172>
             Website

         <https://sites.google.com/a/____neuro-cognition.org/guido/home <https://sites.google.com/a/__neuro-cognition.org/guido/home>

        <https://sites.google.com/a/__neuro-cognition.org/guido/home
        <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>



             Visiting Address
             Psykologisk Institutt
             Forskningsveien 3 A
             0373 OSLO







              Mailing Address
              Psykologisk Institutt
              Postboks 1094
              Blindern 0317 OSLO






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




    --
    ------------------------------__------------------------------__------------

     Guido Biele

Guido Biele

unread,
Sep 13, 2012, 2:38:26 AM9/13/12
to hddm-...@googlegroups.com
thanks a lot.
I'll try to implement this here with oystein (who I think will also
soon send you some code for saving and loading models)

cheers - guido
> kwargs['z'] =1-kwargs['z_orig']
> return selp.pymc_node(name=name, **kwargs)|
> And then replace Knode(wfpt, ...) with KnodeWfptInvZ(wfpt, ...) in
> your new model. This is pseudo code so it won't work out of the box
> but hopefully you get the idea.
>
> Note that this requires the development branch of kabuki.
>
> While this is a bit cleaner I think it's also easier than what you
> propose because rewiring an existing model could have
> some unforeseeable complications.
>
> Thomas
>
>
> cheers - guido
>
>
> On Wed Sep 12 15:15:22 2012, Thomas Wiecki wrote:
>
> I'm not quite sure what'd be the best way to create a model
> like this.
> It certainly is possible to create a new knode like this:
> |Knode(pm.Deterministic,'z___inv', eval=lambda z:1-z, z=z_knode)|
> which would invert the z value. The problem is how to have
> part of the
> data use this node and other part of the data use the other.
>
> Remind me again why you can't use the hybrid approach for this?
>
> On Wed, Sep 12, 2012 at 8:31 AM, Guido Biele
> <g.p....@psykologi.uio.no
> <mailto:g.p....@psykologi.uio.no>
> <mailto:g.p.biele@psykologi.__uio.no
> <mailto:duno...@gmail.com> <mailto:duno...@gmail.com
> ------------------------------______--------------------------__--__--__------------
>
>
> Guido Biele
> Email:g.p....@psykologi.uio.____no
> <mailto:Email%3Ag.p.biele@__psykologi.uio.no
> <mailto:Email%253Ag....@psykologi.uio.no>>
>
> Phone: +47 228 45172
> <tel:%2B47%20228%2045172> <tel:%2B47%20228%2045172>
> Website
>
>
> <https://sites.google.com/a/______neuro-cognition.org/guido/__home
> <https://sites.google.com/a/____neuro-cognition.org/guido/home> <https://sites.google.com/a/____neuro-cognition.org/guido/home
> <https://sites.google.com/a/__neuro-cognition.org/guido/home>__>
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>__>
>
>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>
> --
> Michael J Frank, PhD, Associate Professor
> Laboratory for Neural Computation and Cognition
> Brown University
> http://ski.clps.brown.edu
> (401)-863-6872 <tel:%28401%29-863-6872> <tel:%28401%29-863-6872>
>
>
>
>
> --
>
>
> ------------------------------______--------------------------__--__--__------------
>
>
> Guido Biele
> Email: g.p....@psykologi.uio.no
> <mailto:g.p....@psykologi.uio.no>
> <mailto:g.p.biele@psykologi.__uio.no
> <mailto:g.p....@psykologi.uio.no>>
> Phone: +47 228 45172 <tel:%2B47%20228%2045172>
> <tel:%2B47%20228%2045172>
> Website
>
>
> <https://sites.google.com/a/______neuro-cognition.org/guido/__home
> <https://sites.google.com/a/____neuro-cognition.org/guido/home> <https://sites.google.com/a/____neuro-cognition.org/guido/home
> <https://sites.google.com/a/__neuro-cognition.org/guido/home>__>
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>__>
>
>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
>
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>
>
> --
> Michael J Frank, PhD, Associate Professor
> Laboratory for Neural Computation and Cognition
> Brown University
> http://ski.clps.brown.edu
> (401)-863-6872 <tel:%28401%29-863-6872> <tel:%28401%29-863-6872>
>
>
>
>
> --
>
> ------------------------------____----------------------------__--__------------
>
> Guido Biele
> Email: g.p....@psykologi.uio.no
> <mailto:g.p....@psykologi.uio.no>
> <mailto:g.p.biele@psykologi.__uio.no
> <mailto:g.p....@psykologi.uio.no>>
> Phone: +47 228 45172 <tel:%2B47%20228%2045172>
> <tel:%2B47%20228%2045172>
>
> Website
>
> <https://sites.google.com/a/____neuro-cognition.org/guido/home <https://sites.google.com/a/__neuro-cognition.org/guido/home>
>
> <https://sites.google.com/a/__neuro-cognition.org/guido/home
> <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>
>
> Visiting Address
> Psykologisk Institutt
> Forskningsveien 3 A
> 0373 OSLO
>
>
>
>
>
>
>
> Mailing Address
> Psykologisk Institutt
> Postboks 1094
> Blindern 0317 OSLO
>
>
>
>
>
>
>
>
> --
>
> ------------------------------__------------------------------__------------
>
> Guido Biele
> Email: g.p....@psykologi.uio.no <mailto:g.p....@psykologi.uio.no>

Thomas Wiecki

unread,
Sep 13, 2012, 9:19:02 AM9/13/12
to hddm-...@googlegroups.com
Very cool. Just let me know when you get stuck as this does require a fair amount of knowledge of not only python but also kabuki. In general, the Knodes are the description of how to create new nodes and create_node() is then called to create the actual pymc nodes as appropriate.

Thomas

        <mailto:g.p.biele@psykologi.uio.no>
        <mailto:g.p.biele@psykologi.__uio.no



                     Guido Biele
                     Email: g.p....@psykologi.uio.no
        <mailto:g.p.biele@psykologi.uio.no>
                <mailto:g.p.biele@psykologi.__uio.no

        <mailto:g.p.biele@psykologi.uio.no>>
        <mailto:g.p.biele@psykologi.uio.no>
        <mailto:g.p.biele@psykologi.__uio.no

        <mailto:g.p.biele@psykologi.uio.no>>

             Phone: +47 228 45172 <tel:%2B47%20228%2045172>
        <tel:%2B47%20228%2045172>

             Website

         <https://sites.google.com/a/____neuro-cognition.org/guido/home <https://sites.google.com/a/__neuro-cognition.org/guido/home>

        <https://sites.google.com/a/__neuro-cognition.org/guido/home
        <https://sites.google.com/a/neuro-cognition.org/guido/home>__>__>

             Visiting Address
             Psykologisk Institutt
             Forskningsveien 3 A
             0373 OSLO







              Mailing Address
              Psykologisk Institutt
              Postboks 1094
              Blindern 0317 OSLO








    --

    ------------------------------__------------------------------__------------

     Guido Biele
     Email: g.p....@psykologi.uio.no <mailto:g.p.biele@psykologi.uio.no>
Reply all
Reply to author
Forward
0 new messages