Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ndunnewind committed Oct 2, 2024
1 parent c26e457 commit c028028
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions R/relative_effects.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,6 @@ relative_effects <- function(x, newdata = NULL, study = NULL,
}
} else {

# Name columns to match Stan parameters
colnames(X_EM) <- paste0("beta[", colnames(X_EM), "]")
colnames(X_d) <- paste0("d[", x$network$treatments[-1], "]")

# Split baseline risk meta-regression from other effect modifiers
brmr <- grepl("\\.mu:", colnames(X_EM)) & is.null(newdata)
X_BRMR <- X_EM[, brmr, drop = FALSE]
Expand Down Expand Up @@ -433,6 +429,15 @@ relative_effects <- function(x, newdata = NULL, study = NULL,
X_EM[nonzero] <- X_study_means_rep[nonzero]
}

# Name columns to match Stan parameters
if (ncol(X_EM) > 0) {
colnames(X_EM) <- paste0("beta[", colnames(X_EM), "]")
}
if (ncol(X_BRMR) > 0) {
colnames(X_BRMR) <- paste0("beta[", colnames(X_BRMR), "]")
}
colnames(X_d) <- paste0("d[", x$network$treatments[-1], "]")

X_EM_d <- cbind(X_EM, X_d)

# Name rows by treatment for now (required for make_all_contrasts)
Expand Down

0 comments on commit c028028

Please sign in to comment.