R/posterior_array.R

#' Extract the posterior of a parameter
#'
#' Extracts and organizes the saved posterior samples for a given parameter, 
#' including parameters that are vectors and arrays.
#' 
#' @param output An object of class \code{jagsUI}.
#' @param parameter A parameter that was saved in the output samples.
#'
#' @return An array with one more dimension than the input parameter.
#' For example, if you saved 50 iterations, and the chosen parameter was
#' a 2x3 matrix, the resulting array will be 50x2x3.
#'
#' @export

posterior_array <- function(output, parameter){
 
  #Check input validity
  check_class(output)
  check_parameter(parameter, output$samples)
  
  get_posterior_array(parameter, output$samples)
}
kenkellner/jagsUI2 documentation built on July 5, 2019, 9:38 a.m.