Best approach to derive Bayesian p-values in HSSM #690
Replies: 2 comments 3 replies
-
|
Hi, I just wanted to follow up on this issue -- any update on this? Thanks so much! |
Beta Was this translation helpful? Give feedback.
-
|
Hey @cuddenberg sorry for the delay, some initial responses,
Thanks for you interested in HSSM. We are trying hard to expand the coverage of our docs with more and more extended examples. If you figure out a workflow that works for you independently, please know that we are very happy to receive contributed tutorials and will acknowledge you appropriately! Best, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all!
I'm new to HSSM and using it to model data from a two forced choice task (data from the experiment is published in papers such as this, building off of the project mentioned in previous post #473. Similar to #421, #287 and #314, I'm hoping to confirm we understand proper HSSM experimental inference, i.e., the right way to use HSSM to test for significant differences in DDM parameters among study factors.
We’re modelling 2 factors in a value-based decision-making experiment, where participants decide whether to keep (response = -1) or discard (response = 1) items:
2 VALUE categories (items displayed can either be ‘TRASH’ or ‘VALUE’; this is a within-subjects factor where everyone has both conditions)
2 GROUP categories (’HD’ or ‘HC’; a between-groups factor)
Previously, we used HDDM on this dataset. Now, we would like to use HSSM to validate those results in preparation for publication, while also capitalizing on HSSM’s ability to test for mixed between/within effects. So our questions here are to make sure we’re correctly testing for significant differences between our two study groups, for experimental conditions, or the between-within interaction effects.
In order to model the data, I used contrast coding to define the levels of each categorical variable: GROUP: HD (-0.5) and HC (0.5); VALUE: VALUE (0.5) and TRASH (-0.5).
Question 1: Is this model instantiated correctly to test for the effects of VALUE and GROUP on each DDM parameter?
lvl = [-0.5, 0.5]
model1 = hssm.HSSM(
model="ddm",
data=hd_data_subset,
extra_namespace={"lvl1": lvl1},
prior_settings = "safe",
include=[
{
"name": "v",
"formula": "v ~ C(group, levels=lvl1) * C(value, levels=lvl1)",
"link": "identity",
},
{
"name": "a",
"formula": "a ~ C(group, levels=lvl1) * C(value, levels=lvl1)",
"link": "identity",
},
{
"name": "z",
"formula": "z ~ C(group, levels=lvl1) * C(value, levels=lvl1)",
"link": "identity",
},
],
)
If anyone sees problems with the model, it would be great to correct our usage here before moving to inference. Next, to extract Bayesian P values for the GROUP, VALUE and interaction effects after sampling, we use the resulting model inference object to test whether the posterior distribution of the interaction term coefficient is > 0. (Previously in HDDM, we subtracted the two traces for each parameter (e.g., TRASH - VALUE) and tested whether the difference > 0.)
Question 2: Is testing the posterior distribution of the coefficient term this way the best approach to derive Bayesian p-values in HSSM? If so, is below the right code to compute this for the terms (e.g., in this example, the interaction)?
model1_idata = az.extract(model1_sample)
v_interaction_term = model1_idata['v_C(group, levels=lvl1):C(value, levels=lvl1)'].values
bayesian_p = (v_interaction_term > 0).mean()
Question 3: Are there any useful code snippets/other ways using HSSM/ArviZ/Bambi to conduct other Bayesian inference tests like testing whether one parameter is significant from 0 (e.g., az.plot_bpv)? Or, just anything we’re missing?
To expand, we foresee a need to maybe do post hoc checks on some individual conditions to make useful points (e.g., whether or not z significantly differs from .5 for each of the groups, etc)… things that just add interpretive context. Because HSSM adds capabilities relative to HDDM, we didn’t want to assume that the old “HDDM way” of testing for effects was the only approach, if indeed there are new and useful alternatives. And, having examples of successful syntax tailored to HSSM for various approaches can be very helpful.
As soon as we get confidence we’re approaching inference correctly, we plan to move on to using the model parameters to simulate data and do posterior predictive checks as our last step before writing this all up. So we might follow up with further questions. Thanks so much for your time!
Beta Was this translation helpful? Give feedback.
All reactions