Skip to content
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

Fix q column in tidy_ distribution functions #169

Closed
spsanderson opened this issue May 5, 2022 · 0 comments · Fixed by #171
Closed

Fix q column in tidy_ distribution functions #169

spsanderson opened this issue May 5, 2022 · 0 comments · Fixed by #171
Assignees
Labels
bug Something isn't working

Comments

@spsanderson
Copy link
Owner

spsanderson commented May 5, 2022

Currently the "quantile" plot will produce the same line for all simulations of a given tidy_ distribution because q is calculated incorrectly. It uses a single simulation instead of a zero one scaling of the current y value from the random variate function.

Example:

tidy_poisson(.num_sims = 3) %>%
  tidy_autoplot(.plot_type = "quantile")

image

Currently for at least tidy_poisson() the q value is calculated as such:

dplyr::mutate(q = list(stats::qpois(qs, lambda = lambda)))

It should be:

dplyr::mutate(q = list(stats::qpois(tidy_scale_zero_one_vec(unlist(y)), lambda = lambda)))

Which would give the following:
image

@spsanderson spsanderson added the bug Something isn't working label May 5, 2022
@spsanderson spsanderson added this to the TidyDensity v1.1.0 milestone May 5, 2022
@spsanderson spsanderson self-assigned this May 5, 2022
spsanderson added a commit that referenced this issue May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant