merliseclyde / BAS

BAS R package for Bayesian Model Averaging and Variable Selection
https://merliseclyde.github.io/BAS/
GNU General Public License v3.0
42 stars 16 forks source link

`bas.lm` and `bas.glm` ignoring prior model probabilities that are 0 #74

Closed merliseclyde closed 12 months ago

merliseclyde commented 12 months ago

Describe the bug BAS is including models in the output that have prior probability 0.

To Reproduce Steps to reproduce the behavior:

data("bodyfat")
bas_mod <- bas.lm(Bodyfat ~.,data = bodyfat[1:14,], method = 'BAS', modelprior = tr.poisson(2, 5))
pred <- predict(bas_mod,newdata = bodyfat[15:20,], se.fit = T, estimator = 'BMA') 
cbind(bas_mod$rank, bas_mod$size, bas_mod$postprobs)

Expected behavior

Expect that model with zero prior and posterior probability are dropped from the output and calculations

Desktop (please complete the following information):

Additional context related to Issue #70

merliseclyde commented 12 months ago

partial fix of issue using postprocessing of output to drop all models with prior probability zero. A better solution is to eliminate the models from the tree-structure as they are sampled in C with methods BAS, deterministic and MCMC+BAS as is done with MCMC.