Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predict.basglm not compatible with MPM estimator #51

Closed
aagaardk opened this issue Aug 14, 2020 · 1 comment
Closed

predict.basglm not compatible with MPM estimator #51

aagaardk opened this issue Aug 14, 2020 · 1 comment
Assignees
Labels

Comments

@aagaardk
Copy link

When estimator = 'MPM' predict.basglm produces an error regarding the prior values.

Reproducible example:

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, estimator = 'MPM')

#Error in bas.lm(eval(object$call$formula), data = eval(object$call$data,  : 
#  prior  1 is not one of  g-prior, hyper-g, hyper-g-laplace, hyper-g-n, AIC, BIC, ZS-null, ZS-full, EB-local, EB-global, JZSprior

Desktop (please complete the following information):

  • OS: Windows x86_64-w64-mingw32/x64 (64-bit)
  • R Version 4.0.2
@merliseclyde merliseclyde self-assigned this Oct 30, 2020
@merliseclyde
Copy link
Owner

For MPM, predict extracts the median probability model and runs bas a second time to create a new bas object. Currently predict code calls bas.lm, rather than bas.glm.

Fix: add a switch to check class of object before calling bas.lm or bas.glm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants