From eb92c50696251f668e14f358415fcce748299a89 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Thu, 20 Jun 2024 11:09:08 +0200 Subject: [PATCH 1/3] Ensure arm-level aux_regression terms are included in predict (fix #43) --- R/predict.R | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/R/predict.R b/R/predict.R index 5db3354b..8a429c8c 100644 --- a/R/predict.R +++ b/R/predict.R @@ -1704,7 +1704,23 @@ predict.stan_nma <- function(object, ..., if (!aux_int) { #(length(setdiff(object$aux_by, c(".study", ".trt"))) == 0) { aux_s <- grepl(paste0("\\[(", paste(aux_l, collapse = "|"), if (object$likelihood %in% c("mspline", "pexp")) ")," else ")\\]"), dimnames(aux_array)[[3]]) - aux_array_s <- aux_array[ , , aux_s, drop = FALSE] + + # Add in arm-level aux regression terms, if present + if (!is.null(object$aux_regression)) { + if (object$likelihood %in% c("mspline", "pexp", "gengamma")) { + aux_array_s <- make_aux_predict(aux = aux_array[ , , aux_s, , drop = TRUE], + beta_aux = beta_aux, + X_aux = X_aux[ss[1], , drop = FALSE], + likelihood = object$likelihood) + } else { + aux_array_s <- make_aux_predict(aux = aux_array[ , , aux_s, drop = FALSE], + beta_aux = beta_aux, + X_aux = X_aux[ss[1], , drop = FALSE], + likelihood = object$likelihood) + } + } else { + aux_array_s <- aux_array[ , , aux_s, drop = FALSE] + } } else { # Aux regression or stratified aux pars within arm, need to expand these out over the individuals/integration points From 6eb378c828d8f3ed406decf4168b383dae4f37b2 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Thu, 20 Jun 2024 11:49:57 +0200 Subject: [PATCH 2/3] Correct aux_array spec for flexible models --- R/predict.R | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/R/predict.R b/R/predict.R index 8a429c8c..79a44674 100644 --- a/R/predict.R +++ b/R/predict.R @@ -1707,17 +1707,10 @@ predict.stan_nma <- function(object, ..., # Add in arm-level aux regression terms, if present if (!is.null(object$aux_regression)) { - if (object$likelihood %in% c("mspline", "pexp", "gengamma")) { - aux_array_s <- make_aux_predict(aux = aux_array[ , , aux_s, , drop = TRUE], - beta_aux = beta_aux, - X_aux = X_aux[ss[1], , drop = FALSE], - likelihood = object$likelihood) - } else { - aux_array_s <- make_aux_predict(aux = aux_array[ , , aux_s, drop = FALSE], - beta_aux = beta_aux, - X_aux = X_aux[ss[1], , drop = FALSE], - likelihood = object$likelihood) - } + aux_array_s <- make_aux_predict(aux = aux_array[ , , aux_s, drop = FALSE], + beta_aux = beta_aux, + X_aux = X_aux[ss[1], , drop = FALSE], + likelihood = object$likelihood) } else { aux_array_s <- aux_array[ , , aux_s, drop = FALSE] } From 309ccb9ca8930c33967b1e3bd40cac2d15692293 Mon Sep 17 00:00:00 2001 From: David Phillippo Date: Thu, 20 Jun 2024 15:05:09 +0200 Subject: [PATCH 3/3] Update news, bump dev version --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 397e7c87..624c22b5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: multinma Title: Bayesian Network Meta-Analysis of Individual and Aggregate Data -Version: 0.7.1.9000 +Version: 0.7.1.9001 Authors@R: person(given = c("David", "M."), family = "Phillippo", diff --git a/NEWS.md b/NEWS.md index a8e6ec5c..14a21e76 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # multinma 0.7.1.9000 +* Fix: Predictions for non-proportional hazards IPD NMA or ML-NMR survival +models using `aux_regression = ~.trt` were incorrectly omitting the treatment +effects on the auxiliary parameter(s) in some cases (#43). + # multinma 0.7.1 * Fix: Producing survival/hazard/cumulative hazard predictions for survival