GAMLj - plotting Random Effects in generalized mixed models

Everything related to the development of modules in jamovi

by shabde » Tue Dec 17, 2019 3:33 pm

I am using Generalized Mixed Models in GAMLj.
I want to plot interactions between a metric and a binary predictor when using a Logit link.
This works in principle, but as soon as my model contains a binary predictor, I cannot plot Random Effects any more. I always get the error "contrasts apply only to factors". Since the same is very well possible in a normal mixed model, I would guess that this is a bug - at least when plotting the logit ("linear predictor) on Y, also plotting random effects should always be possible.
shabde
 
Posts: 9
Joined: Thu Aug 29, 2019 7:53 pm

by mcfanda@gmail.com » Thu Jan 09, 2020 12:03 pm

Hi shabde
could you post an example of the issue so I can reproduce it and fix it?
thanks
mc
User avatar
mcfanda@gmail.com
 
Posts: 184
Joined: Thu Mar 23, 2017 9:24 pm

by shabde » Thu Jan 16, 2020 5:54 pm

Hi,
sorry my late reply, but I was a bit busy...
You can see an example in the attached file, but it also appears with other multi-level datasets.

So I have a dichotomous variable "Hall" which is a median split from the continuous variable "Halligkeit".
I have cluster sampling (variable "subject") , so I am using Mixed Models to predict both by T30 (Continuous) and Position (Binary/Factor).

As you can see in the output, in the continuous case ("Halligkeit"), I am able to plot fixed and random effects from the estimated model as charme. In the binary case ("Hall" with LogitLink), I am only able to plot random effects when I take "Position" out of the model. If I leave it in the model, I receive an error ("contrasts apply only to factors"),even when I just want to Plot T30 against Hall (actually I want to plot the interaction, but even the main effect fails). Apart from that, model estimation etc. works. So there seems to be a bug in the plot function for random effects. Or am I missing something?

Cheers,
Shabde
Attachments
gamljprobdemo.omv
(87.4 KiB) Downloaded 114 times
shabde
 
Posts: 9
Joined: Thu Aug 29, 2019 7:53 pm

by mcfanda@gmail.com » Mon Jan 20, 2020 11:41 am

Hi
I think you found a bug. I'm going to fix it within this week,
thanks
User avatar
mcfanda@gmail.com
 
Posts: 184
Joined: Thu Mar 23, 2017 9:24 pm

by mcfanda@gmail.com » Tue Jan 21, 2020 6:59 pm

In the meantime, you can use a dataset in which "Hall" is coded (not computed) and it should work
User avatar
mcfanda@gmail.com
 
Posts: 184
Joined: Thu Mar 23, 2017 9:24 pm

by mcfanda@gmail.com » Wed Jan 22, 2020 12:24 am

version 2.0.2 should fix this issue. It's out
User avatar
mcfanda@gmail.com
 
Posts: 184
Joined: Thu Mar 23, 2017 9:24 pm

by MAgojam » Wed Jan 22, 2020 10:14 am

mcfanda@gmail.com wrote:version 2.0.2 should fix this issue. It's out


Hi, Marcello.

[SO: Win10pro (Ita), jamovi: 1.2.2.0, GAMLj: 2.0.0]

I wanted to point out that at the moment jamovi library, sees and updates GAMLj to version 2.0.1.
To test version 2.0.2 (it works well) I downloaded it from github and compiled locally from RStudio.
Thanks for your work of updating and improving the module.

Cheers,
Maurizio
User avatar
MAgojam
 
Posts: 72
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

by mcfanda@gmail.com » Thu Jan 23, 2020 2:05 pm

Well, thanks. However, I noticed that there is a bug in lme4::predict.glmer such that if you plot the random effects of a continuous variable estimated in a model with also a categorical variable, the plot of the random effects is meaningless. This is because lme4::predict.glmer() predicted values cannot be computed keeping constant the other variables in the model (as the other R predict() functions do). I'M working on it now
User avatar
mcfanda@gmail.com
 
Posts: 184
Joined: Thu Mar 23, 2017 9:24 pm

by mcfanda@gmail.com » Thu Jan 23, 2020 8:39 pm

The issue comes about when the categorical variable is not balanced across groups of the cluster variable
User avatar
mcfanda@gmail.com
 
Posts: 184
Joined: Thu Mar 23, 2017 9:24 pm

by shabde » Wed Feb 05, 2020 6:37 pm

Thank you very much for fixing the issue in 2.0.2 - some of my students were very happy with finally being able to see their random effects also in the plot! :relaxed:
Thankfully, I just donated via Paypal 50 Dollars to you guys, because this is really a great feature that only few GUI-based software packages do so far! Congrats!

One other question, because I only just noticed it:
Is there a specific statistical reason that there is no LRT test for random effects in the GLMM, while in normal mixed model it is possible? Because I would think that in principle, LRT should also be feasible for GLMMs.
shabde
 
Posts: 9
Joined: Thu Aug 29, 2019 7:53 pm

Next

Return to Module development