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

predict.basglm error with newdata when se.fit = TRUE #50

Closed aagaardk closed 3 years ago

aagaardk commented 4 years ago

When trying to generate standard errors about fitted values using predict.basglm (i.e., se.fit = TRUE), the function issues an error when data are supplied to newdata:

Error in array(STATS, dims[perm]) : 'data' must be of a vector type, was 'NULL' In addition: Warning message: In max(cumDim[cumDim <= lstats]) : no non-missing arguments to max; returning -Inf

Example which reproduces the behavior:

data(Pima.tr, package="MASS")
 data(Pima.te, package="MASS")
 Pima.bas = bas.glm(type ~ ., data=Pima.tr, n.models= 2^7, method="BAS",
            betaprior=CCH(a=1, b=nrow(Pima.tr)/2, s=0), family=binomial(),
            modelprior=uniform())
 pred = predict(Pima.bas, newdata=Pima.te, se.fit = TRUE, top=1)  # Highest Probability model

Desktop (please complete the following information):