Binary Outcomes in GAMLJ3 - No way to pick reference group

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
nickschweitzer
Posts: 8
Joined: Fri Jul 31, 2020 11:35 pm

Binary Outcomes in GAMLJ3 - No way to pick reference group

Post by nickschweitzer »

I've been doing some work with generalized linear models (in the GAMLJ3 module). I noticed that the module seems to pick the reference group for a binary outcome using some method that is impossible to change, and somehow persists even when recoding the variables. For example, in a DV of 1s and 0s, I would want the model to predict the likelihood of 1s (p1/p0), but it does the opposite (p0/p1). As there is no way that I can see to change the reference group in the options, I simply reverse coded the variable. I don't know how, but now the model has adjusted itself so that it is suddenly predicting 1s (which is again the opposite of what I want). No matter what I code the DV as -- numbers, text, etc -- the model chooses one specific group as its reference. So I guess I'm wondering a) what's going on, and b) can it be changed so that the user can choose a reference group (similar to what is implemented in the logistic regression menu)?
Pius
Posts: 1
Joined: Mon Dec 30, 2024 4:33 pm

Re: Binary Outcomes in GAMLJ3 - No way to pick reference group

Post by Pius »

In the https://gamlj.github.io/book/

In section 3.2.3 Model Recap
"GAMLj models the probability of being in the group with the “largest” label value, after ordering the value labels. In our case, it models the probability of being in group ybin=1 over the probability of being in group ybin=0. This is indicated in the direction row of the table."

From the https://gamlj.github.io/book/gzlm.html#logistic
nickschweitzer
Posts: 8
Joined: Fri Jul 31, 2020 11:35 pm

Re: Binary Outcomes in GAMLJ3 - No way to pick reference group

Post by nickschweitzer »

Right -- as I said in my post, it's not doing that.

I run a model with 1 and 0 as my outcome, and I get the following:

Model Type Logistic Model Model for binary y
Model lme4::glmer Outcome ~ 1 + Credible_PL + ( 1 | Case )
Distribution Binomial Dichotomous event distribution of y
Link function Logit Log of the odd of y
Direction P(y=1)/P(y=0) P( Outcome = 0 ) / P( Outcome = 1 )

Then I literally just reverse code the DV, and I get...

Model Type Logistic Model Model for binary y
Model lme4::glmer OutcomeREVERSE ~ 1 + Credible_PL + ( 1 | Case )
Distribution Binomial Dichotomous event distribution of y
Link function Logit Log of the odd of y
Direction P(y=1)/P(y=0) P( OutcomeREVERSE = 1 ) / P( OutcomeREVERSE = 0 )

As you can see, it seems to be switching the reference group when I reverse code.
User avatar
reason180
Posts: 355
Joined: Mon Jul 24, 2017 4:56 pm

Re: Binary Outcomes in GAMLJ3 - No way to pick reference group

Post by reason180 »

It appears that the ordering of the two levels of your dichotomous dependent variable determines the 'direction' of the computation. You can easily reorder the levels as illustrated below. (And if it so happens that your dependent variable is a computed variabe, I believe the ordering is determined by the order in which the two levels are created.)
-
levels.png
levels.png (136.3 KiB) Viewed 196 times
nickschweitzer
Posts: 8
Joined: Fri Jul 31, 2020 11:35 pm

Re: Binary Outcomes in GAMLJ3 - No way to pick reference group

Post by nickschweitzer »

Oh interesting. And now that you say it, that makes sense given it treats that variable as nominal (and so doesn't assume anything about the 1/0 label). That definitely is it -- thank you so much for looking into it.
Post Reply