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

segmentation fault with method "MCMC+BAS" if initial (best model) arg is not the null model #69

Closed merliseclyde closed 1 year ago

merliseclyde commented 1 year ago

Describe the bug bas.lm using method = "MCMC+BAS" crashes with a segmentation fault if bestmodel is not NULL or the null model.

To Reproduce Steps to reproduce the behavior:

data(Hald) bas.lm(Y ~ ., prior = "BIC", method = "MCMC+BAS", MCMC.iterations = 1000, n.models=2^4, bestmodel=best, update=8, modelprior = uniform(), data = Hald)

Expected behavior should exit cleanly. If MCMC.iterations = 0, should give the same result as when method = "BAS"

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

merliseclyde commented 1 year ago

Added unit tests; problem resolved after correcting index issue related to the current model position versus the number of Unique models