lnccbrown / HSSM

Development of HSSM package
Other
82 stars 11 forks source link

Drift rate parameter 'v' not estimated properly #528

Closed Lipika-T closed 3 months ago

Lipika-T commented 3 months ago

Describe the bug I am trying to fit a drift diffusion model to a letter search task with 2 target letters (2 choice). There's a conditioning variable - "Emotion" in the dataset with 3 levels and 48 trials per level, and the accuracy in the task is around 95%. I first used correct trials with the 2 target letters as the thresholds and the drift rates are very small (close to 0) and also often negative with large standard deviation. I then tried using all the trials with "correct" and "incorrect" as the 2 thresholds. The z value in this case is not biased towards the correct threshold. The non decision time values also seem large given that the RT values range from around 0.54 to 1.4 seconds in this participant.

HSSM version '0.2.3'

To Reproduce simple_ddm_model_reg_v = hssm.HSSM( data=df, model="ddm", hierarchical = False, include=[ { "name": "v", "formula": "v ~ 0 + (1|Emotion)", }, { "name": "a", }, { "name": "z", }, { "name": "t", }, ], ) Screenshots Example dataset and model parameters from one participant. Screenshot from 2024-08-01 11-33-33 Screenshot from 2024-08-01 11-39-30 Screenshot from 2024-08-01 11-49-22 Screenshot from 2024-08-01 11-56-46

SaschaFroelich commented 3 months ago

Hi,

I then tried using all the trials with "correct" and "incorrect" as the 2 thresholds.

As far as I understand your question, this means you had 95% / 5% response proportions, right? This can be problematic and result in spurious estimates, especially of drift rate and non-decision time. Response proportions should ideally be balanced out, or contain at least 10-15% of the less common response, as far as I know.

Best, Sascha

Lipika-T commented 3 months ago

Yes, that's right. But that should not be a problem when we keep the 2 target letters as the bounds right? Each of the letter occurs 50% of the time. 'model_summary2' has the estimates from the model using these bounds but the estimates don't seem to make sense.

frankmj commented 3 months ago

When you make the two bounds the target letters, then you need something like the equivalent of stimcoding in HDDM. Here the overall drift rate across all trials of each emotion level should be 0 assuming that you have equal trials in which the bound should hit each letter. So you would need to have a stimulus column that tells the model which response should have been made for that stimulus and have v modeled as a function of that. eg if you coded stim as simply 1 and -1 then v ~ stim should give positive coefficients for stim. This can then interact with Emotion condition if you want.

Also you should not really model Emotion as coming from a hierarchical distribution but rather just another term (e.g. v~ stim +stimEmotion (you can have this modeled hierarchically across subjects, but that is a separate issue - that would be v ~1 + stim+ stimEmotion +(1+stim+stim*Emotion|partipant_id).

In principle one could assume that different emotion conditions within a subject are themselves drawn from an overarching distribution but if you only have 3 conditions that is not sufficient to estimate the overarching sigma (Gelman recommends at least 5 would be needed).

This likely isn't really an "issue" as much as a "discussion" so we should probably switch it over on github

M

On Fri, Aug 2, 2024 at 10:39 AM Lipika-T @.***> wrote:

Yes, that's right. But that should not be a problem when we keep the 2 target letters as the bounds right? Each of the letter occurs 50% of the time. 'model_summary2' has the estimates from the model using these bounds but the estimates don't seem to make sense.

— Reply to this email directly, view it on GitHub https://github.com/lnccbrown/HSSM/issues/528#issuecomment-2265551791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG7TFHFRJF77ATAOQWJEYDZPOK35AVCNFSM6AAAAABLZ4BBVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRVGU2TCNZZGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>