Regressions
The regressions this instance offers: what each is for, the questions it answers and when to reach for something else. Operators are sorted by name; each name links to its detail block below.
| Operator | In plain words | Answers questions like | Level | Instead, when… |
|---|---|---|---|---|
REG_BAYES_LINEAR | Fits a straight-line model of a numeric outcome under a prior, reporting each coefficient’s posterior mean and credible interval. | Given the data and our prior belief, what range of values is plausible for the price coefficient? | advanced | REG_OLS when you want p-values, resampled standard errors or stepwise predictor selection (none run on this type).REG_GLM when the outcome is yes/no (0/1) or a count.TEST_PEARSON_R when you only want how closely two numeric fields follow a straight line together. |
REG_GLM | Fits a generalized linear model: logistic for yes/no outcomes, Poisson or negative binomial for counts, gamma for positive skewed amounts. | Which customer traits are associated with the chance of churning, holding the others fixed? | advanced | REG_OLS when the outcome is a numeric measure with roughly symmetric, constant-spread residuals.TEST_PROP_Z when you only want to know whether a yes/no rate differs between two groups.TEST_CHISQ when the outcome and the single predictor are both categories. |
REG_MMM_BAYES | Fits a media-mix model with intervals: each channel’s carry-over, response curve and return on spend, beside linear controls. | What return does each marketing channel earn, and how sure are we? | advanced | REG_MMM_HILL when a fast point estimate over already-adstocked channels is enough, or the fit must be saved, scored or optimised. |
REG_MMM_HILL | Fits a media-mix model: each marketing channel’s effect and response curve (where its spend stops paying off), jointly with linear controls. | What does each marketing channel contribute to sales, holding price and the other channels fixed? | advanced | REG_OLS when the outcome moves in a straight line with spend, with no saturation. |
REG_MULTINOMIAL | Fits a model of an outcome with three or more categories (which plan, brand or channel), comparing each with a reference category. | Which customer traits are associated with choosing the premium or the basic plan over the standard one, holding the others fixed? | advanced | REG_GLM when the outcome has two categories (yes/no).REG_OLS when the outcome is numeric.TEST_CHISQ when you only want to know whether the categories are spread differently across a grouping category. |
REG_OLS | Fits a straight-line model that predicts a numeric outcome from one or more numeric predictors, by least squares. | Which of price, discount and season are associated with weekly sales, holding the others fixed? | intermediate | REG_GLM when the outcome is yes/no (0/1) or a count.REG_BAYES_LINEAR when you want intervals that combine the data with prior knowledge about the coefficients.TEST_PEARSON_R when you only want how closely two numeric fields follow a straight line together.TEST_ANOVA_F when the predictor is a set of groups and you want to know whether the group averages differ.ATTR_REG_RESIDUAL when you want each row’s residual, to check the residual assumptions or find rows the model fits badly. |
REG_ORDINAL | Fits a model that predicts an ordered rating (poor, fair, good) from numeric predictors, each shifting the whole scale up or down. | Which customer traits are associated with a higher satisfaction rating, holding the others fixed? | advanced | REG_GLM when the outcome has only two values (yes/no).REG_OLS when the outcome is a numeric measure whose steps are evenly spaced.TEST_KRUSKAL_WALLIS when you only want to know whether the ratings differ between groups.TEST_CHISQ when the outcome and the single predictor are both categories. |
Operators
REG_BAYES_LINEAR
Fits a straight-line model of a numeric outcome under a prior, reporting each coefficient’s posterior mean and credible interval.
Level: advanced
Also known as: bayesian linear regression
Questions it answers:
- Given the data and our prior belief, what range of values is plausible for the price coefficient?
- How do the coefficients shift when last year’s estimates are used as the prior?
Use cases by domain:
- survey: Fit a key-driver model on a small wave, using the previous wave’s coefficients as the prior mean.
- ops: Relate cost per order to volume when only a few weeks of data exist.
- science: Combine a small new study with earlier estimates of a dose-response slope.
Assumptions:
- Rows are independent of each other: repeated rows for the same customer, or values over time, make the reported uncertainty too small.
- The outcome changes linearly with each predictor, with normal residuals of constant spread (the model’s likelihood).
- The prior is conjugate Normal-Inverse-Gamma: each coefficient is normal around prior_mu (zeros by default, intercept first) with one shared precision for every coefficient, intercept included, measured relative to the residual variance: each coefficient’s prior standard deviation is σ / sqrt(prior_precision), so the prior’s strength changes with the noise level. The residual variance is inverse-gamma.
- The default prior is weak (precision 0.001), so with enough rows the coefficients sit close to REG_OLS. Its pull depends on each predictor’s units: a coefficient that is large because its predictor’s units are small is pulled harder toward prior_mu.
- Credible intervals are probability statements about each coefficient given the prior and the model; a wrong prior or a wrong model makes them wrong too.
- A coefficient describes association with the outcome, holding the other predictors fixed; it shows a causal effect only when the design supports one (for example random assignment), never from the fit alone, and a predictor left out of the model can drive both.
- Strongly related predictors (multicollinearity) make coefficients unstable; the prior keeps even an exactly collinear set solvable, but then the prior, not the data, decides how the shared association is split between them.
- Predictors must be numeric: encode a category as 0/1 fields first (FEAT_ONE_HOT) and leave one level out, or the fields are collinear with the intercept.
- Rows with a null target or predictor are dropped before fitting (listwise deletion); n_obs counts the rows used.
Use something else:
REG_OLSwhen you want p-values, resampled standard errors or stepwise predictor selection (none run on this type).REG_GLMwhen the outcome is yes/no (0/1) or a count.TEST_PEARSON_Rwhen you only want how closely two numeric fields follow a straight line together.
Glossary: credible-interval, heteroscedasticity, independence, listwise-deletion, multicollinearity, normal-distribution, posterior, prior, r-squared, regression-coefficient, residual
Validated against:
- R 4.6.1 matrix algebra for the normal-inverse-gamma posterior — tolerance 1e-10 relative;
internal/processing/regression/bayes_reference_test.go,internal/processing/regression/bayes_precision_test.go - R 4.6.1 closed form of Müller’s sandwich posterior with the per-entity Newey–West (
covariancehac + entity) and Driscoll–Kraay meats (at prior precision 0 asserted equal tosandwich3.1-3vcovPLonlm), unweighted and frequency-weighted — tolerance 1e-10 relative;internal/service/regression_covariance_panel_test.go - R 4.6.1 closed form of Müller’s sandwich posterior with the two-way cluster meat (at prior precision 0 asserted equal to
sandwich3.1-3vcovCL(cluster = ~a + b)onlm), unweighted and frequency-weighted — tolerance 1e-10 relative;internal/service/regression_covariance_twoway_test.go - R 4.6.1 on
rep()-expanded rows (frequency weights); closed form with scipy 1.16.2 tails, cross-checked with statsmodels (probability weights) — tolerance 1e-12 relative;internal/service/weight_reference_values_test.go,internal/service/weight_reference_tests_test.go
Skill: op-reg-bayes-linear
REG_GLM
Fits a generalized linear model: logistic for yes/no outcomes, Poisson or negative binomial for counts, gamma for positive skewed amounts.
Level: advanced
Also known as: generalized linear model, logistic regression, poisson regression, glm
Questions it answers:
- Which customer traits are associated with the chance of churning, holding the others fixed?
- How does the expected number of support tickets change with account size?
Use cases by domain:
- survey: Relate a yes/no answer (would recommend) to respondent attributes.
- ops: Model the count of incidents per site from traffic and staffing.
- science: Relate the probability of a response to dose and age.
Assumptions:
- Rows are independent of each other: repeated rows for the same customer, or values over time, make the reported uncertainty too small.
- The family must match the outcome: binomial needs a 0/1 (or packed_bool) target, Poisson and negative binomial non-negative counts, gamma positive values.
- The link must suit the outcome (each family takes its own: logit, probit or cloglog for binomial; log, identity or sqrt for counts; inverse, log or identity for gamma); the predictors act linearly on that link scale, and margins converts the effects to the outcome’s units.
- Each p-value tests the null hypothesis that its coefficient is 0 given the other predictors: a Wald z with the dispersion fixed at 1 for binomial, Poisson and negative binomial, where overdispersed counts (variance above the mean) make Poisson p-values too small and negative binomial models that extra spread; a Student t on the residual df for gamma, whose dispersion is estimated from the data as R’s glm does.
- params.covariance swaps in robust (hc0 to hc3), clustered or hac standard errors behind the p-values.
- If a predictor separates the 0s from the 1s perfectly in a logistic model, the fit cannot converge and Pulse refuses it.
- A coefficient describes association with the outcome, holding the other predictors fixed; it shows a causal effect only when the design supports one (for example random assignment), never from the fit alone, and a predictor left out of the model can drive both.
- Strongly related predictors (multicollinearity) make coefficients unstable and their uncertainty large; Pulse refuses an exactly collinear set.
- Predictors must be numeric: encode a category as 0/1 fields first (FEAT_ONE_HOT) and leave one level out, or the fields are collinear with the intercept.
- Rows with a null target or predictor are dropped before fitting (listwise deletion); n_obs counts the rows used.
Use something else:
REG_OLSwhen the outcome is a numeric measure with roughly symmetric, constant-spread residuals.TEST_PROP_Zwhen you only want to know whether a yes/no rate differs between two groups.TEST_CHISQwhen the outcome and the single predictor are both categories.
Glossary: deviance, generalized-linear-model, independence, link-function, listwise-deletion, logistic-regression, marginal-effect, multicollinearity, null-hypothesis, odds-ratio, overdispersion, p-value, pseudo-r-squared, regression-coefficient, skew, standard-error
Validated against:
- R 4.6.1
glm(binomial-logit, poisson-log, gamma-inverse) — tolerance 1e-10 relative;internal/processing/regression/glm_irls_test.go,internal/processing/regression/glm_gamma_oracle_test.go - R 4.6.1
glm(binomial probit / cloglog, poisson identity / sqrt, gamma log / identity: coefficients, standard errors, vcov, deviance, null deviance, AIC, dispersion, fitted means, working residuals), refitted to its fixed point — tolerance 1e-9 relative;internal/processing/regression/glm_links_oracle_test.go - R 4.6.1
glm(weights = f)against itsrep()-expanded fit (probit, poisson sqrt, gamma log; frequency weights) — tolerance 1e-9 relative;internal/processing/regression/glm_links_oracle_test.go - R 4.6.1
logLik/AICof binomial-logit, poisson-log and gamma-inverseglm(two_log_lik, aic; gamma’s dispersion at deviance / n counted); the non-canonical links’AICagainstglm_links.json, the negative binomial’s againstglm_nb.json— tolerance 1e-10 relative;internal/processing/regression/loglik_oracle_test.go,internal/processing/regression/glm_links_oracle_test.go - R 4.6.1
logLik/AICofglm(weights = f)against itsrep()-expanded fit (binomial, poisson, gamma; frequency weights) — tolerance 1e-10 relative;internal/processing/regression/loglik_oracle_test.go - R 4.6.1
glmnet(penalties) — tolerance 1e-10 relative;internal/processing/regression/glm_penalty_test.go - R 4.6.1 +
mpath0.4-2.28glmregNB(U69 #638): the penalized negative binomial — l2 / l1 / elasticnet, unpenalized predictors, θ re-estimated bytheta.mlaround the penalized fit or fixed — coefficients, θ, the l2 penalized-Fisher sandwich standard errors and SE(θ), deviance, and the penalized hat (bound fit andATTR_REG_LEVERAGErefit) — tolerance 1e-8 relative;internal/processing/regression/glm_nb_penalty_oracle_test.go - R 4.6.1 +
mpath0.4-2.28glmregNB(weights = f)(penalized negative binomial; frequency weights) — tolerance 1e-8 relative;internal/processing/regression/glm_nb_penalty_oracle_test.go - R 4.6.1 + MASS 7.3-66 (U69 #638): the negative binomial under
selectionandresample, θ re-estimated in every candidate and replicate —stepAIConglm.nb(forward / backward / both, AIC / BIC: final terms and the final model’s coefficients, θ, SE(θ)), a fixed θ against the exact greedy overglm(negative.binomial(θ)); base-Rglm.nbreplicate loops (leave-one-out, delete-a-cluster and frequency-weighted jackknife, a bootstrap over R’s own index sets): the coefficients’ and θ̂’s replicate SE, ame / mem effects’ replicate SE — tolerance 1e-6 relative;internal/processing/regression/glm_nb_refit_oracle_test.go - R 4.6.1
sandwich(robust standard errors; vcov) — tolerance 1e-11 relative;internal/service/regression_covariance_glm_test.go,internal/service/regression_vcov_test.go - R 4.6.1 +
sandwich3.1-3vcovPLon binomial-logit and poisson-logglmrefitted from the polished MLE: per-entity Newey–West (covariancehac + entity) and Driscoll–Kraay standard errors, Wald p-values, intervals and vcov over an unbalanced panel — unweighted, frequency- and probability-weighted (w* prior weights) — tolerance 1e-10 relative;internal/service/regression_covariance_panel_test.go - R 4.6.1 +
sandwich3.1-3vcovCL(cluster = ~a + b)on binomial-logit and poisson-logglmrefitted from the polished MLE: two-way cluster standard errors, Wald p-values, intervals and vcov (negative variances kept, null standard errors) — unweighted, frequency- and probability-weighted — tolerance 1e-10 relative;internal/service/regression_covariance_twoway_test.go - R 4.6.1
sandwich3.1-3vcovHCHC0 / HC1 / HC3 on the non-canonical links — tolerance 1e-9 relative;internal/processing/regression/glm_links_oracle_test.go - R 4.6.1 + MASS 7.3-66
glm.nb(negative binomial, θ estimated on log / sqrt / identity, pushed to its fixed point) andglm(negative.binomial(θ))(θ fixed): coefficients, standard errors and vcov at dispersion 1, θ, SE(θ), twice the log-likelihood, AIC, deviance, null deviance, fitted means, residuals;sandwich3.1-3vcovHCHC0 / HC1 / HC3 — tolerance 1e-9 relative;internal/processing/regression/glm_nb_oracle_test.go - R 4.6.1 + MASS 7.3-66
glm.nb(weights = f)against itsrep()-expanded fit (negative binomial, log link; frequency weights) — tolerance 1e-9 relative;internal/processing/regression/glm_nb_oracle_test.go - R 4.6.1 + MASS 7.3-66
summary(glm(negative.binomial(θ)))(θ fixed,dispersion: estimated, log / sqrt link): φ̂ = Pearson χ²/df, vcov and standard errors scaled by it, t p-values on df, Wald-t intervals — tolerance 1e-9 relative;internal/processing/regression/glm_nb_oracle_test.go - R 4.6.1 + MASS 7.3-66
summary(glm(negative.binomial(θ)))on therep()-expanded fit (θ fixed,dispersion: estimated; frequency weights) — tolerance 1e-9 relative;internal/processing/regression/glm_nb_oracle_test.go - R 4.6.1 + MASS 7.3-66 +
sandwich3.1-3: analytic marginal effects (margins: ame / mem, response / link scale) of logit, probit, cloglog, poisson, gamma inverse / log and negative binomialglmfits — the mean of β·μ′(η), the delta-method Jacobian onvcov,vcovHCHC3 andvcovCL— with statistics, p-values and intervals, and underbinary: "contrast"a 0/1 term’s μ(1) − μ(0); cross-checked againstmarginaleffects1.0.0avg_slopes/slopes(newdata = "mean")(its 1 − 0 contrast of a 0/1 term) at 1e-7 — tolerance 1e-9 relative;internal/processing/regression/margins_oracle_test.go - R 4.6.1 manual replicate loops: marginal effects under
resample(U69 #639) — logit / probit / poissonglmame, mem and the 0/1 contrast, leave-one-out, delete-a-cluster and frequency-weighted jackknife and a bootstrap over R’s own index sets, each replicate refitting and re-estimating the effect; replicate SE, Wald / percentile p-values and normal intervals — tolerance 1e-7 relative;internal/processing/regression/margins_resample_oracle_test.go - R 4.6.1 analytic marginal effects of
glm(weights = f)(logit ame / mem) against itsrep()-expanded fit, andmarginaleffectsavg_slopes(wts = "f")— tolerance 1e-9 relative;internal/processing/regression/margins_oracle_test.go - R 4.6.1 + MASS 7.3-66 +
car3.1-5vif(collinearity: VIF, tolerance, generalized VIF of a factor’s dummies, df, GVIF^(1/(2 df))) on binomial-logit, poisson-log, fixed-θ negative binomial and gamma-logglmfits refitted to their fixed point (basis model: the IRLS working weights), and onlmover the same predictors and prior weights (basis predictors); end to end throughFEAT_ONE_HOT— tolerance 1e-10 relative;internal/processing/regression/vif_oracle_test.go,collinearity_test.go - R 4.6.1 +
car3.1-5vif(glm(weights = w)): frequency weights against therep()-expanded fit (logit, poisson basis predictors), probability weights (gamma log) scale-free — tolerance 1e-10 relative;internal/processing/regression/vif_oracle_test.go - R 4.6.1 + MASS 7.3-66 +
sandwich3.1-3 +lmtest0.9-40: the Compose nested-model comparison (compare) of twoglmfits refitted to their fixed point —anova(m0, m1, test = "LRT" | "F")on logit, probit, poisson, gamma inverse / log and fixed-θ negative binomial fits (the full fit’s Pearson dispersion), MASSanova.negbin(θ estimated, 2 loglik change; cross-checked againstlrtest),waldtest(m0, m1, vcov = vcov | vcovHC(type = "HC3"), test = "Chisq" | "F")— tolerance 1e-10 relative;internal/service/compose_compare_oracle_test.go,compare_test.go - R 4.6.1
anovaof therep()-expandedglmfits (poisson LRT, gamma log F; frequency weights) — tolerance 1e-10 relative;internal/service/compose_compare_oracle_test.go - R 4.6.1 +
lmtest0.9-40: the Compose nested-model comparison of two sweep-boundglmfits (U69 #643) — R ranks every candidate row window by a full-model coefficient, picks the same winner and runsanova(m0, m1, test = "LRT")(poisson) orwaldtest(m0, m1, test = "Chisq")(logit) on its rows — tolerance 1e-10 relative;internal/service/compose_compare_sweep_oracle_test.go - R 4.6.1 +
car3.1-5: the Compose Wald comparison over a resampledglmfit (U69 #642) — manual delete-a-cluster and leave-one-out jackknife and a bootstrap over R’s own index sets of the full logit / poisson / gamma log model,linearHypothesis(m1, vcov. = V, test = "Chisq")on the replicate covariance V (1e-6 on the gamma log link, whose IRLS converges linearly) — tolerance 1e-9 relative;internal/processing/regression/compare_resample_oracle_test.go,compare_resample_test.go - R 4.6.1 on
rep()-expanded rows (frequency weights); closed form with scipy 1.16.2 tails, cross-checked with statsmodels (probability weights) — tolerance 1e-12 relative;internal/service/weight_reference_values_test.go,internal/service/weight_reference_tests_test.go
Validation gap: Penalized fits on a non-canonical link are checked by their KKT conditions, not against glmnet. Off the canonical link IRLS converges linearly, so at the default tol (1e-8) the coefficients sit within about 1e-7 of the MLE; the oracle fits at tol 1e-13. The negative binomial refuses selection and resample (no oracle); its penalized fit is pinned on the log link only (mpath fits no other); its probability-weighted fit is checked for scale invariance only. Marginal effects are slopes only (no discrete factor contrasts: regressions take no factor predictors; a 0/1 dummy gets its slope, where marginaleffects reports a 1 − 0 contrast, so that cross-check skips it) and are refused over a predictor derived from another predictor, a penalty, selection or bounds; under resample they are re-estimated per replicate (margins_resample.json). The collinearity block’s penalized basis-predictors figure is checked equal to the unpenalized one (a design figure), not against an external penalized VIF. A nested-model comparison under a probability weight runs the Wald test only (F / LRT refused), checked against its own covariance rather than an external survey test.
Skill: op-reg-glm
REG_MMM_BAYES
Fits a media-mix model with intervals: each channel’s carry-over, response curve and return on spend, beside linear controls.
Level: advanced
Also known as: bayesian media mix model, bayesian marketing mix model, bayesian mmm
Questions it answers:
- What return does each marketing channel earn, and how sure are we?
- How long does each channel’s effect carry over?
Use cases by domain:
- ops: Which channels earn their spend, with intervals, before moving budget.
Assumptions:
- The rows are one market’s series, one row per period with contiguous integer times: a gap or a repeated period is refused. Each period’s noise is independent of the others once the carry-over is modelled: leftover dependence over time makes the intervals too narrow.
- Each channel is raw spend, carried over inside the model over max_lag periods by one adstock kernel (geometric by default; delayed or Weibull when the effect peaks later), so its shape is estimated with everything else.
- Each channel’s effect follows one Hill curve, rising from 0 and flattening toward its coefficient; the controls enter in a straight line.
- The priors shape the answer where the data are thin: an experiment’s ROI is the honest prior to set.
- A coefficient describes association with the outcome, holding the other predictors fixed; it shows a causal effect only when the design supports one (for example random assignment), never from the fit alone, and a predictor left out of the model can drive both.
- Rows with a null target or predictor are dropped before fitting (listwise deletion); n_obs counts the rows used.
Use something else:
REG_MMM_HILLwhen a fast point estimate over already-adstocked channels is enough, or the fit must be saved, scored or optimised.
Glossary: listwise-deletion, regression-coefficient
Validated against:
REG_BAYES_LINEAR’s closed-form conjugate posterior (R 4.6.1 matrix algebra), in the conjugate limit: adstock and curve pinned, flat priors (posterior means, SDs and σ), under each adstock kernel (geometric, delayed, weibull_cdf, weibull_pdf) with the Hill curve and under the logistic and Michaelis–Menten curves — tolerance within 4 Monte Carlo standard errors, seeded;internal/regmmm/bayes_conjugate_heavy_test.go- simulation-based calibration (Talts et al. 2018) on the default priors of every adstock kernel × saturation curve cell (4 × 3), and with a simulated lift test in the likelihood on two cells (geometric × hill, delayed × logistic): 200 seeded replicates per run, rank of the truth among 99 thinned draws — tolerance uniform rank histogram per parameter (χ² test, p ≥ 0.001 / parameters);
internal/regmmm/bayes_sbc_heavy_test.go WIN_DISTRIBUTED_LAG’s kernel weights (R 4.6.1decay^((l − peak)^2),pweibull,dweibullvia its oracle) for the in-model adstock; each saturation curve’s closed form and finite-difference partials; a closed-form log posterior and a finite-difference gradient for each kernel and curve, with and without lift tests (a closed-form window Δ in ROI and β mode) — tolerance bit-equal weights; curves 1e-14 absolute, partials 1e-7 relative; density and lift Δ 1e-9 relative; gradient 1e-6 relative;internal/regmmm/bayes_adstock_test.go,internal/regmmm/bayes_curve_test.go,internal/regmmm/bayes_model_test.go,internal/regmmm/bayes_lift_test.go- Stan (CmdStan 2.40.0 via cmdstanr 0.9.0, R 4.6.1) sampling the same model and default priors, written independently, on stored simulated series: one case per adstock kernel (geometric, delayed, weibull_cdf, weibull_pdf) × saturation curve (hill, logistic, michaelis_menten) cell, twelve in all, plus two with a lift test in the likelihood (a switch-off on geometric × hill, a +50% test on delayed × logistic) (posterior means of every coefficient and each channel’s ROI) — tolerance within 4.5 combined Monte Carlo standard errors in every case, seeded;
internal/regmmm/bayes_stan_oracle_heavy_test.go - Stan (CmdStan 2.40.0 via cmdstanr 0.9.0, R 4.6.1) sampling the geo-hierarchical model (
params.geo: non-centred partial pooling of each channel’s ROI and decay, HalfNormal(0.5) pooling scales, an intercept per geo), written independently, on two stored simulated three-geo × two-channel panels (geometric × hill) with curves shared and withper_geo_curves(posterior means of every coefficient — per-geo intercepts and β, population β, decay and curve, σ, every τ — each channel’s population ROI μ and its all-geo and per-geo ROI) — tolerance within 4.5 combined Monte Carlo standard errors, seeded;internal/regmmm/bayes_geo_stan_oracle_heavy_test.go - simulation-based calibration (Talts et al. 2018) of the geo-hierarchical model on a fixed three-geo × two-channel panel (geometric × hill, default priors), curves shared and with
per_geo_curves: 100 seeded replicates per variant (26 weeks per geo), rank of the truth among 99 thinned draws for every per-geo intercept, μ, τ and non-centred offset η — tolerance uniform rank histogram per parameter (χ² test, p ≥ 0.001 / parameters);internal/regmmm/bayes_geo_sbc_heavy_test.go - Stan (CmdStan 2.40.0 via cmdstanr 0.9.0, R 4.6.1) NUTS on two stored series of the one-market cross-check — geometric × hill, and delayed × logistic with a lift test — each fitted with
params.samplerhmc (static HMC,path_lengthπ/2, adapted step size) and the case’s params and seed (posterior means of every coefficient and the channel’s ROI) — tolerance within 4.5 combined Monte Carlo standard errors, seeded;internal/regmmm/bayes_hmc_heavy_test.go - simulation-based calibration (Talts et al. 2018) of the geometric × hill cell on the default priors with every replicate fitted by static HMC (
path_lengthπ/2, adapted step size): 200 seeded replicates, rank of the truth among 99 thinned draws — tolerance uniform rank histogram per parameter (χ² test, p ≥ 0.001 / parameters);internal/regmmm/bayes_hmc_heavy_test.go - synthetic data with known true parameters (internal/mmmfixture) — tolerance parameter recovery;
internal/regmmm/bayes_test.go
Validation gap: Static HMC (params.sampler hmc) is cross-checked against Stan on two one-market cells and calibrated on geometric × hill, at path_length π/2 only; the other cells and geo panels under HMC rest on the NUTS checks of the same density. The one-market Stan cross-check covers one channel and one control per kernel × curve cell at the default priors, and one lift test on two cells; the geo-hierarchical one covers three geos × two channels on geometric × hill only. Custom priors, β mode, several lift tests and the model-owned holdout are covered by the closed-form and calibration checks only; on a geo panel, lift tests and every kernel × curve cell but geometric × hill have no Stan or calibration check. The calibrations run with the outcome scale fixed, because the default priors are stated on the max-scaled outcome and so move with the data.
Skill: op-reg-mmm-bayes
REG_MMM_HILL
Fits a media-mix model: each marketing channel’s effect and response curve (where its spend stops paying off), jointly with linear controls.
Level: advanced
Also known as: media mix model, marketing mix model, mmm
Questions it answers:
- What does each marketing channel contribute to sales, holding price and the other channels fixed?
- At what weekly spend does each channel saturate?
Use cases by domain:
- ops: Estimate which channels earn their spend, as the curves a budget split is then optimised over.
Assumptions:
- Rows are independent of each other: repeated rows for the same customer, or values over time, make the reported uncertainty too small.
- Each channel is spend already carried over from earlier periods (adstocked upstream, for example by WIN_DISTRIBUTED_LAG, the decay searched outside the model), or, with params.adstock, raw spend the model carries over itself, its decay fitted with the curves over rows in time order.
- Each channel’s effect follows one Hill curve, rising from 0 and flattening toward its coefficient; the controls enter in a straight line.
- A channel’s coefficient is held at 0 or above by default, so a channel the data do not support comes back exactly 0.
- A coefficient describes association with the outcome, holding the other predictors fixed; it shows a causal effect only when the design supports one (for example random assignment), never from the fit alone, and a predictor left out of the model can drive both.
- A channel whose spend never reaches its half-saturation leaves its curve weakly pinned down even when its total contribution is right.
- Rows with a null target or predictor are dropped before fitting (listwise deletion); n_obs counts the rows used.
Use something else:
REG_OLSwhen the outcome moves in a straight line with spend, with no saturation.
Glossary: independence, listwise-deletion, regression-coefficient, standard-error
Validated against:
minpack.lm::nlsLM1.2-4 on the same objective, start and bounds (coefficients, standard errors, R², residual SE) — tolerance 1e-6 relative (the solver’s stop rule);internal/regmmm/hill_oracle_test.gominpack.lm::nlsLM1.2-4 on the same joint objective, start and boxes underparams.adstock, one case per kernel — geometric, delayed, weibull_cdf, weibull_pdf — its weights written independently (closed forms;stats::pweibull/dweibull), cross-checked againstnls.lmon an analytic Jacobian (coefficients incl. the kernel parameters, standard errors, R², residual SE) — tolerance 1e-6 relative (the solver’s stop rule);internal/regmmm/hill_adstock_oracle_test.go- synthetic data with known true parameters (internal/mmmfixture) — tolerance 0.5% to 15% relative, per parameter;
internal/regmmm/hill_test.go - synthetic series with a known kernel per
params.adstockvalue (recovery within 3 SE), WIN_DISTRIBUTED_LAG’s weights (distlagparams.Resolve, unnormalised) and central differences of the residual Jacobian — tolerance bit-equal weights; Jacobian 1e-5 relative; recovery within 3 standard errors;internal/regmmm/hill_adstock_test.go
Skill: op-reg-mmm-hill
REG_MULTINOMIAL
Fits a model of an outcome with three or more categories (which plan, brand or channel), comparing each with a reference category.
Level: advanced
Also known as: multinomial logistic regression, multinomial logit, mlogit, multinom
Questions it answers:
- Which customer traits are associated with choosing the premium or the basic plan over the standard one, holding the others fixed?
- How does the chance of each support channel being picked change with the customer’s age?
Use cases by domain:
- survey: Relate the brand a respondent prefers to their age and income, against a reference brand.
- ops: Model which of several resolution paths a ticket takes from its size and queue.
- science: Relate the class an observation falls in to measured covariates.
Assumptions:
- Rows are independent of each other: repeated rows for the same customer, or values over time, make the reported uncertainty too small.
- The target is a categorical field: its levels, in dictionary order, are the categories; a level no fitted row carries is dropped.
- Each category other than the reference has its own coefficients: the change in the log odds of that category against the reference per unit of the predictor, holding the others fixed.
- The odds between any two categories do not depend on the other categories offered (independence of irrelevant alternatives).
- Each p-value tests the null hypothesis that its coefficient is 0 given the other predictors, as a Wald z.
- params.covariance swaps in robust (hc0, hc1) or clustered standard errors behind the p-values.
- If a predictor separates a category from the reference perfectly, the fit cannot converge and Pulse refuses it.
- A coefficient describes association with the outcome, holding the other predictors fixed; it shows a causal effect only when the design supports one (for example random assignment), never from the fit alone, and a predictor left out of the model can drive both.
- Strongly related predictors (multicollinearity) make coefficients unstable and their uncertainty large; Pulse refuses an exactly collinear set.
- Predictors must be numeric: encode a category as 0/1 fields first (FEAT_ONE_HOT) and leave one level out, or the fields are collinear with the intercept.
- Rows with a null target or predictor are dropped before fitting (listwise deletion); n_obs counts the rows used.
Use something else:
REG_GLMwhen the outcome has two categories (yes/no).REG_OLSwhen the outcome is numeric.TEST_CHISQwhen you only want to know whether the categories are spread differently across a grouping category.
Glossary: deviance, independence, listwise-deletion, logistic-regression, multicollinearity, null-hypothesis, odds-ratio, p-value, pseudo-r-squared, regression-coefficient, standard-error
Validated against:
- R 4.6.1 +
nnet7.3-21multinom, Newton-polished to the MLE: coefficients, standard errors (solve(Hessian)), Wald p-values and intervals, vcov, deviance, null deviance, two_log_lik, aic and every row’s fitted probabilities; a named reference, a dictionary level no row carries (dropped) — tolerance 1e-10 relative;internal/processing/regression/multinomial_oracle_test.go - R 4.6.1 +
nnet7.3-21multinom(weights = f)against itsrep()-expanded fit (frequency weights) andmultinom(weights = w*), w* = w·n_eff/Σw (probability weights, no likelihood) — tolerance 1e-10 relative;internal/processing/regression/multinomial_oracle_test.go - R 4.6.1 +
nnet7.3-21fitted(multinom)andpredict(multinom, newdata, type = "probs")at the polished MLE (agreeing to 1e-6 with multinom’s own optimum): the ATTR_REG_PREDICT row scores — P(y = category) and the log-odds against the reference — of the training rows and of a grid of new rows, through the bound fit’s scorer; the class, the saved-and-reloaded model file and the Composefitsbinding end to end — tolerance 1e-10 relative;internal/processing/regression/multinomial_oracle_test.go,internal/processing/regression/multinomial_score_test.go,multinomial_score_test.go - R 4.6.1 +
nnet7.3-21fitted/predict(type = "probs")of the frequency- and probability-weighted fits (the row scores read the weighted MLE) — tolerance 1e-10 relative;internal/processing/regression/multinomial_oracle_test.go - R 4.6.1 +
nnet7.3-21predict(multinom, newdata, type = "probs")on labelled held-out rows: theholdoutproper scores — log loss, multi-class Brier and accuracy — as weighted closed forms (a row at a dropped level unscored), unweighted, frequency- and probability-weighted, through the engine’s holdout kernel — tolerance 1e-10 relative;internal/processing/regression/multinomial_oracle_test.go - R 4.6.1 +
nnet7.3-21multinom, the manual-deletion jackknife: every leave-one-out and delete-a-cluster refit polished to its MLE (each agreeing withmultinomon the same deletion to 1e-6), the jackknife standard errors of every “<level>:<term>” coefficient; MASS 7.3-66stepAIConmultinom(forward / backward / both, k = 2 and log(n), a term entering or leaving across every category): the selected terms (forward in entry order) and the final model’s MLE and deviance —resampleandselection, every refit at the full fit’s categories and reference — tolerance 1e-8 relative;internal/processing/regression/multinomial_modifiers_test.go - R 4.6.1 +
glmnet5.1family = "multinomial",type.multinomial = "ungrouped",standardize = FALSE, Newton-polished on the active set and KKT-checked against the stated objective: thepenalty(l2/l1/elasticnet,unpenalizedon each) symmetric coefficients of every category (intercepts centred, exact zeros exactly), deviance, null deviance, and a grid’s probabilities and per-category linear predictors through the bound fit’s scorer — tolerance 1e-10 relative;internal/processing/regression/multinomial_penalty_test.go - R 4.6.1 +
glmnet5.1glmnet(weights = f)(frequency-weighted elastic net) — tolerance 1e-10 relative;internal/processing/regression/multinomial_penalty_test.go - R 4.6.1 +
nnet7.3-21exp(coef(multinom))and the delta method: theexponentiaterelative-risk ratios exp(β), their standard errors exp(β)·SE and the exponentiated Wald interval, classical and under the hc0, hc1 and cluster sandwich — unweighted, frequency- and probability-weighted — tolerance 1e-10 relative;internal/processing/regression/multinomial_exponentiate_test.go - R 4.6.1 +
nnet7.3-21multinom, the closed-form score sandwich B·M·B at the polished MLE (B = solve(Hessian), unit score (y − π) ⊗ x over the non-reference blocks; R’ssandwichhas no multinom method): thecovariancehc0, hc1 and cluster (CR1) standard errors, Wald p-values, intervals and vcov — unweighted, frequency- and probability-weighted (w* in the meat) — tolerance 1e-10 relative;internal/processing/regression/multinomial_oracle_test.go - R 4.6.1 +
nnet7.3-21: analytic per-category marginal effects (margins: ame / mem, response and link scale) at the polishedmultinomMLE — π_k(β_kj − Σπ_mβ_mj), the delta-method gradient (checked against a central difference) on the classical, hc1 and cluster covariance — with Wald statistics, p-values and intervals, a named reference; cross-checked againstmarginaleffects1.0.0avg_slopes/slopes(type = "probs")onmultinomset to that MLE at 1e-7 — tolerance 1e-9 relative;internal/processing/regression/multinomial_margins_test.go - R 4.6.1 analytic multinomial margins of
multinom(weights = f)(ame / mem) against itsrep()-expanded fit, and ofmultinom(weights = w*), withmarginaleffectsavg_slopes(wts =)— tolerance 1e-9 relative;internal/processing/regression/multinomial_margins_test.go - R 4.6.1 +
nnet7.3-21 +car3.1-5: theterm_testsjoint Wald χ² of each predictor’s K − 1 coefficients (car::linearHypothesison the classical covariance; the closed form on each hc0 / hc1 / cluster sandwich) and the likelihood-ratio χ² against the polished refit without it (car::Anova(multinom), type II, at 1e-6), their χ² p-values — unweighted, frequency- and probability-weighted (no LR) — tolerance 1e-10 relative;internal/processing/regression/multinomial_margins_test.go - R 4.6.1 +
nnet7.3-21anova.multinom: the Compose nested-model comparison (compare) of twomultinomfits polished to their MLE — the likelihood ratio (deviance change on χ² with df = (K − 1) per added predictor, each fit’s residual df (K − 1)·N* − edf and deviance; a named reference) and the Wald test over every “<level>:<term>” coefficient of the added predictors on the full fit’s analytic or hc1 covariance (the classical one cross-checked against the same Wald onvcov(multinom)at 1e-4) — tolerance 1e-10 relative;internal/service/compose_compare_oracle_test.go,compare_multinomial_test.go - R 4.6.1 +
nnet7.3-21anova.multinomof therep()-expandedmultinomfits (frequency weights; residual df (K − 1)·Σw − edf) — tolerance 1e-10 relative;internal/service/compose_compare_oracle_test.go - R 4.6.1 on
rep()-expanded rows (frequency weights); closed form with scipy 1.16.2 tails, cross-checked with statsmodels (probability weights) — tolerance 1e-12 relative;internal/service/weight_reference_values_test.go,internal/service/weight_reference_tests_test.go
Validation gap: The robust covariance is checked against its closed form in R, not an independent package (sandwich has no multinom method); hc2 / hc3 / hac are refused, not validated. A penalised fit has no analytical inference (null standard errors, p-values and intervals; vcov refused); its resampled figures are pinned against the manual-deletion jackknife over fresh penalised fits, not an R oracle, and an even category count under pure l1 (glmnet’s median centring) is checked for the centring rule, not against glmnet. The probability-weighted fit is multinom on the rescaled weights, not a design-based survey estimator. The bootstrap has no R oracle (its replicates are Pulse’s seeded draws): it is pinned seed-stable and worker-invariant, and its category-loss skip by construction; the weighted jackknife (JK1) has no R oracle either. Selection candidates can fit different rows when a predictor has nulls (each candidate fits the rows its predictors admit, a row at a category outside the first candidate’s not fitted), unlike stepAIC, which refuses a changed row count. Term_tests read the plain fit only, and margins beside a penalty or selection are refused, not validated; resampled margins (each replicate re-estimating the effects) are pinned against the coefficient table and Pulse’s own replicate fits, not an R oracle.
Skill: op-reg-multinomial
REG_OLS
Fits a straight-line model that predicts a numeric outcome from one or more numeric predictors, by least squares.
Level: intermediate
Also known as: linear regression, ordinary least squares, lm
Questions it answers:
- Which of price, discount and season are associated with weekly sales, holding the others fixed?
- How much does predicted order value change per extra visit, with the other predictors held fixed?
- How much of the variation in satisfaction do these attribute ratings account for together?
Use cases by domain:
- survey: Relate overall satisfaction to several attribute ratings at once (often called key-driver analysis, though it shows which ratings go with satisfaction, not which ones drive it).
- ops: Model ticket handling time from queue length and agent tenure.
- science: Estimate how a measured response changes with dose while adjusting for body weight.
Assumptions:
- Rows are independent of each other: repeated rows for the same customer, or values over time, make the reported uncertainty too small.
- The outcome changes linearly with each predictor; model a curve by adding transformed predictors (FEAT_POLY, FEAT_LOG).
- Residuals have roughly constant spread for the default classic standard errors; params.covariance swaps in heteroscedasticity-robust (hc0 to hc3), clustered (repeated rows per unit) or autocorrelation-robust (hac, values over time) ones. With few rows the residuals should also be roughly normal for the p-values to hold.
- Each p-value tests the null hypothesis that its coefficient is 0 given the other predictors, on a t distribution with n - p - 1 degrees of freedom (p predictors).
- A coefficient describes association with the outcome, holding the other predictors fixed; it shows a causal effect only when the design supports one (for example random assignment), never from the fit alone, and a predictor left out of the model can drive both.
- Strongly related predictors (multicollinearity) make coefficients unstable and their uncertainty large; Pulse refuses an exactly collinear set.
- Penalized fits (l1, l2, elasticnet) shrink coefficients toward 0 by design, so their p-values lose the usual reading; l1 and elasticnet fits report no standard errors or p-values (null) because the data pick the predictors.
- Predictors must be numeric: encode a category as 0/1 fields first (FEAT_ONE_HOT) and leave one level out, or the fields are collinear with the intercept.
- Rows with a null target or predictor are dropped before fitting (listwise deletion); n_obs counts the rows used.
Use something else:
REG_GLMwhen the outcome is yes/no (0/1) or a count.REG_BAYES_LINEARwhen you want intervals that combine the data with prior knowledge about the coefficients.TEST_PEARSON_Rwhen you only want how closely two numeric fields follow a straight line together.TEST_ANOVA_Fwhen the predictor is a set of groups and you want to know whether the group averages differ.ATTR_REG_RESIDUALwhen you want each row’s residual, to check the residual assumptions or find rows the model fits badly.
Glossary: adjusted-r-squared, degrees-of-freedom, heteroscedasticity, independence, listwise-deletion, multicollinearity, normal-distribution, null-hypothesis, outlier, overfitting, p-value, r-squared, regression-coefficient, residual, standard-error
Validated against:
- NIST StRD certified values (linear regression: Norris, Pontius, NoInt1–2 (intercept: false), Filip, Longley, Wampler1–5) — tolerance digits achieved per dataset (see the NIST table);
strd_reference_test.go - R 4.6.1
lm— tolerance 1e-10 relative;internal/processing/regression/ols_lm_reference_test.go - R 4.6.1
glmnet(penalties),nnls(non-negative) — tolerance 1e-10 relative;internal/processing/regression/ols_penalty_reference_test.go,internal/processing/regression/ols_nnls_reference_test.go - R 4.6.1
sandwich/lmtest(HC0–HC3, cluster, HAC standard errors; vcov) — tolerance 1e-10 relative;internal/service/regression_covariance_test.go,internal/service/regression_vcov_test.go - R 4.6.1 +
sandwich3.1-3vcovPL(aggregate FALSE / TRUE), cross-checked byplm2.6-7vcovNW/vcovSCC(type HC1) on the pooling fit: per-entity Newey–West (covariancehac + entity) and Driscoll–Kraay standard errors, t p-values, intervals and vcov over an unbalanced panel with gaps — unweighted, frequency- and probability-weighted (vcovPL on lm(weights = w*), adjust FALSE, × N*/(N* − k)) — tolerance 1e-10 relative;internal/service/regression_covariance_panel_test.go - R 4.6.1 +
sandwich3.1-3vcovCL(cluster = ~a + b, type = "HC1")(multi0 FALSE): two-way cluster (covariancecluster + cluster2) standard errors, t p-values on min(G₁, G₂) − 1 df, intervals and vcov, negative variances kept with null standard errors — unweighted, frequency- (and itsrep()expansion) and probability-weighted (vcovCL HC0 on lm(weights = w*) × (N* − 1)/(N* − k)) — tolerance 1e-10 relative;internal/service/regression_covariance_twoway_test.go - R 4.6.1
logLik/AICoflmwith and without an intercept (two_log_lik, aic; σ counted) — tolerance 1e-10 relative;internal/processing/regression/loglik_oracle_test.go - R 4.6.1
logLik/AICof therep()-expandedlm(frequency weights;lm(weights = f)reads them as precision weights) — tolerance 1e-10 relative;internal/processing/regression/loglik_oracle_test.go - R 4.6.1 + MASS 7.3-66 +
sandwich3.1-3: analytic marginal effects (margins, ame / mem) oflmwith their delta-method standard errors, t statistics, p-values and intervals; cross-checked againstmarginaleffects1.0.0avg_slopes/slopes(newdata = "mean")at 1e-7 — tolerance 1e-9 relative;internal/processing/regression/margins_oracle_test.go - R 4.6.1 manual replicate loops: marginal effects under
resample(U69 #639) —lmleave-one-out jackknife and a bootstrap over R’s own index sets, each replicate refitting and re-estimating the effect; replicate SE, Wald / percentile p-values and normal intervals — tolerance 1e-7 relative;internal/processing/regression/margins_resample_oracle_test.go - R 4.6.1 +
car3.1-5vifonlm(collinearity: VIF, tolerance and, over a factor’s dummies grouped as one term, Fox & Monette’s generalized VIF, df and GVIF^(1/(2 df)); the closed form re-derived from the weighted design) — tolerance 1e-10 relative;internal/processing/regression/vif_oracle_test.go,collinearity_test.go - R 4.6.1 +
car3.1-5vif(lm(weights = w)): frequency weights against therep()-expanded fit, probability weights scale-free — tolerance 1e-10 relative;internal/processing/regression/vif_oracle_test.go - R 4.6.1 +
sandwich3.1-3 +lmtest0.9-40: the Compose nested-model comparison (compare) of twolmfits —anova(m0, m1)F andtest = "Chisq",waldtest(m0, m1, vcov = vcov | vcovHC(type = "HC3")), a restricted fit through the origin; statistic, df, p-value, each fit’s residual df and RSS, σ̂² — tolerance 1e-10 relative;internal/service/compose_compare_oracle_test.go,compare_test.go - R 4.6.1
anovaof therep()-expandedlmfits (frequency weights; df = Σw − rank) — tolerance 1e-10 relative;internal/service/compose_compare_oracle_test.go - R 4.6.1 +
lmtest0.9-40: the Compose nested-model comparison of two sweep-boundlmfits (U69 #643) — R ranks every candidate row window by the full model’s residual standard error, picks the same winner and runsanova(m0, m1)on its rows; statistic, df, p-value, each fit’s residual df and RSS — tolerance 1e-10 relative;internal/service/compose_compare_sweep_oracle_test.go,compare_sweep_test.go - R 4.6.1 +
car3.1-5: the Compose Wald comparison over a resampledlmfit (U69 #642) — manual leave-one-out jackknife and a bootstrap over R’s own index sets of the full model,linearHypothesis(m1, vcov. = V, test = "Chisq")on the replicate covariance V; the covariance, statistic and p-value — tolerance 1e-9 relative;internal/processing/regression/compare_resample_oracle_test.go,compare_resample_test.go - R 4.6.1 on
rep()-expanded rows (frequency weights); closed form with scipy 1.16.2 tails, cross-checked with statsmodels (probability weights) — tolerance 1e-12 relative;internal/service/weight_reference_values_test.go,internal/service/weight_reference_tests_test.go
Validation gap: On NIST Wampler5 the coefficients reach 5.7 digits, level with LAPACK’s QR (5.6): the double-precision limit for its large residuals.
Skill: op-reg-ols
REG_ORDINAL
Fits a model that predicts an ordered rating (poor, fair, good) from numeric predictors, each shifting the whole scale up or down.
Level: advanced
Also known as: ordinal logistic regression, ordered logit, proportional odds model, polr
Questions it answers:
- Which customer traits are associated with a higher satisfaction rating, holding the others fixed?
- How much more likely is a top rating per extra year of tenure?
- Does each predictor shift every step of the rating scale by the same amount?
Use cases by domain:
- survey: Relate a 1-5 agreement or satisfaction rating to respondent attributes without treating the scale as evenly spaced numbers.
- ops: Model a ticket’s severity grade (low, medium, high, critical) from its queue and size.
- science: Relate a graded response (none, mild, moderate, severe) to dose and age.
Assumptions:
- Rows are independent of each other: repeated rows for the same customer, or values over time, make the reported uncertainty too small.
- The levels are ordered: params.levels gives the order, else a categorical’s dictionary order or a number’s ascending values; an unordered outcome needs another model.
- Proportional odds: each predictor moves every threshold of the scale by the same amount (one coefficient per predictor); params.brant (logit) or params.nominal_test (any link) tests it, and a small p-value says some effect differs across the scale.
- The link sets the shape of the scale’s steps: logit (default) reads coefficients as log odds ratios, probit as shifts of a normal latent score, cloglog as log hazard ratios.
- Each p-value tests the null hypothesis that its coefficient is 0 given the other predictors, a Wald z on the fitted information.
- params.covariance swaps in robust (hc0, hc1) or clustered standard errors behind the p-values.
- A predictor that separates the levels perfectly makes the fit unable to converge, and Pulse refuses it.
- A coefficient describes association with the outcome, holding the other predictors fixed; it shows a causal effect only when the design supports one (for example random assignment), never from the fit alone, and a predictor left out of the model can drive both.
- Strongly related predictors (multicollinearity) make coefficients unstable and their uncertainty large; Pulse refuses an exactly collinear set.
- Predictors must be numeric: encode a category as 0/1 fields first (FEAT_ONE_HOT) and leave one level out, or the fields are collinear with the intercept.
- Rows with a null target or predictor are dropped before fitting (listwise deletion); n_obs counts the rows used.
Use something else:
REG_GLMwhen the outcome has only two values (yes/no).REG_OLSwhen the outcome is a numeric measure whose steps are evenly spaced.TEST_KRUSKAL_WALLISwhen you only want to know whether the ratings differ between groups.TEST_CHISQwhen the outcome and the single predictor are both categories.
Glossary: deviance, independence, link-function, listwise-deletion, multicollinearity, null-hypothesis, odds-ratio, p-value, pseudo-r-squared, regression-coefficient, standard-error
Validated against:
- R 4.6.1 + MASS 7.3-66
polr(logit / probit / cloglog), polished by Newton to its MLE: coefficients, thresholds, standard errors and vcov from the analytic observed information (polr’s numerical Hessian agrees to 1e-4), deviance, null deviance, two_log_lik, AIC, the mean fitted probabilities (colMeans(fitted()));sandwich3.1-3sandwich/vcovCL(HC0, HC1, CR1);brant0.3.0 (omnibus and per-predictor χ², the binary logits at their fixed point);params.levelsdropping an unlisted response asfactor(y, levels =)does — tolerance 1e-10 relative;internal/regordinal/oracle_test.go,internal/regordinal/ordinal_e2e_test.go - R 4.6.1 +
ordinal2026.7-26nominal_testonclm(andclm(nominal = ~ all)for the omnibus):params.nominal_test, the likelihood-ratio test of proportional odds against the partial proportional-odds fit, each partial fit polished by Newton to its MLE on the analytic derivatives (nominal_test agreeing to 1e-6), per predictor and omnibus, on logit / probit / cloglog; a pinned non-convergent case and a pinned crossing case null with their warnings — tolerance 1e-10, relative with a floor of 1 (the statistic is a log-likelihood difference);internal/regordinal/oracle_test.go,internal/regordinal/ordinal_e2e_test.go - R 4.6.1 +
ordinal2026.7-26clm(weights = f)nominal_test: frequency weights on logit, probit and cloglog, the partial fits against theirrep()expansion (a probability weight leaves the output absent: no likelihood) — tolerance 1e-10, relative with a floor of 1;internal/regordinal/oracle_test.go,internal/regordinal/ordinal_e2e_test.go - R 4.6.1 + MASS 7.3-66
polr(weights = f)against itsrep()-expanded fit, and the Brant test on the expansion (frequency weights) — tolerance 1e-10 relative;internal/regordinal/oracle_test.go,internal/regordinal/ordinal_e2e_test.go - R 4.6.1 + MASS 7.3-66
polr(weights = w*), w* = w·n_eff/Σw (probability weights: the frequency formulas on w*, no likelihood figures) — tolerance 1e-10 relative;internal/regordinal/oracle_test.go,internal/regordinal/ordinal_e2e_test.go - R 4.6.1 + MASS 7.3-66
predict(polr, type = "probs")and$lpat the polished MLE (agreeing to 1e-6 with polr’s own optimum): the ATTR_REG_PREDICT row scores — P(y = level), P(y ≤ level), the expected level, the class and xᵀβ — on the logit / probit / cloglog cases, through a bound fit and its saved-and-reloaded model file — tolerance 1e-10 relative;internal/regordinal/score_test.go,internal/regordinal/score_e2e_test.go - R 4.6.1 + MASS 7.3-66
predict(polr, type = "probs")of the frequency- and probability-weighted fits (the row scores read the weighted MLE) — tolerance 1e-10 relative;internal/regordinal/score_test.go,internal/regordinal/score_e2e_test.go - R 4.6.1 + MASS 7.3-66
predict(polr, newdata, type = "probs")on fixed held-out rows: theholdoutproper scores — log loss, multi-class Brier, accuracy and the ranked probability score — as weighted closed forms, unweighted, frequency- and probability-weighted, through a holdout fit end to end — tolerance 1e-10 relative;internal/regordinal/ordinal_e2e_test.go - R 4.6.1 + MASS 7.3-66
exp(coef(polr))and the delta method (exp(confint.default(polr))on the classical unweighted cases): theexponentiatecumulative odds ratios of the predictors, their standard errors exp(β)·SE and the exponentiated Wald interval, on every link, weighting and covariance (classical, hc0, hc1, cluster) — tolerance 1e-10 relative;internal/regordinal/exponentiate_e2e_test.go - R 4.6.1 + MASS 7.3-66
polr, the manual-deletion jackknife: every leave-one-out and delete-a-cluster refit polished to its MLE (each agreeing withpolron the same deletion to 1e-6), the jackknife standard errors of the predictors and thresholds;MASS::stepAIConpolr(forward / backward / both, k = 2 and log(n)): the selected terms (forward in entry order) and the final model’s MLE and deviance —resampleandselection, every refit at the full fit’s levels — tolerance 1e-8 relative;internal/regordinal/modifiers_e2e_test.go - R 4.6.1 + MASS 7.3-66
polrat its polished MLE +sandwich3.1-3: analytic per-level marginal effects (margins: ame / mem of each predictor on each level’s probability, −β·[f(ζ_k − η) − f(ζ_{k−1} − η)], and the link-scale −β) with their delta-method standard errors on the analytic, hc1 and CR1 covariances, Wald statistics, p-values and intervals, on logit / probit / cloglog; cross-checked againstmarginaleffects1.0.0avg_slopes/slopeson polr (Richardson Jacobian) at 1e-7 — tolerance 1e-9 relative;internal/regordinal/margins_oracle_test.go,internal/regordinal/margins_e2e_test.go - R 4.6.1 analytic per-level marginal effects of
polr(weights = f)(logit ame / mem) against itsrep()-expanded fit, andmarginaleffectsavg_slopes(wts = ".w")— tolerance 1e-9 relative;internal/regordinal/margins_oracle_test.go,internal/regordinal/margins_e2e_test.go - R 4.6.1 + MASS 7.3-66
anova.polr+sandwich3.1-3: the Compose nested-model comparison (compare) of twopolrfits polished to their MLE — the likelihood ratio (deviance change, df = added predictors, each fit’s residual df Σw − edf and deviance) and the Wald test on the full fit’s analytic or hc1 covariance (cross-checked against the same Wald onvcov(polr)/sandwich(polr, adjust = TRUE)at 1e-4); unweighted andpolr(weights = f)against itsrep()expansion — tolerance 1e-10 relative;internal/service/compose_compare_oracle_test.go,compare_ordinal_test.go
Validation gap: The Brant test’s omnibus statistic reads the symmetric covariance of the binary logits’ slopes (Brant 1990); brant 0.3.0 stores the (m, l) cross block untransposed at (l, m), so its omnibus figure differs (per-predictor statistics agree) — the oracle script reproduces the package’s figure exactly and pins the symmetric one. Penalty and collinearity are refused (no oracle), and covariance hc2 / hc3 / hac (no row-wise hat matrix, no series). Resampled margins (each replicate re-estimating the effects) are pinned against the coefficient table and Pulse’s own replicate fits, not an R oracle. The bootstrap has no R oracle (its replicates are Pulse’s seeded draws): it is pinned seed-stable and worker-invariant, and its level-loss skip by construction. Selection rows can differ across candidates when a predictor has nulls (each candidate fits the rows its predictors admit), unlike stepAIC, which refuses a changed row count. The nominal test nulls a figure whose partial fit crosses its cumulative probabilities at a fitted row or does not converge, where ordinal::nominal_test still prints a number (clm reports convergence code 1 at a separated split; at a crossing it prices only the observed levels); under a probability weight it is absent (no likelihood, as the multinomial term_tests LR).
Skill: op-reg-ordinal