Tier-A modernization mirroring what landed in ebal/Synth/Inference
work. None of this changes the underlying algorithm or default
behavior; existing krls(X, y) calls continue to work bit-identical.
* Formula interface. krls(y ~ x1 + x2, data = df) now works alongside
the matrix interface. Drops the intercept column automatically;
rejects NAs in either side with the same error messages the matrix
interface uses; expands factor predictors to dummies via
model.matrix() so factor(region), age * educ, I(age^2), etc. all
flow through cleanly.
* Tidyverse-friendly extractors. tidy(fit) / glance(fit) /
augment(fit) registered against the generics package generics so
library(broom) picks them up.
- tidy(fit): per-predictor row with the AME (estimate),
analytical SE, t-stat, p-value, 95% CI, and the pointwise
quartiles (q25 / median / q75). The pointwise spread is the
unique KRLS contribution OLS can't tell.
- glance(fit): one-row summary with nobs, n_predictors, r.squared,
leave-one-out MSE, lambda, sigma, and effective degrees of
freedom from the kernel ridge.
- augment(fit, data): joins .fitted, .resid, and one .dy_d_<x>
column per predictor (the pointwise derivatives) back to a
user-supplied data frame.
* ggplot2 autoplot. autoplot(fit) returns a faceted ggplot of the
pointwise marginal-effect distribution, one panel per predictor,
with the AME overlaid in blue. Discoverable via library(ggplot2);
ggplot2 is in Suggests:.
* Quickstart vignette (vignettes/krls-quickstart.Rmd) walks through a
small simulated example showing the AME-vs-pointwise heterogeneity
story end-to-end with the new formula + tidy + autoplot pipeline.
Tooling:
* Suggests: + knitr, rmarkdown, ggplot2, generics. VignetteBuilder.
* importFrom stats: + model.frame, model.matrix, model.response,
na.pass, qt (used by tidy and the formula path).
* 62 tests passing; R CMD check --as-cran clean.
Tier-C (Nystrom approximation for the n^3 scaling story) and the
bigKRLS Rcpp port are independent of this release; Pete Mohanty
replied positively 2026-05-09 and is consulting Robert Shaffer
before picking which of the three options we offered.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>