@@ -14,7 +14,7 @@ print.bgmCompare = function(x, ...) {
1414 prior_msg = switch (
1515 as.character(arguments $ difference_prior ),
1616 " Bernoulli" = " Bayesian Difference Selection (Bernoulli prior on inclusion)" ,
17- " Beta-Bernoulli" = " Bayesian Difference Selection (Beta– Bernoulli prior on inclusion)" ,
17+ " Beta-Bernoulli" = " Bayesian Difference Selection (Beta- Bernoulli prior on inclusion)" ,
1818 " Bayesian Difference Selection"
1919 )
2020 cat(prior_msg , " \n " )
@@ -96,7 +96,6 @@ summary.bgmCompare = function(object, ...) {
9696}
9797
9898
99- # ' @export
10099# ' @export
101100print.summary.bgmCompare = function (x , digits = 3 , ... ) {
102101 cat(" Posterior summaries from Bayesian grouped MRF estimation (bgmCompare):\n\n " )
@@ -127,12 +126,32 @@ print.summary.bgmCompare = function(x, digits = 3, ...) {
127126
128127 if (! is.null(x $ indicator )) {
129128 cat(" Inclusion probabilities:\n " )
130- print_df(x $ indicator , digits )
129+ ind <- head(x $ indicator , 6 )
130+
131+ # round only numeric columns
132+ ind [] <- lapply(ind , function (col ) {
133+ if (is.numeric(col )) {
134+ round(col , digits )
135+ } else {
136+ col
137+ }
138+ })
139+
140+ # replace NA with empty string for printing
141+ ind [] <- lapply(ind , function (col ) {
142+ ifelse(is.na(col ), " " , col )
143+ })
144+
145+ print(ind , row.names = FALSE )
131146 if (nrow(x $ indicator ) > 6 )
132147 cat(" ... (use `summary(fit)$indicator` to see full output)\n " )
133148 cat(" \n " )
149+ cat(" Note: NA values are suppressed in the print table. They occur when an indicator\n " )
150+ cat(" was constant (all 0 or all 1) across all iterations, so sd/mcse/n_eff/Rhat\n " )
151+ cat(" are undefined; `summary(fit)$indicator` still contains the NA values.\n\n " )
134152 }
135153
154+
136155 if (! is.null(x $ main_diff )) {
137156 cat(" Group differences (main effects):\n " )
138157 print_df(x $ main_diff , digits )
@@ -166,13 +185,13 @@ print.summary.bgmCompare = function(x, digits = 3, ...) {
166185# ' @return A list with components:
167186# ' \describe{
168187# ' \item{main_effects_raw}{Posterior means of the raw main-effect parameters
169- # ' (variables × [baseline + differences]).}
188+ # ' (variables x [baseline + differences]).}
170189# ' \item{pairwise_effects_raw}{Posterior means of the raw pairwise-effect parameters
171- # ' (pairs × [baseline + differences]).}
190+ # ' (pairs x [baseline + differences]).}
172191# ' \item{main_effects_groups}{Posterior means of group-specific main effects
173- # ' (variables × groups), computed as baseline plus projected differences.}
192+ # ' (variables x groups), computed as baseline plus projected differences.}
174193# ' \item{pairwise_effects_groups}{Posterior means of group-specific pairwise effects
175- # ' (pairs × groups), computed as baseline plus projected differences.}
194+ # ' (pairs x groups), computed as baseline plus projected differences.}
176195# ' \item{indicators}{Posterior mean inclusion probabilities as a symmetric matrix,
177196# ' with diagonals corresponding to main effects and off-diagonals to pairwise effects.}
178197# ' }
0 commit comments