name: regression-inference
description: Coefficient confidence intervals (ci_lower / ci_upper at conf_level) and the coefficient covariance and correlation on a regression — the per-family critical value, the opt-in vcov flag, where each engine's and modifier's matrix comes from, how it relates to the standard errors, weighted fits, the refusals, and what R's vcov does differently. Topical design; per-model params in atomic op-reg-* skills.
type: guide
kind: design
applies_to: process, compose, predict
covers: [ci_lower, ci_upper, conf_level, confidence interval, df, vcov, Vcov, Correlation, covariance, coefficient correlation, standard errors, std_errors, regressions]
Regression coefficient intervals and covariance
Confidence intervals
Every fit with standard errors carries ci_lower / ci_upper (keyed like coefficients), conf_level and, for a t interval, df: bound = β ∓ q·SE. Set "conf_level": 0.9 (flat, 0<c<1, default 0.95).
| Fit | q | df |
|---|---|---|
| OLS, ridge | Student t | residual N* − p − 1 (fractional weighted) |
| GLM | normal (Wald, R confint.default) | absent |
| Bayesian linear | posterior t, = credible_intervals at one level | 2a_N |
| Resample | normal on the resampled SE | absent |
Present exactly where std_errors is: lasso / elastic net (multinomial: any penalty) null on every key (no analytical inference; advisory PULSE_ADVISORY_PENALIZED_INFERENCE_UNDEFINED), selection keyed by selected_features. An undefined bound (df ≤ 0) is null.
Covariance
Set "vcov": true on a regression slot (flat spec field, NOT under params) for the coefficient covariance and correlation. Absent: off.
{"cohort": {"filename": "mmm_weekly.pulse"},
"regressions": [{"type": "REG_OLS", "target": "sales", "predictors": ["tv", "price"], "vcov": true}]}
Shape
Response.Regressions[i].Vcov and .Correlation are square-symmetric tables in the full encoding, keyed (intercept) first, then the predictors in spec order. Correlation is cov2cor (unit diagonal); a zero or undefined variance gives null in that row and column. Under selection the keys are (intercept) + the retained predictors in selected_features order; selected-out predictors are absent.
Where the matrix comes from
| Engine | Matrix |
|---|---|
| OLS | σ̂²(XᵀX)⁻¹, intercept cross terms included (−μᵀCov) |
Ridge (l2) | the sandwich estimator (GLM: H⁻¹XᵀWXH⁻¹, H = XᵀWX + N*·α·D) |
| GLM | φ·(XᵀWX)⁻¹ at the converged IRLS weights: φ = 1 (binomial, poisson, negative binomial at θ̂), gamma’s Pearson χ²/df estimate |
| Bayesian linear | the posterior covariance b_N/(a_N−1)·Λ⁻¹; null when a_N ≤ 1 |
Resample jackknife | (g−1)/g·Σ(β₋ₖ−β̄)(β₋ₖ−β̄)ᵀ over its g delete-group refits (g = n leave-one-out) |
Resample bootstrap | sample covariance (B−1 divisor) of the successful replicates; seeded = deterministic |
| Selection | the engine’s matrix from the final refit on the selected predictors |
For OLS, ridge, GLM and both modifiers, √diag(Vcov) equals StdErrors exactly; selection + resample follows the resample SEs over the selected set. The Bayesian diagonal is StdErrors² · a_N/(a_N−1), not equal: StdErrors there is the scale of the marginal t, not the posterior variance.
Weighted fits (frequency or probability) use the N* basis the weighted SE uses; see weighting.
Robust standard errors
"covariance": {"type": "hc3"} on REG_OLS swaps the estimator behind std_errors, p_values, the intervals and vcov: hc0–hc3, cluster (CR1, OLS df = clusters − 1), hac (Newey–West over order_by) or, on a panel, per-entity hac / driscoll_kraay (regression-panel-covariance). Absent = classical. R: sandwich.
REG_GLM takes it too: the sandwich over the IRLS scores at the converged weights (R sandwich on glm), dispersion-free, still Wald z with no df (cluster and gamma too); weighted, it follows w*.
REG_BAYES_LINEAR: Müller’s (2013) sandwich posterior N(μ_n, Λ_n⁻¹MΛ_n⁻¹) REPLACES the posterior covariance (mean kept; normal intervals, no df), not the conjugate posterior.
REG_MULTINOMIAL: hc0, hc1, cluster over the scores (y − π) ⊗ x, Wald z; others refused (reason type).
Refusals
PROCESSING_REGRESSION_VCOV_UNSUPPORTED, details.reason penalty: l1 / elasticnet has no sampling covariance of its data-dependent active set, never approximated — refused under resample or selection too. A robust covariance forces the buffered path and adds a Covariance echo; it is refused (same code) beside any penalty, resample, selection or bounds, with < 2 clusters, or a repeated order_by. A null or non-finite cluster / order_by drops the row.
Predict refuses identically, before any fit.
Against R
vcov(lm)andvcov(ridge)agree to rounding.vcov(glm)uses weights one IRLS iteration behind its coefficients; Pulse inverts at the converged fixed point, matching R refined to that point to 1e-11 (rawvcov(glm)only to about 1e-6).- Negative binomial: θ̂ is MASS
glm.nb’s MLE at its fixed point; SEs andvcovaresummary.negbin’s (β, θ orthogonal),ThetaStdErritsSE.theta,AICcounts an estimated θ; a robustcovarianceholds θ̂ fixed, assandwichdoes (oracleglm_nb.json). TwoLogLik/AIC: R’slogLik/AIC(σ, gamma’s φ at D/n, NB’s estimated θ counted); absent if probability-weighted, penalized or a bound binds.- Gamma GLM: dispersion estimated as R does (Pearson χ²/df), so
vcov, SEs, t p-values anddfmatchsummary.glm/vcov(glm)(glm_gamma.json); gammaselectionscores R’sAIC(glm)/BIC(glm)(glm_gamma_selection.json).
Response shaping
vcov, correlation, ci_lower, ci_upper, df, conf_level ride the standard preset (the MCP default) and are absent from minimal. Exclude with regressions[*].<key> paths in return.exclude. See response-shaping.
See
regression-modeling— choosing a model and modifiers.regression-margins— marginal effects on these SEs.regression-collinearity— VIF on the fit.regression-panel-covariance— entity × period panels.regression-comparison— nested-model F / LR / Wald tests of two fits.op-reg-ols— itsvcovParam (OLS, ridge).op-reg-glm— itsvcovParam.op-reg-bayes-linear— itsvcovParam.weighting— the N* basis.response-shaping— presets and exclude paths.matrix-results— the same matrix encodings.