stan-dev / stan-dev/bayesplot

`ppc_error_scatter_avg()` should be able to plot residuals as function of predicted y, not y

Open
#350 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
442
Forks
93
Avg merge
3h 11m
Merged PRs (30d)
1

Description

(Notation below: $y$ is data value, $y_{pred}$ is predicted value, with $y_{pred}$ computed as $stat(y_{rep})$ from posterior draws.)

The usual residual analysis plots $y - y_{pred}$ on the vertical axis with $y_{pred}$ on the horizontal axis.

But ppc_error_scatter_avg() plots $y - y_{pred}$ on the vertical axis with $y$ on the horizontal axis. This is confusing and difficult to interpret (for me, but I'm not alone: https://stats.stackexchange.com/a/146002).

I would be great if ppc_error_scatter_avg() plotted $y_{pred}$ on the horizontal axis, either by default or with that as an option. (Or maybe there's already an easy way to do that; sorry if I missed it.)

Thanks for considering!

P.S. My comment here assumes that $y_{pred}$ is computed as $stat(y_{rep})$ from posterior draws. But the related thread regarding residuals https://github.com/stan-dev/bayesplot/pull/349 seems to suggest that residuals are computed as $stat(y - y_{rep})$, with $stat(y_{rep})$ not separately, explicitly computed. Hmmm...?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ppc_error_scatter_avg() entry point and review the related residuals discussion in pull request #349. Determine whether the horizontal axis should use y_pred directly or whether the residual definition also needs clarification. Done means the plot supports the requested predicted-y presentation with documented, interpretable behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.