merliseclyde / BAS

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

`bas.predict` error with a single covariate #68

Closed AleCarminati closed 1 year ago

AleCarminati commented 1 year ago

Describe the bug When you create a BAS linear model with a single covariate and then you try to predict new data (with se.fit=T) the function returns the following error: Error in array(STATS, dims[perm]) : 'dims' cannot be of length 0

To Reproduce

data("Hald")
hald.gprior =  bas.lm(Y ~ X2, data=Hald, alpha=13, prior="g-prior")
predict(hald.gprior, newdata=Hald, estimator="BPM", se.fit=TRUE)

Expected behavior The function should return the 95% intervals for the prediction of new data.

Desktop (please complete the following information):

merliseclyde commented 1 year ago

Thanks! - that is a bug in the function to produce the standard errors. and affects all estimator options.

merliseclyde commented 1 year ago

Dev version 1.6.5 passes current tests; closing issue for now.