GAMLj - plotting Random Effects in generalized mixed models
GAMLj - plotting Random Effects in generalized mixed models
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.
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.
- mcfanda@gmail.com
- Posts: 462
- Joined: Thu Mar 23, 2017 9:24 pm
Re: GAMLj - plotting Random Effects in generalized mixed mod
Hi shabde
could you post an example of the issue so I can reproduce it and fix it?
thanks
mc
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
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
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 904 times
- mcfanda@gmail.com
- Posts: 462
- Joined: Thu Mar 23, 2017 9:24 pm
Re: GAMLj - plotting Random Effects in generalized mixed mod
Hi
I think you found a bug. I'm going to fix it within this week,
thanks
I think you found a bug. I'm going to fix it within this week,
thanks
- mcfanda@gmail.com
- Posts: 462
- Joined: Thu Mar 23, 2017 9:24 pm
Re: GAMLj - plotting Random Effects in generalized mixed mod
In the meantime, you can use a dataset in which "Hall" is coded (not computed) and it should work
- mcfanda@gmail.com
- Posts: 462
- Joined: Thu Mar 23, 2017 9:24 pm
Re: GAMLj - plotting Random Effects in generalized mixed mod
version 2.0.2 should fix this issue. It's out
Re: GAMLj - plotting Random Effects in generalized mixed mod
Hi, Marcello.mcfanda@gmail.com wrote:version 2.0.2 should fix this issue. It's out
[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
- mcfanda@gmail.com
- Posts: 462
- Joined: Thu Mar 23, 2017 9:24 pm
Re: GAMLj - plotting Random Effects in generalized mixed mod
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
- mcfanda@gmail.com
- Posts: 462
- Joined: Thu Mar 23, 2017 9:24 pm
Re: GAMLj - plotting Random Effects in generalized mixed mod
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
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!
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.
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.