Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/nesmr-logdet' into nesmr-logdet
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaneng committed Nov 1, 2024
2 parents ff8a684 + 29309fb commit 85d1ca3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: esmr
Type: Package
Title: Empirical Shrinkage Mendelian Randomization
Version: 0.2.1.0194
Version: 0.2.1.0195
Author: Jean Morrison
Maintainer: Jean Morrison <[email protected]>
Description: Perform univariable or multivariable MR with empirical shrinkage priors.
Expand Down
4 changes: 2 additions & 2 deletions R/direct_to_total.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
direct_to_total <- function(B_dir, restrict_DAG = TRUE) {
n <- nrow(B_dir)
B_total <- solve(diag(n) - B_dir) - diag(n)
if(!isTRUE(all.equal(diag(B_total), rep(0, n)))){
if(!all(diag(B_total) == 0)){
stop("Failed to compute total effects from direct. Check that supplied B_dir corresponds to a valid DAG.\n")
}
return(B_total)
Expand All @@ -26,7 +26,7 @@ direct_to_total <- function(B_dir, restrict_DAG = TRUE) {
total_to_direct <- function(B_tot){
n <- nrow(B_tot)
B_dir <- diag(n) - solve(diag(n) + B_tot)
if(!isTRUE(all.equal(diag(B_dir), rep(0, n)))){
if(!all(diag(B_total) == 0)){
stop("Failed to compute total effects from direct. Check that supplied B_tot corresponds to a valid DAG.\n")
}
return(B_dir)
Expand Down

0 comments on commit 85d1ca3

Please sign in to comment.