Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion R/bgm.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions R/posterior_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions man/bgms-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/summarySBM.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading