R/jagsfilter_function.R

Defines functions jagsfilter

Documented in jagsfilter

#' @title jagsfilter
#' @description Used internally to filter jags results to give just the inference well use.
#' @param mcmcresults is the input from the jags model.


jagsfilter <- function(mcmcresults){

  probabilities <- c(0.025, 0.975)

  pull <- t(apply(do.call(rbind, mcmcresults), 2, function(f) {
    c(mean=mean(f), sd=sd(f), quantile(f, probabilities))
  }))


  pull <- pull[,c('mean', '2.5%', '97.5%')]
  return(pull)
}
adbecker/tsiR documentation built on Oct. 1, 2019, 5:32 p.m.