rethinkpriorities / squigglepy

Squiggle programming language for intuitive probabilistic estimation features in Python
MIT License
65 stars 8 forks source link

integrate Jamie's percentogram and other visualization tools in Squigglepy or a different standalone plotting lib #42

Open peterhurford opened 1 year ago

peterhurford commented 1 year ago

https://statmodeling.stat.columbia.edu/2023/04/13/the-percentogram-a-histogram-binned-by-percentages-of-the-cumulative-distribution-rather-than-using-fixed-bin-widths/

Unfortunately these are in R so they'd have to be ported to Python

Context: Jamie works at Rethink Priorities

peterhurford commented 1 year ago

Code: https://github.com/Jimbilben/jimbilben/blob/master/R/make_percentogram_x.R

my_vector <- rnorm(100000)

my_perc_data <- make_percentogram_x(my_vector, percent = 5, percentile_range = "quintile")

ggplot(my_perc_data) +
  geom_rect(aes(xmin = xmin, ymin = ymin, xmax = xmax, ymax = ymax, fill = quintile), color = "white")