Page 1 of 2

GAMLj - plotting Random Effects in generalized mixed models

Posted: Tue Dec 17, 2019 3:33 pm
by shabde
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.

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Thu Jan 09, 2020 12:03 pm
by mcfanda@gmail.com
Hi shabde
could you post an example of the issue so I can reproduce it and fix it?
thanks
mc

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Thu Jan 16, 2020 5:54 pm
by shabde
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

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Mon Jan 20, 2020 11:41 am
by mcfanda@gmail.com
Hi
I think you found a bug. I'm going to fix it within this week,
thanks

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Tue Jan 21, 2020 6:59 pm
by mcfanda@gmail.com
In the meantime, you can use a dataset in which "Hall" is coded (not computed) and it should work

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Wed Jan 22, 2020 12:24 am
by mcfanda@gmail.com
version 2.0.2 should fix this issue. It's out

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Wed Jan 22, 2020 10:14 am
by MAgojam
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

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Thu Jan 23, 2020 2:05 pm
by mcfanda@gmail.com
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

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Thu Jan 23, 2020 8:39 pm
by mcfanda@gmail.com
The issue comes about when the categorical variable is not balanced across groups of the cluster variable

Re: GAMLj - plotting Random Effects in generalized mixed mod

Posted: Wed Feb 05, 2020 6:37 pm
by shabde
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.