R/plot.simul.nfac.prior.R

Defines functions plot.simul.nfac.prior

#' @export
#' @importFrom ggplot2 ggplot aes_string geom_bar labs theme element_blank

plot.simul.nfac.prior <- function(x, ...)
{
  nfac <- summary(x)$nfac
  dat  <- data.frame(freq = unlist(nfac),
                     nfac = c(as.integer(sapply(nfac, names))),
                     lab  = rep(names(nfac), sapply(nfac, length)))

  ggplot(dat, aes_string(x = 'nfac', y = 'freq')) +
    geom_bar(aes_string(fill = 'lab'), position = 'dodge', stat = 'identity') +
    labs(x = 'number of factors', y = 'prior probability') +
    theme(legend.position  = 'bottom',
          legend.direction = 'horizontal',
          legend.title     = element_blank())
}

Try the BayesFM package in your browser

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

BayesFM documentation built on Nov. 19, 2021, 5:07 p.m.