| compute_cde_glm | R Documentation |
Computes the Controlled Direct Effect analogue for GLM outcomes.
For binary (logit link), this averages the individual-level odds
first, then takes the ratio — analogous to
mean(exp(theta_1)) / mean(exp(theta_0)) in survival:
compute_cde_glm(df, subset_indicator = NULL, effect_measure = "OR")
df |
Data frame with potential outcome columns ( |
subset_indicator |
Optional logical/integer vector for subsetting.
If provided, only rows where |
effect_measure |
Character. One of |
CDE(S) = mean(p1[S]/(1-p1[S])) / mean(p0[S]/(1-p0[S]))
This differs from the AOR (odds(mean(p1)) / odds(mean(p0)))
due to Jensen's inequality whenever individual probabilities are
heterogeneous. For identity-link (MD) and log-link (IRR) outcomes,
CDE equals AOR and this function returns NA_real_.
Numeric CDE value (binary OR only), or NA_real_.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.