Novartis / RBesT

Tool-set to support Bayesian evidence synthesis in R
https://opensource.nibr.com/RBesT/
GNU General Public License v3.0
19 stars 2 forks source link

Error when computing the ELIR of normal mixture priors with zero weight on one component #18

Open TristanFauvel opened 2 weeks ago

TristanFauvel commented 2 weeks ago

Hello,

Thanks for the great package. I noticed that computing the ESS of a mixture prior using the ELIR method leads to the following error when the weight of one component is set to 0:

Error in if (all(dmix(mix_comp_identity, support(mix_comp_identity)) ==  : 
  missing value where TRUE/FALSE needed

Minimal example to reproduce the issue :

w <- 1

component_1 = c(
  w,
  0.2,
  0.1
)

component_2 = c(
  1 - w,
  0,
  1.5
)

prior <- RBesT::mixnorm(
  component_1 =  component_1,
  component_2 = component_2
)

ess(prior, method = "elir", sigma = 0.1)

The error does not occur when using the moments method. Moreover, the following works:

w <- 1

component_1 = c(
  w,
  0.2,
  0.1
)

prior <- RBesT::mixnorm(
  component_1 =  component_1
)

ess(prior, method = "elir", sigma = 0.1)

Version : RBesT_1.7-3

R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 10 x64 (build 19045)

Thanks.

weberse2 commented 4 days ago

Many thanks for reporting. This error should not occur, obviously. Much appreciated that a minimal example is provided.