Skip to content

Commit

Permalink
Added import for optimize.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarbo committed Apr 13, 2021
1 parent dd6679d commit af7ac6d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Description: Implements methods for variable selection in linear
called "Iterative Bayesian Stepwise Selection" (IBSS), is simple
and fast, allowing the SuSiE model be fit to large data sets
(thousands of samples and hundreds of thousands of variables).
Date: 2021-04-9
Version: 0.11.0
Date: 2021-04-13
Version: 0.11.1
Authors@R: c(person("Gao","Wang",role="aut",email="[email protected]"),
person("Yuxin","Zou",role="aut"),
person("Kaiqian","Zhang",role="aut"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ importFrom(stats,dnorm)
importFrom(stats,lm)
importFrom(stats,median)
importFrom(stats,optim)
importFrom(stats,optimize)
importFrom(stats,pnorm)
importFrom(stats,rmultinom)
importFrom(stats,rnorm)
Expand Down
5 changes: 4 additions & 1 deletion R/susie_rss.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ susie_rss = function (z, R, maf = NULL, maf_thresh = 0, z_ld_weight = 0,
# assumption is that each b_l has exactly one non-zero element, with
# all elements equally likely to be non-zero. The prior on the
# non-zero element is N(0,var = prior_variance).
#
#' @importFrom stats optimize
susie_rss_lambda = function(z, R, maf = NULL, maf_thresh = 0,
L = 10, lambda = 0,
prior_variance = 50, residual_variance = NULL,
Expand Down Expand Up @@ -299,7 +301,8 @@ susie_rss_lambda = function(z, R, maf = NULL, maf_thresh = 0,
if (est_sigma2 > 1)
est_sigma2 = 1
} else {
est_sigma2 = optimize(Eloglik_rss, interval = c(1e-4, 1-lambda), R = R, z = z, s = s, maximum = TRUE)$maximum
est_sigma2 = optimize(Eloglik_rss, interval = c(1e-4, 1-lambda),
R = R, z = z, s = s, maximum = TRUE)$maximum
if(Eloglik_rss(est_sigma2, R, z, s) < Eloglik_rss(1-lambda, R, z, s)){
est_sigma2 = 1-lambda
}
Expand Down

0 comments on commit af7ac6d

Please sign in to comment.