is this the correct sintaxis to fit? #664
Replies: 5 comments 4 replies
-
Hi Maria,
This is correct for the default hssm configuration for hierarchical models,
which uses a 'non-centered' parameterization. This means that you estimate
the group mean as the intercept for each parameter and then the random
effects are just offsets from that mean. So a negative value just means
that this person has a lower value than the group mean.
One can also formulate the same model in centered parameterization by
setting noncentered=false and then writing each formula as y ~ 0 +
(1+distortion|partID)
in that case you will obtain a mu for the 1|id and distortion|ID that would
be the group means and the individual IDs would have their own parameters
drawn from that mean, and none should be negative. But in this case the
specification of priors would be done a bit differently. See eg discussion
#570 <#570> but we should
have a tutorial on this difference quite soon.
Michael
Michael J Frank, PhD | Edgar L. Marston Professor
Director, Carney Center for Computational Brain Science
<https://www.brown.edu/carney/ccbs>
Laboratory of Neural Computation and Cognition <https://www.lnccbrown.com/>
Brown University
website <http://ski.clps.brown.edu>
…On Fri, Feb 21, 2025 at 8:04 AM mariadafon ***@***.***> wrote:
Hi, I am trying to fit my decision-making data that shows the typical
behavior (rt is high in the middle of the 'coherence' (distortion here) and
low in the extremes, response follows a psychometric curve) with
hierarchical ddm models. One of the models I tried was:
model_hierarchical = hssm.HSSM(
data=df,include=[{"name":"v","formula":"y ~ 1 + distortion + (distortion|partID)"},
{"name":"a","formula":"y ~ 1 + (1|partID)"},
{"name":"z","formula":"y ~ 1 + (1|partID)"},
{"name":"t","formula":"y ~ 1 + (1|partID)"}],
prior_settings="safe")
with the version 0.2.5 of hssm. Is it correct? Because some of the random
effects of the non-decision time are negative.
Thanks in advance.
Best!
—
Reply to this email directly, view it on GitHub
<#664>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG7TFENCSBLVOTCUE5HMM32Q4P6LAVCNFSM6AAAAABXTGDXY2VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXHE4TQNBVHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
You should be able to simulate results from each model just using the
posterior predictive functions within HSSM which will automatically
parameterize it according to the defined model. I just realized that is not
one of the things demonstrated in the tutorial but we will add it very soon
- @alexander Fengler ***@***.***> can help for now to
give you the syntax.
Also looking back at your original model definition I realized that it
looks like you only included random effects for the distortion effect on
the drift rate but not you should also include a 1+ to get the overall
random effect.
ie change
"name":"v","formula":"y ~ 1 + distortion + (distortion|partID)
to:
"name":"v","formula":"y ~ 1 + distortion + (1 + distortion|partID)
…On Mon, Feb 24, 2025 at 11:40 AM mariadafon ***@***.***> wrote:
Thanks for the information! To understand the problem, I simulated data
using the full hierarchical model, the fixed effects from the hierarchical
model and a non-hierarchical model. The non-hierarchical simulations
resembles more like the data that the others, then comes the simulations
with the fixed effects from the hierarchical model. At last, simulated
response from the full hierarchical model looks like random points and the
rt are very low in comparison with data points.
Here, the part of the code I use to simulate data using results from the
full hierarchical model:
a_arr = np.full(len(distortion_values), fixed_effect['a_Intercept'] + random_effect['a_1'])
z_arr = np.full(len(distortion_values), fixed_effect['z_Intercept'] + random_effect['z_1'])
t_arr = np.full(len(distortion_values), fixed_effect['t_Intercept'] + random_effect['t_1'])
v_arr = np.empty((len(distortion_values)))
for i,d in enumerate(distortion_values):
v_arr[i] = (
fixed_effect['v_Intercept'] + random_effect['v_1'] +
(fixed_effect['v_distortion'] + random_effect['v_distortion']) * d
)
theta_params = dict(v=v_arr, a=a_arr, z=z_arr, t=t_arr)
sim_data = hssm.simulate_data(
model="ddm",
theta=theta,
size=1,
)
to see if you can see any mistake in the simulations.
Best!
María
—
Reply to this email directly, view it on GitHub
<#664 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG7TFFMWTHNNU5V54IOMHD2RNDQLAVCNFSM6AAAAABXTGDXY2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMZQGMYTIMA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@mariadafon would you mind sending us a more complete code snippet here? |
Beta Was this translation helpful? Give feedback.
-
Hi! Getting back to the hierarchical model fit, some of the starting points are greater than 1 (while explicit bounds are btw 0 and 1) and maybe this explains the short reaction times in the simulations. Any idea about what could it happen? |
Beta Was this translation helpful? Give feedback.
-
Hi @AlexanderFengler , all the problems disappeared with @frankmj recommendation "One can also formulate the same model in centered parameterization by |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am trying to fit my decision-making data that shows the typical behavior (rt is high in the middle of the 'coherence' (distortion here) and low in the extremes, response follows a psychometric curve) with hierarchical ddm models. One of the models I tried was:
with the version 0.2.5 of hssm. Is it correct? Because some of the random effects of the non-decision time are negative.
Thanks in advance.
Best!
Beta Was this translation helpful? Give feedback.
All reactions