Closed hummuscience closed 1 month ago
This might also be related to #301
@Cumol is this still broken if you use conf
instead of C(conf)
?
Yes, that solves it. I started declaring the categorical columns a-priori for now and omitting the C(). This works for now.
If I understand it correctly, if the variable in not categorical in the data frame, and we want it to be categorical, then the C() is necessary.
I think it all breaks though when one wants to use an intercept and define the reference group with Treatment coding, C(var, reference = 'control')
Or am I mistaken?
Ok great! I don't have an immediate answer to the remaining question, will cycle back (or someone knowledgeable chimes in first) :).
If you want to use a reference condition you can use "levels", where the first entry is the reference condition.
e.g.: for example of cav_data:
cav_data = hssm.load_data('cavanagh_theta')
lvl = ['WL', 'LL', 'WW']
and then when defining the hssm model you use "C(stim, levels=lvl)". example below because it requires adding the "extra_namespace" to allow bambi to find the list specified in the formula.
model = hssm.HSSM( model="ddm", data=cav_data, loglik_kind="approx_differentiable", include = [ { "name": "v", "formula": "v ~ 1 + C(stim, levels=lvl)", "link": "identity", }, { "name": "z", "formula": "z ~ 0 + (1|subj_idx)", "link": "identity", }, { "name": "a", "formula": "a ~ 0 + (1|subj_idx)", "link": "identity", }, ], extra_namespace= {"lvl": lvl}, )
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 Wed, Oct 25, 2023 at 12:05 AM Alexander Fengler @.***> wrote:
Ok great! I don't have an immediate answer to the remaining question, will cycle back (or someone knowledgeable chimes in first) :).
— Reply to this email directly, view it on GitHub https://github.com/lnccbrown/HSSM/issues/302#issuecomment-1778471564, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG7TFEWTO2JBV3BR3FLSCLYBCFXPAVCNFSM6AAAAAA6HOK5CGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZYGQ3TCNJWGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Describe the bug I have a dataset with 3 categorical predictors that I am trying to fit a DDM to. I am getting weird errors. Either on the model creation side or when running the sampling. In this case, its the sampling. I might be misunderstanding parts of how to write a correct formula (and not finding information about it).
However, if I add an intercept by replacing 0 with 1 in the formula, all works well
HSSM version Linux machine, python 3.9, latest HSSM
To Reproduce I renamed subj_idx in the cav data with participant_id in this example.
Gives the following error: