Replies: 1 comment
-
Hello @prank24, Thanks for trying out HSSM! When you specify a formula for a parameter, then that parameter becomes the target of a regression, and you would no longer be able to specify a prior for that parameter. Instead, you would need to specify priors for the independent variables. This tutorial might be helpful for you, especially if you are specifying interactions as well. Please let us know if you have any other questions. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear hssm community,
I'm running into persistent trouble assigning custom priors to parameters when using a formula in the include argument of hssm.HSSM. I have tried both the stable and the latest dev version (with prior_settings="safe"), but the issue remains.
I want to specify a custom prior for the drift rate (v) when modeling it as a function of an interaction (e.g., v ~ 0 + C(C2):C(stim)). Here is a minimal working example:
model_x = hssm.HSSM(
data=participant_data,
model="ddm",
include=[
{
"name": "v",
"formula": "v ~ 0 + C(C2):C(stim)",
"link": "identity",
"prior": {"name": "Normal", "mu": 2.0, "sigma": 2.0}
},
],
prior_settings="safe"
)
When I check the model summary, the prior for v is still set to the default (Normal(mu: 0.0, sigma: 0.25)), and my custom prior is ignored.
However, if I remove the formula and just specify the prior, it works as expected.
I have also tried using the hssm.Param class (but this does not seem to allow both a formula and a custom prior per term):
params = [
hssm.Param(
name="v",
prior=hssm.Prior("Normal", mu=0.0, sigma=3.0),
formula="v ~ 0 + C(C2):C(stim)", # Interaction formula
link="identity"
),
hssm.Param(
name="a",
prior=hssm.Prior("Gamma", alpha=2.0, beta=1.0)
),
hssm.Param(
name="t",
prior=hssm.Prior("Gamma", alpha=2.0, beta=4.0)
)
]
model_x = hssm.HSSM(
data=participant_data,
model="ddm",
include=params
)
This leads to - TypeError: 'Prior' object is not iterable
Questions:
Is there a correct way to assign priors to all terms generated by a formula in the include argument?
Is this a bug, or am I missing something about how priors should be specified with formulas?
Are there any workarounds or examples of this working as intended?
Any help or clarification would be greatly appreciated!
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions