
Plot Prediction-Powered Inference vs. Human-Only & Naive LLM Benchmarks
Source:R/autoplot.R
autoplot.llm_ppi.RdProduces a publication-ready forest plot comparing parameter point estimates and confidence intervals across Naive LLM, Human-Only, and PPI / PPI++, optionally overlaying true simulation values.
Usage
# S3 method for class 'llm_ppi'
autoplot(
object,
terms = NULL,
include_intercept = FALSE,
true_values = NULL,
...
)Arguments
- object
An
"llm_ppi"object returned byppi_mean(),ppi_lm(),ppi_glm(),ppi_clustered(), orppi_lmer().- terms
Optional character vector restricting displayed model terms.
- include_intercept
Logical; whether to display
"(Intercept)"when other regression predictors are present. DefaultFALSE.- true_values
Optional named numeric vector of ground-truth parameter values to overlay as vertical dashed reference lines (useful for simulation diagnostics).
- ...
Unused; included for S3 consistency.
Value
A ggplot2::ggplot object.
Examples
set.seed(123)
n_tot <- 500
x <- rnorm(n_tot)
y_true <- 1 + 1.5 * x + rnorm(n_tot)
y_llm <- 0.5 + 0.8 * y_true + 0.5 * x + rnorm(n_tot, sd = 0.5)
df <- tibble::tibble(
x = x,
human_y = c(y_true[1:100], rep(NA_real_, n_tot - 100)),
llm_y = y_llm
)
fit <- ppi_lm(human_y ~ x, data = df, pred_col = "llm_y")
autoplot(fit)