drizopoulos / GLMMadaptive

GLMMs with adaptive Gaussian quadrature
https://drizopoulos.github.io/GLMMadaptive/
60 stars 14 forks source link

Error message "No valid set of coefficients has been found" #55

Closed MarcelCSchmitt closed 2 months ago

MarcelCSchmitt commented 3 months ago

Dear Dimitris, I would like to run a GLMM using a gamma distribution with two predictors, including a random intercept and a random slope for one predictor. The syntax is the following:

mixed_model(fixed = mom_posnonEG ~ 1 + mom_posnonEG_cen_lag + pain_cen, random = ~ 1 + pain_cen | Mastercode, data = dat_lag_pos2, family = Gamma(link = "log"))

Right after I run the model, I get the error message: "Error: no valid set of coefficients has been found: please supply starting values". It does not even start computing, it sends the error message right away. The problem is the variable "mom_posnonEG_cen_lag". If I remove it, the model is running, but whenever the model contains this variable (no matter if I remove the other predictor and the random slope), the problem occurs. Of course, I checked for typos etc. I tried to implement some starting values, like:

mixed_model(fixed = mom_posnonEG ~ 1 + mom_posnonEG_cen_lag + pain_cen, random = ~ 1 + pain_cen | Mastercode, data = dat_lag_pos2, family = Gamma(link = "log"), initial_values = list(betas = c(0,0), D = matrix(c(0.5,0,0,0.1))))

However, I still get the same error message immediately. I would be very helpful if you could give me some suggestions in how to remedy this problem.

Best, Marcel

drizopoulos commented 2 months ago

As the error message suggests, you should try setting your own initial values for the optimization algorithm via the initial_values argument of mixed_model().