R/WaicCompare.R

Defines functions WaicCompare

Documented in WaicCompare

#' Compare WAIC
#' 
#' Compare Widely Applicable Information Criterion
#' 
#' @param outlist List of NetworkChange objects
#'
#' @return Results of WAIC computation
#' 
#' @seealso \code{\link{MarginalCompare}}
#' 
#' @return A matrix of log marginal likelihoods.
#' 
#' @references 
#' Sumio Watanabe. 2010. "Asymptotic equivalence of Bayes cross validation and widely
#' applicable information criterion in singular learning theory."
#' \emph{Journal of Machine Learning Research}. 11: 3571-3594.
#' 
#' Andrew Gelman, Jessica Hwang, and Aki Vehtari. 2014. "Understanding predictive information
#' criteria for Bayesian models." \emph{Statistics and Computing}. 24(6):997-1016.
#'
#' Jong Hee Park and Yunkyun Sohn. 2020. "Detecting Structural Change
#' in Longitudinal Network Data." \emph{Bayesian Analysis}. Vol.15, No.1, pp.133-157.

#' @export
#' 
WaicCompare <- function(outlist){
    N.model <- length(outlist)
    breaks <- lapply(outlist, attr, "m")
    outl <- lapply(outlist, attr, "Waic.out")
    outm <- matrix(unlist(outl), N.model, 8, byrow=TRUE)
    out <- matrix(outm[,1], 1, N.model)
    colnames(out) <- paste0("break ", breaks) 
    return(out)
}    

Try the NetworkChange package in your browser

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

NetworkChange documentation built on March 18, 2022, 7:52 p.m.