Skip to content

Commit

Permalink
clean up un-used code
Browse files Browse the repository at this point in the history
  • Loading branch information
merliseclyde committed Dec 7, 2023
1 parent 6bf327f commit 75a8a36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
32 changes: 0 additions & 32 deletions R/bas_glm.R
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@

normalize.initprobs.glm <- function(initprobs, glm.obj) {
p <- dim(glm.obj$x)[2]
if (!is.numeric(initprobs)) {
initprobs <- switch(initprobs,
"eplogp" = eplogprob(glm.obj),
"uniform" = c(1.0, rep(.5, p - 1)),
"Uniform" = c(1.0, rep(.5, p - 1))
)
}
if (length(initprobs) == (p - 1)) {
initprobs <- c(1.0, initprobs)
}
if (length(initprobs) != p) {
stop(paste("length of initprobs is not", p))
}
if (initprobs[1] < 1.0 | initprobs[1] > 1.0) initprobs[1] <- 1.0
# intercept is always included otherwise we get a segmentation
# fault (relax later)
prob <- as.numeric(initprobs)

pval <- summary(glm.obj)$coefficients[, 4]
if (any(is.na(pval))) {
warning(paste("warning full model is rank deficient; use caution when interpreting restults."))
# prob[is.na(pval)] <- 0.0
}

return(prob)
}



#' Bayesian Adaptive Sampling Without Replacement for Variable Selection in
#' Generalized Linear Models
#'
Expand Down
6 changes: 3 additions & 3 deletions R/bas_lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,12 @@ bas.lm <- function(formula,
}


# start nocov

# shouldn't be able to get here
if (is.null(alpha)) {
stop("Error in BAS code, please report on GitHub")
stop("Error in BAS code, please report on GitHub") # nocov
}
# end nocov


parents <- matrix(1, 1, 1)
if (method == "MCMC+BAS" |
Expand Down

0 comments on commit 75a8a36

Please sign in to comment.