Replies: 4 comments 1 reply
-
Hi Eduard, Thanks for bringing this to our attention! It seems that the issue is that lvl = ['cond_B', 'cond_A']
model = hssm.HSSM(data=data, model="ddm", include=[ {
"name": "v",
"formula": "v ~ 1 + C(drug, levels=lvl)",
"link": "identity"
}], extra_namespace={"lvl": lvl}) This helps bambi find the list that you specified the formula. Let me know if this works :) |
Beta Was this translation helpful? Give feedback.
-
Thanks Paul,
just a small edit here as I was trying something similar, and found it to
work if I do
extra_namespace= {"lvl": lvl}
instead of
extra_namespace: {"lvl": lvl}
ie just replace ":" with "=" since this is not a dictionary entry.
M
…On Tue, Aug 8, 2023 at 7:31 PM Paul Xu ***@***.***> wrote:
Hi Eduard,
Thanks for bringing this to our attention! It seems that the issue is that
lvl is not found when the formula is created from within HSSM. bmb.Model
has extra_namespace argument which helps it find this variable. So what
you need to do is something like this:
lvl = ['cond_B', 'cond_A']model = hssm.HSSM(data=data, model="ddm", include=[ {
"name": "v",
"formula": "v ~ 1 + C(drug, levels=lvl)",
"link": "identity"
}], extra_namespace: {"lvl": lvl})
This helps bambi find the list that you specified the formula.
Let me know if this works :)
—
Reply to this email directly, view it on GitHub
<#261 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG7TFF6VODBEYNNQ4F3VXLXULD4BANCNFSM6AAAAAA3JBVKHQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thanks both of you. That does do the trick! |
Beta Was this translation helpful? Give feedback.
-
This is important for group comparisons as most psych experiments involve a mixed design and categorical variables (e.g., experimental conditions). I suggest including a tutorial specifically addressing the issue of categorical variables, OR the "Bayesian (group-difference hierarchical) test" or "estimating the impact of condition as a within-subject effect in the same model" mentioned in this discussion #421 |
Beta Was this translation helpful? Give feedback.
-
Hi all!
I am trying to set up a regression with a categorical variable, which works fine as far as I see. Unfortunately though, the default way the model is set up, puts the experimental condition in the intercept, and the baseline condition in the slope. For interpretation purposes it would be much nicer to change them around. However, I can't make seem to make this work at the moment.
From reading the
bambi
docs, the reason is that they alphabetically sort the levels of the categorical variable when constructing the model. They allow, however, custom orderings by specifying thelevels
parameter in the model specification. When I try this withhssm
, this fails with following error message:When I try this directly in bambi, it works though:
So it seems like the variable
lvl
is not passed on to bambi/formulae, to change the ordering?Is this the right way to approach this problem? If so, could this be a problem with hssm?
I hope I am making sense here.
Thanks again for this great tool!
Eduard
Beta Was this translation helpful? Give feedback.
All reactions