View source: R/truefind_asymptotic_glm.R
| compute_detection_probability_glm | R Documentation |
Extends the Section 2.1 approximation (Leon et al., 2024, eq. 3) to
arbitrary GLM outcomes via the effective information
d_{\text{eff}}. This is the GLM generalization of
compute_detection_probability.
compute_detection_probability_glm(
theta,
d_eff,
c1 = 1.25,
c2 = 1,
effect_scale = c("ratio", "difference"),
method = c("cubature", "monte_carlo"),
n_mc = 500000L,
seed = 42L,
verbose = FALSE
)
theta |
Numeric (scalar or vector). True treatment effect in the subgroup on the natural scale:
|
d_eff |
Numeric. Effective information in the subgroup.
Use the |
c1 |
Numeric. Screening threshold on the natural scale. For ratio measures: the ratio (e.g., 1.25). For difference measures: the difference (e.g., 0.2). |
c2 |
Numeric. Consistency threshold on the natural scale.
Default: 1.0 on both scales; supply |
effect_scale |
Character. |
method |
Character. |
n_mc |
Integer. Monte Carlo samples if method = "monte_carlo". |
seed |
Integer. RNG seed for Monte Carlo. |
verbose |
Logical. Progress messages for vector theta. |
The detection criterion (Leon et al., 2024, Section 2.1):
Screening: W_1 + W_2 \ge 2k_1
Consistency: \min(W_1, W_2) \ge k_2
with W_1, W_2 \sim N(\beta, 8/d_{\text{eff}}) independently.
For ratio-scale effects, \beta = \log(\theta),
k_j = \log(c_j).
For difference-scale effects, \beta = \theta, k_j = c_j.
If theta is scalar, a single probability.
If vector, a data.frame with columns theta, probability.
compute_detection_probability for the
survival-specific version.
# Survival: reproduce Figure 2
d <- d_eff_survival(n_sg = 60, prop_cens = 0.45)
compute_detection_probability_glm(theta = 2.0, d_eff = d)
# Binary: OR = 2.0, event rate 30%
d <- d_eff_binary(n_sg = 100, p_event = 0.30)
compute_detection_probability_glm(theta = 2.0, d_eff = d)
# Count: IRR = 2.0, 80 total events
d <- d_eff_count(total_events = 80)
compute_detection_probability_glm(theta = 2.0, d_eff = d)
# Continuous: mean difference = 0.5, sigma = 1.5
d <- d_eff_continuous(n_sg = 100, sigma_y = 1.5)
compute_detection_probability_glm(
theta = 0.5, d_eff = d,
c1 = 0.2, c2 = 0.0,
effect_scale = "difference"
)
# Power curve
d <- d_eff_binary(100, 0.30)
result <- compute_detection_probability_glm(
theta = seq(0.5, 3.0, by = 0.1), d_eff = d
)
plot(result$theta, result$probability, type = "l")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.