diff --git a/R/bgm.R b/R/bgm.R index b4207af7..28aa98b4 100644 --- a/R/bgm.R +++ b/R/bgm.R @@ -544,7 +544,8 @@ bgm = function(x, thresholds = thresholds, allocations = out$allocations, arguments = arguments) class(output) = "bgms" - summary_Sbm = summarySBM(output) + summary_Sbm = summarySBM(output, + internal_call = TRUE) output$components = summary_Sbm$components output$allocations = summary_Sbm$allocations diff --git a/R/posterior_utils.R b/R/posterior_utils.R index a203b4d0..71336b78 100644 --- a/R/posterior_utils.R +++ b/R/posterior_utils.R @@ -92,6 +92,9 @@ compute_p_k_given_t = function( #' number of clusters. #' #' @param bgm_object A fit object created by the bgm function. +#' @param internal_call A logical value indicating whether the function is used +#' within bgms for calculating the posterior probabilities of the number of +#' clusters or by the user. This argument is always set to FALSE. #' @return Returns a list of two elements: \code{components} and \code{allocations}, #' containing the posterior probabilities for the number of components (clusters) #' and the estimated cluster allocation of the nodes using Dahl's method. @@ -107,14 +110,15 @@ compute_p_k_given_t = function( #' } #' @export summarySBM = function( - bgm_object) { + bgm_object, + internal_call = FALSE) { arguments = extract_arguments(bgm_object) if(arguments$edge_prior != "Stochastic-Block") stop('The bgm function must be run with edge_prior = "Stochastic-Block".') - if(arguments$save == FALSE) + if(arguments$save == FALSE && internal_call == FALSE) stop('The bgm function must be run with save = TRUE.') cluster_allocations = bgm_object$allocations diff --git a/man/bgms-package.Rd b/man/bgms-package.Rd index 9d43313c..07b7026c 100644 --- a/man/bgms-package.Rd +++ b/man/bgms-package.Rd @@ -68,6 +68,7 @@ Useful links: Other contributors: \itemize{ + \item Giuseppe Arena (\href{https://orcid.org/0000-0001-5204-3326}{ORCID}) [contributor] \item Karoline Huth (\href{https://orcid.org/0000-0002-0662-1591}{ORCID}) [contributor] \item Nikola Sekulovski (\href{https://orcid.org/0000-0001-7032-1684}{ORCID}) [contributor] \item Don van den Bergh (\href{https://orcid.org/0000-0002-9838-7308}{ORCID}) [contributor] diff --git a/man/summarySBM.Rd b/man/summarySBM.Rd index 15e6769c..01109dda 100644 --- a/man/summarySBM.Rd +++ b/man/summarySBM.Rd @@ -4,10 +4,14 @@ \alias{summarySBM} \title{Function for summarizing the sampled cluster allocation vectors} \usage{ -summarySBM(bgm_object) +summarySBM(bgm_object, internal_call = FALSE) } \arguments{ \item{bgm_object}{A fit object created by the bgm function.} + +\item{internal_call}{A logical value indicating whether the function is used +within bgms for calculating the posterior probabilities of the number of +clusters or by the user. This argument is always set to FALSE.} } \value{ Returns a list of two elements: \code{components} and \code{allocations},