Skip to content

Commit

Permalink
Fix for issue #44 warning when contrasts are not a list in bas.lm and…
Browse files Browse the repository at this point in the history
… bas.glm
  • Loading branch information
merliseclyde committed Nov 5, 2019
1 parent c0c5e4a commit aa7e044
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
9 changes: 7 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# BAS 1.5.4

# Features
## Features

Modified prior probabilities to adjust for the number of variables always included when
* Modified prior probabilities to adjust for the number of variables always included when
using include.always. [Pull request #41](https://github.com/merliseclyde/BAS/pull/41) by Don van de Bergh. [Issue #40](https://github.com/merliseclyde/BAS/issues/40)

## Bug Fixes

* Added `contrast=NULL` argument to `bas.lm` and `bas.glm` so that non-NULL contrasts do not
trigger warning in `model.matrix` as of R 3.6.0. [Bug #44](https://github.com/merliseclyde/BAS/issues/44)

## Other

* Put ORCID in quotes in author list (per R-dev changes)
Expand Down
3 changes: 2 additions & 1 deletion R/bas_glm.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ normalize.initprobs.glm <- function(initprobs, glm.obj) {
#' @param weights optional vector of weights to be used in the fitting process.
#' May be missing in which case weights are 1.
#' @param subset subset of data used in fitting
#' @param contrasts an optional list. See the contrasts.arg of `model.matrix.default()`.
#' @param offset a priori known component to be included in the linear
#' predictor; by default 0.
#' @param na.action a function which indicates what should happen when the data
Expand Down Expand Up @@ -226,7 +227,7 @@ normalize.initprobs.glm <- function(initprobs, glm.obj) {
#' @rdname bas.glm
#' @export
bas.glm <- function(formula, family = binomial(link = "logit"),
data, weights, subset, offset, na.action = "na.omit",
data, weights, subset, contrasts=NULL, offset, na.action = "na.omit",
n.models = NULL,
betaprior = CCH(alpha = .5, beta = as.numeric(nrow(data)), s = 0),
modelprior = beta.binomial(1, 1),
Expand Down
2 changes: 2 additions & 0 deletions R/bas_lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ normalize.n.models <- function(n.models, p, initprobs, method, bigmem) {
#' @param weights an optional vector of weights to be used in the fitting
#' process. Should be NULL or a numeric vector. If non-NULL, Bayes estimates
#' are obtained assuming that Y ~ N(Xb, sigma^2 diag(1/weights)).
#' @param contrasts an optional list. See the contrasts.arg of `model.matrix.default()`.
#' @param na.action a function which indicates what should happen when the data
#' contain NAs. The default is "na.omit".
#' @param n.models number of models to sample either without replacement
Expand Down Expand Up @@ -439,6 +440,7 @@ bas.lm <- function(formula,
data,
subset,
weights,
contrasts=NULL,
na.action = "na.omit",
n.models = NULL,
prior = "ZS-null",
Expand Down
16 changes: 9 additions & 7 deletions man/bas.glm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions man/bas.lm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aa7e044

Please sign in to comment.