Created
July 15, 2019 03:42
-
-
Save deanmarchiori/10a1485f2254bc59e06eb457579f854b to your computer and use it in GitHub Desktop.
Easy Beta distribution plots in base R - auto scaling axes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beta_plot <- function(shape_1 = 1, shape_2 = 1, | |
x_min = qbeta(0.0001, shape_1, shape_2), | |
x_max = qbeta(0.9999, shape_1, shape_2)){ | |
x <- seq(x_min, x_max, length.out = 1000) | |
y <- dbeta(x, shape_1, shape_2) | |
plot(x, y, | |
type = "l", | |
ylab = "density", | |
xlab = "probability", | |
main = paste0("Beta(", shape_1, ", ", shape_2, ")")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment