merliseclyde / BAS

BAS R package https://merliseclyde.github.io/BAS/
https://merliseclyde.github.io/BAS/
GNU General Public License v3.0
41 stars 16 forks source link

eplogprob returns NaN #54

Closed merliseclyde closed 3 years ago

merliseclyde commented 3 years ago

Describe the bug When coefficients are highly significant and p-values equal 0.0, the function eplogprob returns NaN. This in turn causes bas.lm or bas.glm to fail if init.probs = "eplogp" is used.

To Reproduce Steps to reproduce the behavior:

See unit test in test-eplogprob.R

loc <- system.file("testdata", package = "BAS")
 load(paste0(loc, "/eplogp-testdata.Rdata"))
 prob = eplogprob(lm(Y ~ ., data = df))
 expect_true(sum(is.na(prob)) == 0)

Expected behavior If p-values are less than Machine precision, return max probability as this is just used to sort variables internally and initialize sampling probabilities. Do not set init probs to 1 in this case.