-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with check_model() for Stan models #354
Comments
Here is an example of the issues: library(performance)
model_stan <- rstanarm::stan_glm(mpg ~ wt + cyl, data = mtcars)
model_brms <- brms::brm(mpg ~ wt + cyl, data = mtcars)
model_brms_wPrior <- brms::brm(mpg ~ wt + cyl, data = mtcars, sample_prior = "yes")
model_lm <- lm(mpg ~ wt + cyl, data = mtcars)
model_glm <- glm(mpg ~ wt + cyl, data = mtcars)
check_stan <- check_model(model_stan)
check_brms <- check_model(model_brms) # need to sample priors
check_brms_wPrior <- check_model(model_brms_wPrior) # stil fails due to improper priors
check_lm <- check_model(model_lm)
check_glm <- check_model(model_glm)
plot(check_stan) # fails
plot(check_lm)
plot(check_glm) |
I would agree to your suggestions. My only question is, if the "typical" plots created by |
This comment was marked as outdated.
This comment was marked as outdated.
I'm thinking that Residuals plots, VIF, and normality plots absolutely. These same assumptions apply to linear models regardless of the inference framework. Influence plots should probably use a Bayesian analogue to Cook's distance or a pointwise LOO-IC--there are some papers and existing functions I found yesterday we can draw on there. The stopgap of converting to a frequentist model for now should be generally reasonable for common cases. |
btw, @DominiqueMakowski, this doc needs some more love, I think ;-) |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I think this is that urgent, since we can already add layers of prior samples to the plot: |
I'm not exactly what the thinking is behind the current behavior of
check_model()
for Stan models. It calls the internal functionperformance:::.check_assumptions_stan()
. This returns a data frame with columns Group (Prior or Posterior), y (parameter), x (value), and id (posterior draw).I'm not exactly sure what sort of plot this is intended to be used for (perhaps a scatterplot matrix for the various parameters across posterior draws?). Could someone elaborate? @strengejacke @mattansb? Nevertheless, it is really different from the results for lm/glm models, where a list with the various diagnostic data frames is returned. This produces several problems:
see::plot.see_check_model()
fails forcheck_model(stan_model)
objectsperformance:::.check_assumptions_stan()
.There is no way for users to generate the typical regression model diagnositic plots, such as fitted-residual plots, qq plots, etc.
The current
performance:::.check_assumptions_stan()
function fails often forbrmsfit
modelssample_priors = "no"
(default), it stops. It could instead return a data frame with just the posterior.This leads to 2 big questions:
What should
check_model()
do for Stan models?pp_check()
)?What should we do in the mean time?
bayestestR::convert_bayesian_as_frequentist()
, then callcheck_model()
on that. I think this would be an okay stopgap until we implement the individual plots for stan objects.Thoughts?
The text was updated successfully, but these errors were encountered: