Skip to content

Commit

Permalink
Adjusted mixsqp settings; fixed a few of the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarbo committed Feb 19, 2020
1 parent cafe68a commit 6ee64fb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Authors@R: c(person("Matthew","Stephens",role="aut",
person("Jason","Willwerscheid",role="aut"),
person("Nan","Xiao",role="aut"),
person("Mazon","Zeng",role="ctb"))
Version: 2.2-44
Version: 2.2-45
Date: 2020-02-19
Title: Methods for Adaptive Shrinkage, using Empirical Bayes
Description: The R package 'ashr' implements an Empirical Bayes
Expand Down
4 changes: 3 additions & 1 deletion R/mix_opt.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ mixSQP <- function (matrix_lik, prior, pi_init = NULL,
w <- w[w != 0]

# Fit the mixture weights using the mix-SQP algorithm.
control0 <- list(verbose = FALSE)
control0 <- list(verbose = FALSE,
eps = 1e-6,
numiter.em = 20)
control <- modifyList(control0,control,keep.null = TRUE)
out <- mixsqp::mixsqp(A,w,pi_init,control = control)

Expand Down
12 changes: 12 additions & 0 deletions R/tests.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The Rmosek package on CRAN will not work with REBayes. This function
# is used for some of the tests to check whether the correct Rmosek
# package (the one downloaded from mosek.com) is installed.
#
#' @importFrom testthat skip_if_not_installed
#' @importFrom testthat skip_if
#'
skip_if_mixkwdual_doesnt_work <- function() {
skip_if_not_installed("REBayes")
skip_if_not_installed("Rmosek")
skip_if(!is.element("mosek_lptoprob",getNamespaceExports("Rmosek")))
}
3 changes: 2 additions & 1 deletion tests/testthat/test_binom.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ test_that("lik_binom (logit link) fitted g is close to true g",{
})

test_that("lik_binom (logit link) fitted g is close to true g",{

# Simulate a Binomial dataset
set.seed(1)
truemode = 0
logitp = c(rep(0,800), runif(200,-3,3))
p = 1/(1+exp(-logitp))
p = 1/(1 + exp(-logitp))
n = rep(100,1000)
x = rbinom(1000,n,p) # Binomial observations
ash.binom.out = ash(rep(0,length(x)),1,lik=lik_binom(x,n,link="logit"),
Expand Down

0 comments on commit 6ee64fb

Please sign in to comment.