Skip to content

Plotly with halfeye plots for bayesian posterior probabilities #1667

Closed
@albertocarm

Description

@albertocarm

It would be nice if these graphs could be interactive to show the bayesian posterior probability.
The user should get the area to the right of point x (probability of effect great than x)
Is that possible?

library(tidyr)
library(tidybayes)
library(ggplot2)
set.seed(1234)
pp2<-tribble(
  ~y,    ~x, 
  
  "a1", exp(rnorm(8000, 0.16, 0.04)),
  "a2", exp(rnorm(8000, 0.24, 0.1)),
  "b1", exp(rnorm(8000, 0.24, 0.1)),
  "b2", exp(rnorm(8000, 0.24, 0.1)),
  "c1", exp(rnorm(8000, 0.16, 0.04)),
  "c2", exp(rnorm(8000, 0.19, 0.09)),
  "c3", exp(rnorm(8000, 0.18, 0.07)),
  "d1", exp(rnorm(8000, 0.16, 0.04)),
  "d2", exp(rnorm(8000, 0.24, 0.08)),
  "d3", exp(rnorm(8000, 0.17, 0.09)),
  "d4", exp(rnorm(8000, 0.2, 0.1)),
) %>%
  unnest(x) %>%
  ggplot(aes(x, y ) ) +
  geom_halfeyeh()+
  geom_vline(xintercept = c( 1), linetype = "dashed") +
  scale_fill_manual(values = c("blue", "gray80"), limits=c(0.1,0.7) ) + theme_tidybayes()
ggplotly(pp2) # doest not work


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions