This function creates a ggplot object visualizing logistic regression coefficients with their 95% confidence intervals. Significant markers are highlighted based on a specified p-value threshold.
Arguments
- tbl
A data frame or tibble containing the logistic regression results. Expected columns are:
marker
: The name of the marker (e.g., variable name).pval
: The p-value for each marker.ci.lower
: The lower bound of the confidence interval.ci.upper
: The upper bound of the confidence interval.est
: The estimated coefficient.
- sig
A numeric value specifying the significance threshold for p-values. Defaults to 0.05.
Value
A ggplot object showing the logistic regression coefficients with confidence
intervals. Significant markers (p-value < sig
) are colored differently.
Examples
# Example dataset
tbl <- tibble::tibble(
marker = c("(Intercept)", "var1", "var2", "var3"),
pval = c(0.1, 0.03, 0.2, 0.04),
ci.lower = c(-0.2, 0.1, -0.3, 0.2),
ci.upper = c(0.5, 0.8, 0.4, 1.1),
est = c(0.2, 0.5, 0.1, 0.7)
)
# Plot
plot_estimates(tbl)
#> Error in mutate(., sig_binary = if_else(pval < sig, TRUE, FALSE)): ℹ In argument: `sig_binary = if_else(pval < sig, TRUE, FALSE)`.
#> Caused by error in `if_else()`:
#> ! could not find function "if_else"