-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support multidimensional dists / rvars in point_interval #111
Comments
I've pushed an update to I think this is the last issue preventing |
Cool sounds good, I'll push a minor release of {ggdist} soon to ensure forward compatibility with {distributional} and then prioritize this issue in the next major release. |
@mitchelloharawild ggdist 3.0.1, which should be forward-compatible with the new {distributional}, is on its way to cran. Please let me know if you run into any issues with it and I will push a new version. |
@mitchelloharawild I'm working through some last issues in prep for a new release and I want to make sure I hit the couple of things you need, including this one. Is there anything else not on this milestone that would be helpful? |
@mitchelloharawild a potential solution to this is now on master: the library(ggplot2)
library(dplyr)
library(distributional)
library(ggdist)
tibble(
x = c(
dist_multivariate_normal(list(c(1:4)), list(diag(4))),
dist_normal()
),
y = c("a","b")
) %>%
median_qi(x, .width = c(.66, .95))
#> # A tibble: 10 x 8
#> x y .index .lower .upper .width .point .interval
#> <dbl> <chr> <int> <dbl> <dbl> <dbl> <chr> <chr>
#> 1 1 a 1 0.0458 1.95 0.66 median qi
#> 2 2 a 2 1.05 2.95 0.66 median qi
#> 3 3 a 3 2.05 3.95 0.66 median qi
#> 4 4 a 4 3.05 4.95 0.66 median qi
#> 5 0 b NA -0.954 0.954 0.66 median qi
#> 6 1 a 1 -0.960 2.96 0.95 median qi
#> 7 2 a 2 0.0400 3.96 0.95 median qi
#> 8 3 a 3 1.04 4.96 0.95 median qi
#> 9 4 a 4 2.04 5.96 0.95 median qi
#> 10 0 b NA -1.96 1.96 0.95 median qi Created on 2022-01-16 by the reprex package (v2.0.1) This can be used with (e.g.) tibble(
x = dist_multivariate_normal(list(c(1:4)), list(diag(4))),
y = c("a","b")
) %>%
median_qi(x, .width = c(.66, .95)) %>%
ggplot(aes(x, xmin = .lower, xmax = .upper, y = .index)) +
geom_pointinterval() Created on 2022-01-16 by the reprex package (v2.0.1) Or since tibble(
x = c(
dist_multivariate_normal(list(c(1:4)), list(diag(4))),
dist_normal()
),
y = c("a","b")
) %>%
ggplot(aes(xdist = x, y = y, group = stat(.index))) +
stat_pointinterval(position = "dodge") Created on 2022-01-16 by the reprex package (v2.0.1) Some limitations:
Let me know if this is sufficient for what you need. I think this is the last issue before I draft a new release. |
Pinging off of #14 (comment)
Probably add a column for the index
The text was updated successfully, but these errors were encountered: