Skip to content

Commit

Permalink
Move delta parameter check closer to the one requring it
Browse files Browse the repository at this point in the history
  • Loading branch information
shinjaehyeok committed Sep 7, 2024
1 parent 6683ffa commit a6d5f58
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions R/stcp.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,6 @@ Stcp <- R6::R6Class(
}
alpha <- exp(-threshold)

delta_check_output <- checkDeltaRange(method, family, alternative, m_pre, delta_lower, delta_upper)

if (delta_check_output$is_acceptable) {
delta_upper <- delta_check_output$delta_upper
} else {
stop(delta_check_output$error_message)
}

# Initialize stcp for GLRCU method
# If method = GLRCU, we do not use delta_lower and delta_upper
if (method == "GLRCU") {
Expand Down Expand Up @@ -182,6 +174,15 @@ Stcp <- R6::R6Class(
}
}
} else {
# Check whether delta parameters are in an expected range
delta_check_output <- checkDeltaRange(method, family, alternative, m_pre, delta_lower, delta_upper)
if (delta_check_output$is_acceptable) {
delta_upper <- delta_check_output$delta_upper
} else {
stop(delta_check_output$error_message)
}
# Convert delta parameters into exponential baseline ones.
# Note this conversion is method agnostic.
exp_params <- convertDeltaToExpParams(family,
alternative,
threshold,
Expand Down

0 comments on commit a6d5f58

Please sign in to comment.