Skip to content

Commit

Permalink
Add lbf_variable to results exported
Browse files Browse the repository at this point in the history
  • Loading branch information
gaow committed Mar 19, 2024
1 parent 29d49d7 commit cf62fff
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions R/ibss_algorithm.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ SuSiE <- R6Class("SuSiE",
function(l) private$SER[[l]]$lbf
)
},
lbf_variable = function() {
do.call(rbind, lapply(
seq(1, private$L),
function(l) private$SER[[l]]$lbf_variable
))
},
pip_history = function() {
lapply(
seq(
Expand Down
1 change: 1 addition & 0 deletions R/mvsusie_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ report_susie_model <- function(d, m, estimate_prior_variance = TRUE) {
b2 = b2,
KL = m$kl,
lbf = m$lbf,
lbf_variable = m$lbf_variable,
V = m$prior_variance,
sigma2 = d$residual_variance,
elbo = m$get_objective(dump = TRUE),
Expand Down
1 change: 1 addition & 0 deletions R/single_effect_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ SingleEffectModel <- function(base) {
}
},
lbf = function() private$lbf_single_effect,
lbf_variable = function() private$.lbf,
kl = function() private$.kl,
vbxxb = function() private$.vbxxb,
bxxb = function() private$.bxxb
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_susie_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ test_that("customized initialization interface", with(simulate_multivariate(r=3)
# let's just test of null is null ...
null_weight = 0.2
m_init = create_mixture_prior(R = ncol(y),null_weight = null_weight, max_mixture_len=-1)
expect_equal(m_init$prior_variance$pi[1], null_weight)
expect_equal(unname(m_init$prior_variance$pi[1]), null_weight)
}))

test_that("mvsusieR is identical to susieR (RSS)", with(simulate_univariate(summary = T), {
Expand Down Expand Up @@ -200,5 +200,5 @@ test_that("customized initialization interface (RSS)", with(simulate_multivariat
# let's just test of null is null ...
null_weight = 0.2
m_init = create_mixture_prior(R = ncol(y),null_weight = null_weight, max_mixture_len=-1)
expect_equal(m_init$prior_variance$pi[1], null_weight)
expect_equal(unname(m_init$prior_variance$pi[1]), null_weight)
}))

0 comments on commit cf62fff

Please sign in to comment.