Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion R/colocboost_inference.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ colocboost_post_inference <- function() {
}


# - Fast calculate correlation matrix
#' Fast calculate correlation matrix
#' @rdname colocboost_post_inference
#' @keywords cb_post_inference
#' @noRd
get_cormat <- function(X, intercepte = FALSE){
X = t(X)
# Center each variable
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test_that("w_cs correctly identifies confidence set for weight vector", {

# Test with different coverage
result2 <- w_cs(w, coverage = 0.9)
expected2 <- c(1, 1, 1, 0) # First 3 elements cover 90%
expected2 <- c(1, 1, 1, 1) # First 4 elements cover 90% since 3 and 4 with the same 0.1 weight
expect_equal(result2, expected2)
})

Expand All @@ -51,8 +51,8 @@ test_that("get_in_cos correctly identifies indices in confidence set", {

# Test with higher coverage
result2 <- get_in_cos(w, coverage = 0.9)
# Should include elements 2, 3, 1, 4
expect_equal(sort(result2[[1]]), c(1, 2, 3, 4))
# Should include elements 2, 3, 1, 4, 5
expect_equal(sort(result2[[1]]), c(1, 2, 3, 4, 5))
})

# Test for merge_sets function
Expand Down
Loading