library(ggplot2)
library(dplyr)
df = data.frame(
y = factor(c(rep(0, 2000), rep(1, 500))),
prob = c(rnorm(2000, 0.4, 0.1), rnorm(500, 0.6, 0.1))
)
# Distribution of Predicted Probability with ggplot
ggplot(df, aes(x=prob, fill=y)) +
geom_histogram(position="identity",alpha=0.3, binwidth=0.02)