strengejacke / ggeffects

Estimated Marginal Means and Marginal Effects from Regression Models for ggplot2
https://strengejacke.github.io/ggeffects
Other
544 stars 35 forks source link

Population-level predictions and GAMLSS #552

Closed pntoiv closed 3 months ago

pntoiv commented 3 months ago

Hey,

I am unable to get population level predictions for my GAMLSS model. I have specified random variable with random() function since it is the only way to specify random slope into GAMLSS model that predict_response() can use for calculating confidence intervals.

When I run predict_response I expect it to calculate population level by default, but it won't do so. It takes the reference level of my random factor.

predict_response(Mod_GP, terms="Sex") New way of prediction in random() (starting from GAMLSS version 5.0-6)

Predicted values of IslandDistance

Sex | Predicted | 95% CI

Female | 2884.50 | 1671.25, 4978.50 Male | 1808.30 | 1034.60, 3160.58

Adjusted for:

How can I get the population level predictions?

strengejacke commented 3 months ago

Do you have a reproducible example? In the meantime, maybe this helps: https://strengejacke.github.io/ggeffects/articles/introduction_randomeffects.html#population-level-predictions-for-gam-and-glmer-models

strengejacke commented 3 months ago

Do you have a reproducible example? In the meantime, maybe this helps: https://strengejacke.github.io/ggeffects/articles/introduction_randomeffects.html#population-level-predictions-for-gam-and-glmer-models

pntoiv commented 3 months ago

Do you have a reproducible example? In the meantime, maybe this helps: https://strengejacke.github.io/ggeffects/articles/introduction_randomeffects.html#population-level-predictions-for-gam-and-glmer-models

I think this explains it all! Thanks! I remember actually coming upon this same thing last year with mgcv package and found the solution from that same page.