From 820b22bc20c1ff5b0d76aa35a51f72d1c88e72e5 Mon Sep 17 00:00:00 2001 From: Schick Date: Mon, 22 Jul 2024 14:27:26 +0200 Subject: [PATCH] - added new if-clause to getPosterior() to check if prior_list is object of RBesT package --- R/posterior.R | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/R/posterior.R b/R/posterior.R index efe2226..5aa6d2d 100644 --- a/R/posterior.R +++ b/R/posterior.R @@ -45,6 +45,11 @@ getPosterior <- function( checkmate::check_vector(S_hat, any.missing = FALSE, null.ok = TRUE) checkmate::check_double(S_hat, null.ok = TRUE, lower = 0, upper = Inf) + is_matrix_S_hat <- FALSE + + stopifnot("prior_list must be an object of RBesT package" = + all(sapply(prior_list, function(x) is(x, "normMix") | is(x, "betaMix") | is(x, "mix")))) + if (!is.null(mu_hat) && !is.null(S_hat) && is.null(data)) { if (is.matrix(S_hat)) { @@ -142,9 +147,10 @@ getPosteriorI <- function( } else if (!is.null(mu_hat) && !is.null(se_hat)) { stopifnot("m_hat length must match number of dose levels" = - length(prior_list) == length(mu_hat), - "se_hat length must match number of dose levels" = - length(prior_list) == length(se_hat)) + length(prior_list) == length(mu_hat)) + # , + # "se_hat length must match number of dose levels" = + # length(prior_list) == length(se_hat)) } else {