R/prior_post_plot.R

Defines functions prior_post_plot

Documented in prior_post_plot

prior_post_plot <- function(d, Color = "orange"){
   N <- dim(d)[1]
   Size <- 100 / N
   Size <- ifelse(Size > 15, 15, Size)
   Size <- ifelse(Size < 2, 2, Size)
   Model <- rep(d[, 1], 2)
   Probability <- c(d$Prior, d$Posterior)
   Type <- c(rep("Prior", N), rep("Posterior", N))
   D1 <- data.frame(Model, Probability, Type)
   ggplot(D1, aes(Model, Probability)) +
     geom_segment(aes(xend = Model, yend = 0), size = Size,
               lineend = "butt", color = Color) +
     facet_wrap(~ Type, ncol=1) +
      theme(legend.position = "none")
}

Try the ProbBayes package in your browser

Any scripts or data that you put into this service are public.

ProbBayes documentation built on March 13, 2020, 1:31 a.m.