stan-dev / stan-dev/bayesplot

Trying to use function ppc_stat_grouped() on data including NAs

Open
#236 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

Hello everyone,

I would like to use the function ppc_stat_grouped() on data that includes NAs.

model_subj_shift_brm %>% posterior_predict(draws = 5) %>% ppc_stat_grouped(y = df_all_subjects$answer, group = df_all_subjects$diagnosis, stat = "median")

I get the following error:
Error: NAs not allowed in 'y'.

I tried deleting NAs in that column:
model_subj_shift_brm %>% posterior_predict(draws = 5) %>% ppc_stat_grouped(y = na.omit(df_all_subjects$answer), group = df_all_subjects$diagnosis, stat = "median")

I get the following error message:
Error: 'y' must be a vector or 1D array.

Thank you for any advice on how to run this function.
Juliane

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

Reproduce the supplied posterior_predict() and ppc_stat_grouped() calls with the NA-containing data, then inspect the ppc_stat_grouped() input validation and grouping behavior. No source files or tests are named; done would require a decided, tested behavior for missing values or a clear explanation of the supported input requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.