Skip to content

ppc_error_scatter_avg_vs_x, has unstable residuals when the noise distribution has heavy tails; needs median not mean? #348

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

Open
kruschke opened this issue May 13, 2025 · 2 comments · May be fixed by #349

Comments

@kruschke
Copy link

brms::pp_check(type = "error_scatter_avg_vs_x"), which calls bayesplot::ppc_error_scatter_avg_vs_x, has residuals that vary wildly from one run to the next when the noise distribution (family) is a Student $t$ distribution with small nu (aka df).

I suspect the problem is caused by the "average" being computed as the mean, which gets wildly distorted by outliers generated by the kurtotic noise distribution. I suspect the problem would be greatly ameliorated if the average could instead be computed as the median. But there seems to be no option for this, while some of the brms functions do have an argument robust = TRUE.

The linked HTML (and .Rmd) file has two examples, identical to each other except the first example uses data from a highly kurtotic $t$ distribution, while the second example used data from an essentially normal $t$ distribution.
HTML: https://drive.google.com/file/d/1aGwO9i7RuXQoVVzkHkV4wC02uqKs43ys/view?usp=drive_link
.Rmd: https://drive.google.com/file/d/1ksRr_2VOgMornK3s_Dk5sA0xoKPOywRA/view?usp=drive_link

@tjmahr tjmahr linked a pull request May 13, 2025 that will close this issue
@tjmahr
Copy link
Collaborator

tjmahr commented May 13, 2025

Thanks for the issue. (Fan of your book with the dogs!)

I submitted a patch #349 to let users override the mean function via fun_avg argument.

@jgabry
Copy link
Member

jgabry commented May 14, 2025

Thanks @kruschke, I agree we should provide an option to for using other functions for averaging. Thanks @tjmahr for the PR. Will review soon.

@tjmahr tjmahr linked a pull request May 16, 2025 that will close this issue
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 a pull request may close this issue.

3 participants