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

coef throws warnings with bas.glm objects if prior is AIC or BIC #65

Closed
merliseclyde opened this issue Nov 11, 2022 · 1 comment
Closed
Assignees
Labels

Comments

@merliseclyde
Copy link
Owner

merliseclyde commented Nov 11, 2022

Describe the bug
priors in bas.glm are objects, while in bas.lm character strings are used to refer to the prior, so the check to see if the prior is one of AIC or BIC in the coef function fails as it is comparing to object$prior which completes to object$priorprobs and the wrong length. No warning occurs if there is only a single model as when restricting the number of models.

To Reproduce
Steps to reproduce the behavior:

 pima.bas = bas.glm(formula = type ~ bp + bmi, data = Pima.tr, 
                     family = binomial(), 
                     betaprior = bic.prior(), 
                     modelprior = uniform(), 
                     method = "BAS")

 coef(pima.bas)

Expected behavior
no warnings or errors

** Offending Code **

Starting line 126

  if (!(object$prior == "AIC" || object$prior == "BIC")) {
    conditionalsd[, -1] <- sweep(conditionalsd[, -1, drop = F], 1,
      sqrt(shrinkage),
      FUN = "*"
    )
  }

and line 140

      df <- df - object$rank
    } else {
      df <- df - 1

Desktop (please complete the following information):

  • OSX
  • R Version 4.2.2

Additional context
check if this impacts predictions too

@merliseclyde merliseclyde self-assigned this Nov 11, 2022
@merliseclyde merliseclyde changed the title chef throws an error for bas.glm objects if prior is AIC or BIC coef throws warnings with bas.glm objects if prior is AIC or BIC Nov 11, 2022
merliseclyde added a commit that referenced this issue Nov 11, 2022
…nd set `object$prior` to `object$betaprior$class` to fix issue #65
@merliseclyde
Copy link
Owner Author

Fixed in main version 1.6.5

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

1 participant