Skip to content

Commit 84a52e2

Browse files
authored
Promote rfx_beta_draws to array with consistent dimensions
Ensure rfx_beta_draws has consistent dimensions when there's one rfx term.
1 parent bb77a17 commit 84a52e2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

R/bart.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,11 @@ predict.bartmodel <- function(
22192219
rfx_param_list <- object$rfx_samples$extract_parameter_samples()
22202220
rfx_beta_draws <- rfx_param_list$beta_samples * y_std
22212221

2222+
# Promote to an array with consistent dimensions when there's one rfx term
2223+
if (length(dim(rfx_beta_draws)) == 2) {
2224+
dim(rfx_beta_draws) <- c(1, dim(rfx_beta_draws))
2225+
}
2226+
22222227
# Construct a matrix with the appropriate group random effects arranged for each observation
22232228
rfx_predictions_raw <- array(
22242229
NA,

0 commit comments

Comments
 (0)