Skip to content

Commit

Permalink
Fix survival prediction with extra variables in newdata
Browse files Browse the repository at this point in the history
  • Loading branch information
dmphillippo committed Dec 1, 2023
1 parent 00a60d1 commit 2ef5a50
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -1170,13 +1170,6 @@ predict.stan_nma <- function(object, ...,
}
}

# Check all variables are present
predreg <- get_model_data_columns(preddat,
regression = object$regression,
aux_regression = object$aux_regression,
keep = object$aux_by,
label = "`newdata`")

preddat$.sample_size <- 1

# Check times argument
Expand Down Expand Up @@ -1227,6 +1220,13 @@ predict.stan_nma <- function(object, ...,
}
}

# Check all variables are present
preddat <- get_model_data_columns(preddat,
regression = object$regression,
aux_regression = object$aux_regression,
keep = object$aux_by,
label = "`newdata`")

# Make design matrix of all studies and all treatments
if (rlang::has_name(preddat, ".trt")) preddat <- dplyr::select(preddat, -".trt")
if (packageVersion("dplyr") >= "1.1.1") {
Expand Down

0 comments on commit 2ef5a50

Please sign in to comment.