Skip to content

Use modelbased posterior predictions in check_predictions() for Bayesian models#898

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-check-predictions-bayesian-models
Draft

Use modelbased posterior predictions in check_predictions() for Bayesian models#898
Copilot wants to merge 2 commits intomainfrom
copilot/update-check-predictions-bayesian-models

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 13, 2026

check_predictions() still routed stanreg/brmsfit models through bayesplot::pp_check() and then reshaped the result into a special Stan-specific format. This updates the Bayesian path to use the easystats prediction stack directly so Bayesian models produce the same posterior predictive-check data shape and plotting behavior as other supported models.

  • Bayesian prediction path

    • Replace the bayesplot::pp_check() branch in check_predictions.stanreg() with modelbased::estimate_prediction(..., keep_iterations = TRUE).
    • Convert retained posterior draws from iter_* to the standard sim_* columns used elsewhere by check_predictions().
    • Preserve existing metadata (response_name, model_info, type, bandwidth, check_range) and back-transform simulated draws when the response is transformed.
  • Output contract

    • Remove the Stan-specific discrete reshaping (x / Group / Count with is_stan = TRUE).
    • Return Bayesian posterior predictive data in the same wide format as other methods: replicated draws plus observed response.
  • Coverage and docs

    • Add focused regression tests for continuous and discrete Bayesian models to assert the standardized output shape and attributes.
    • Update package version, NEWS entry, and check_predictions() documentation to reflect the new Bayesian implementation.

Example of the new Bayesian data contract:

out <- check_predictions(model, iterations = 5)

names(out)
# [1] "sim_1" "sim_2" "sim_3" "sim_4" "sim_5" "y"

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • easystats.github.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Agent-Logs-Url: https://github.com/easystats/performance/sessions/8f6f86ac-dce2-4dd7-ab79-6115b8855b4d

Co-authored-by: DominiqueMakowski <8875533+DominiqueMakowski@users.noreply.github.com>
Copilot AI changed the title [WIP] Update check_predictions() to use custom prediction capabilities Use modelbased posterior predictions in check_predictions() for Bayesian models Apr 13, 2026
Copilot AI requested a review from DominiqueMakowski April 13, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check_predictions() for Bayesian models should use our own prediction/plotting capabilities

2 participants