| Title: | Minimum Inhibitory Concentration Estimation from Ordinal Regression Models |
|---|---|
| Description: | Provides tools to estimate minimum inhibitory concentration (MIC) and conduct rigorous pairwise comparisons (delta, fold‑change, and difference of difference tests) from cumulative‑link models fitted with 'ordinal::clm'. |
| Authors: | Carson Stacy [aut, cre] |
| Maintainer: | Carson Stacy <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-05-13 07:35:08 UTC |
| Source: | https://github.com/clstacy/ordinalMIC |
Quick ggplot2 visualisations of the main outputs from
mic_solve(). Three panels are supported:
"mic" - forest plot of group-wise MIC estimates with asymmetric CIs.
"delta" - forest plot of deltaMIC pairwise differences.
"ratio" - forest plot of MIC ratios (log scale).
## S3 method for class 'mic_solve' autoplot( object, type = c("mic", "delta", "ratio", "DoD_delta", "DoD_ratio"), x = NULL, color_by = NULL, dot_size = 0.5, ... )## S3 method for class 'mic_solve' autoplot( object, type = c("mic", "delta", "ratio", "DoD_delta", "DoD_ratio"), x = NULL, color_by = NULL, dot_size = 0.5, ... )
object |
An object returned by |
type |
One of |
x |
Variable for x axis plotting |
color_by |
Optional column name used to color and dodge replicate
points. Default: first column in |
dot_size |
Size of the dots in the dotplot. Default: |
... |
Additional arguments passed to |
A ggplot object.
Carson Stacy
if (requireNamespace("ordinal", quietly = TRUE) && requireNamespace("ggplot2", quietly = TRUE)) { df <- data.frame(score = ordered(sample(0:4, 120, TRUE)), conc = runif(120, 0, 4), strain = factor(sample(c("A","B"), 120, TRUE))) fit <- ordinal::clm(score ~ strain * log1p(conc), data = df) res <- mic_solve(fit, expand.grid(strain = levels(df$strain)), conc_name = "conc") ggplot2::autoplot(res, type = "mic") }if (requireNamespace("ordinal", quietly = TRUE) && requireNamespace("ggplot2", quietly = TRUE)) { df <- data.frame(score = ordered(sample(0:4, 120, TRUE)), conc = runif(120, 0, 4), strain = factor(sample(c("A","B"), 120, TRUE))) fit <- ordinal::clm(score ~ strain * log1p(conc), data = df) res <- mic_solve(fit, expand.grid(strain = levels(df$strain)), conc_name = "conc") ggplot2::autoplot(res, type = "mic") }
High‑level wrapper that returns:
delta_mic_results – additive pairwise differences (Δ‑MIC).
ratio_mic_results – multiplicative pairwise ratios.
dod_ratio_results – difference‑of‑differences on the ratio scale
(ratio‑of‑ratios, a classic interaction on the log scale).
dod_delta_results – difference‑of‑differences on the additive scale
(Δ of Δs).
mic_solve( clm_fit, newdata = NULL, conc_name, transform_fun = log1p, inv_transform_fun = expm1, alpha = 0.05, compare_pairs = "all", pvalue_scale = c("lp", "logmic") )mic_solve( clm_fit, newdata = NULL, conc_name, transform_fun = log1p, inv_transform_fun = expm1, alpha = 0.05, compare_pairs = "all", pvalue_scale = c("lp", "logmic") )
clm_fit |
Fitted object from |
newdata |
Data frame with factor combinations to evaluate. |
conc_name |
Character string giving the raw concentration column. |
transform_fun |
Transformation used in the model (default |
inv_transform_fun |
Inverse transformation (default |
alpha |
Confidence‑level significance (default 0.05). |
compare_pairs |
One of |
pvalue_scale |
Which pivot the main P_value uses for pairwise tests: "lp" (difference in lp = log1p(MIC), recommended for calibration) or "logmic" (current Wald on log(MIC) for ratios and MIC scale for deltas). |
An object of class "mic_solve" containing the tables above plus
mic_estimates.
if (requireNamespace("ordinal", quietly = TRUE)) { ## Toy ordinal dataset set.seed(1) fit <- ordinal::clm(score ~ strain * treatment + log1p(conc), data = yeast_df) res <- mic_solve(fit, conc_name = "conc") head(res$ratio_mic_results) }if (requireNamespace("ordinal", quietly = TRUE)) { ## Toy ordinal dataset set.seed(1) fit <- ordinal::clm(score ~ strain * treatment + log1p(conc), data = yeast_df) res <- mic_solve(fit, conc_name = "conc") head(res$ratio_mic_results) }
tidy method for mic_solve objects
tidy.mic_solve( x, table = c("mic", "delta", "ratio", "DoD_delta", "DoD_ratio"), ... )tidy.mic_solve( x, table = c("mic", "delta", "ratio", "DoD_delta", "DoD_ratio"), ... )
x |
An object of class |
table |
A character string specifying which table to return.
Options are |
... |
Additional arguments (not used). |
A tibble containing the requested table from the mic_solve object.
An example dataset with ordinal spot scores (0 = no growth … 4 = full growth) for treated and untreated wild-type and mutant yeast across a peroxide gradient.
data(yeast_df)data(yeast_df)
A data frame with 132 rows and 4 variables:
Ordered factor 0 < 1 < 2 < 3 < 4
Numeric concentration units
Factor: "WT" or "Mut"
Factor: "None" or "Salt"
Replicate id (integer)
data(yeast_df) head(yeast_df)data(yeast_df) head(yeast_df)