#' CPO - Conditional Predictive Ordinate - for rsmd
#'
#' \code{cpo_fc} calculates the sum of logarithm of CPO.
#'
#' @param matrix.cpo n.sys by n.size matrix cointaining CPO values for n.sys systems in n.size posterior sample. Result from \code{\link{MWG}}
#'
#' @return sum of log of CPO.
#' @export
#'
cpo_fc <- function(matrix.cpo){
cpo.i <- rep(NA,dim(matrix.cpo)[1])
for (i in 1:dim(matrix.cpo)[1]){
out <- (1/dim(matrix.cpo)[2])*sum(1/matrix.cpo[i,])
cpo.i[i] <- 1/out
}
CPO.comp <- sum(log(cpo.i))
return(CPO.comp)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.