Mixed model Module freeze

Discuss the jamovi platform, possible improvements, etc.
alancai1974
Posts: 28
Joined: Sat May 16, 2020 1:19 pm

Mixed model Module freeze

Post by alancai1974 »

Hi:
I have some problem when I use the mixed model module under GAMlj. when I use only a few covariate, It works fine. But when I Select around 10 Covariate, And click on the move Button, it become freeze for quite long time. I know it takes a while to do the calculation. But in the bluesky, the same calculation take about 1 minute. In jamovi, However, the window is freezing after more than 5 minutes. Is this a bug of the program?
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed model Module freeze

Post by mcfanda@gmail.com »

Hi
I can try to check if it's a bug or just R taking its time if you share an example of models that create the problem.
thanks
mc
alancai1974
Posts: 28
Joined: Sat May 16, 2020 1:19 pm

Re: Mixed model Module freeze

Post by alancai1974 »

I send the omv file to your Gmail address. Please take a look at that. Thanks
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed model Module freeze

Post by mcfanda@gmail.com »

Hi
I've tried the model you sent (with ten covariates), and on my computer (a standard laptop) takes about 1 second to run. That is with intercept and tightness also as random (please notice that the model is almost singular, due to the correlation between the random effects being -1).
If you tried to add other random effects and the calculation became abnormally long, it's probably (almost certainly) because the model does not converge
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed model Module freeze

Post by mcfanda@gmail.com »

Adding 5 random effects takes about 3 minutes, but the model is again singular. Please notice that gamlj mixed module, when the model is singular or does not converge, tries to change the optimizer to get better results, so it re-estimates the model again for each optimizer (there're three available). This can slow down the output appearance.

Nonetheless, I've also tried your model in R and both lmer() and Anova() are very fast with two random effects, and extremely slow when you add other random effects. Also in R you get a singular model. So I tend to exclude that we have a bug.
alancai1974
Posts: 28
Joined: Sat May 16, 2020 1:19 pm

Re: Mixed model Module freeze

Post by alancai1974 »

Thank you. I'm just wondering that, when this happened, is that possible for the program to show a warning, and give user the option to terminate the program if necessary. The biggest problem here is we don't know what happens when it freezes. It will be good to know and then take action appropriately.
hayaku
Posts: 7
Joined: Thu Aug 13, 2020 5:08 pm

Re: Mixed model Module freeze

Post by hayaku »

I concur. I have come here specifically due to this bug

Perhaps some form of loading % gauge would be helpful, with an opportunity to interrupt should the analysis be unfeasible? I recently tried to add variables one-by-one, and the load time went from <1 sec to 10 min+ as soon as the variables went from 4 to 5 or 6. I had assumed it was frozen so terminated the program. It was unresponsive, and canceling the analysis did not restore functionality (I had to Ctl+Alt+Del and terminate).
alancai1974
Posts: 28
Joined: Sat May 16, 2020 1:19 pm

Re: Mixed model Module freeze

Post by alancai1974 »

Here is an update on this issue. I run the model using gamlj package directly in Rstudio. It turns out that the problem is caused by scaling. My data has been centered before I run the analysis. If I do not use scaling option in the gamljMixed function, it will run very fast. But if scaling option is added, it runs very slow, and come with warning “fixed-effect model matrix is rank deficient so dropping 1 column / coefficient”. The problem is that, by default, the module centers the variables. That’s what caused the problem for me: it tries to center the already centered data. And each time when I try to add a variable, it will do the calculation again, which cause more delay and freeze Jamovi.
My suggestion is the following: 1. By default, do not center the data in this module; 2. While recalculating the model automatically when we add a variable is convenient, this could also cause problems if calculation takes a long time. You may want to have option to let user turn off this feature if they want.
User avatar
mcfanda@gmail.com
Posts: 457
Joined: Thu Mar 23, 2017 9:24 pm

Re: Mixed model Module freeze

Post by mcfanda@gmail.com »

Hi
this does not add up, because if variables are already centered, results of centering or not centering should be the same. Which model did you run, is it this? Ln_fire ~ 1 + Time + Ln_disrupt + Ln_disrupt:Time+( 0+Time | stateID )
alancai1974
Posts: 28
Joined: Sat May 16, 2020 1:19 pm

Re: Mixed model Module freeze

Post by alancai1974 »

I just email you the r code and my data. Thanks
Post Reply