Categorical Regression Splines
Overview
Regression splines that handle a mix of continuous and categorical (discrete) data often encountered in applied settings. I would like to gratefully acknowledge support from the Natural Sciences and Engineering Research Council of Canada (NSERC, https://www.nserc-crsng.gc.ca), the Social Sciences and Humanities Research Council of Canada (SSHRC, https://www.sshrc-crsh.gc.ca), and the Shared Hierarchical Academic Research Computing Network (SHARCNET, https://www.sharcnet.ca). We would also like to acknowledge the contributions of the GNU GSL authors. In particular, we adapt the GNU GSL B-spline routine gsl_bspline.c adding automated support for quantile knots (in addition to uniform knots), providing missing functionality for derivatives, and for extending the splines beyond their endpoints.
- Retired the duplicated
demo/spline.Rimplementation and its release-time copy step. The constrained mean, first-derivative, second-derivative, and bootstrap-test demos already use the exportedcrshat()operator backed by the canonical package implementation, so fitted and constraint arithmetic are unchanged while the package no longer ships a second copy of its spline engine. - Added the opt-in observed native NOMAD solve interface used by downstream packages for throttled progress heartbeats during long objective evaluations. The versioned C API reports evaluation and cooperative-activity events out of band, preserves the numerical solve and cache/accounting contracts, disables only observation after ordinary observer errors, and converts explicit user interruption into an orderly native stop. The original native solve entry point remains source- and binary-compatible.
Show all changes in 0.15-46Hide the rest of the changes in 0.15-46
- Hardened the public
clsd()scalar-condition contract forelastic.maxandNOMAD. Ambiguous vectors, empty values, missing values, and values which cannot be interpreted by the historical scalar operator semantics now fail early with argument-specific errors; valid logical and numeric scalar controls retain their existing search routes and fitted results. - Modernized
crsiv()andcrsivderiv()with training-grid formula/data interfaces (y ~ z | wandy ~ z | w | x), one authoritative row map for subset/NA/weights/starting values, collision-safe internal role names, and namespaced IV metadata. Added selected-statefitted(),residuals(), andpredict()semantics, structured summaries, corrected original-response plot overlays, and self-contained formula-based examples. Native evaluation interfaces and established CRS post-fit projection remain available; formula-time evaluation and formula-objectnewdataare deliberately deferred and fail clearly. - Corrected fitted-value centering throughout
crsivderiv()so both empirical terms of the Equation (14) adjoint use the same fitted conditional-residual vector. The initial adjoint had centered its second term on the raw residual, while the constructed-residual route also averaged the wrong constructed quantity in both initial and recursive states. This can materially change derivative trajectories, stopping states, and fitted curves, and removes catastrophic finite-sample losses observed under the malformed constructed-residual adjoint. - Made
crsivderiv()Landweber-Fridman states coherent with the estimator definition: iterationNnow stores the matched derivative, integrated curve, and stopping criterion after exactlyNupdates. Explicitstarting.valuesare the state used immediately before update 1, without a hidden preliminary update. Returnedphiandphi.prime, the reported iteration, and the summary stopping value now all refer to the selected state. This corrects the previous one-column mismatch between the curve and derivative histories; results can change when that mismatch affected state selection or extraction. - Corrected the private Gaussian integral operator used by
crsivderiv()so the empirical adjoint applies the ordinary kernel CDF required by Equation (14) of Florens, Centorrino, and Racine. The helper had multiplied the CDF average by the continuous bandwidth, producing the same malformed scaling implicated innpissue #57. Other spline fitting, bandwidth, stopping, optimizer, and public helper behavior is unchanged. - Hardened the observed native NOMAD interface so explicit user interruption has a dedicated status after orderly native cleanup, ordinary observer errors remain fail-open, and a failed callback cannot expose unwritten black-box output memory. Existing native ABI values, layouts, callable names, and successful-run numerical/accounting behavior are unchanged.
- Hardened native NOMAD interruption by limiting the operating-system signal handler to signal-safe state capture, consuming interruption from ordinary solver control flow, and restoring the prior process handler before return. Interrupt status now takes precedence when a solve is interrupted after an earlier callback failure, and R-callback failures retain their first trapped diagnostic in the bounded result message.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-05-17
- WARNING12 OK, 1 WARNING2026-05-13
- OK12 OK2026-04-25
Show 1 earlier changeHide 1 earlier change
- NOTE12 OK, 2 NOTE2026-03-10
Documentation
- Help pages
- 21includes a package overview page
- Examples that run
- 63%12 run in a plain check · 7 never run
- Exported functions with examples
- 100%
- Documented parameters
- 82%
- Return-value docs
- 100%
- Help pages citing references
- 81%
Also includes 14 demo scripts (run with demo())
Downloads
Repository
- PRs merged (all time)
- 40%
- Median days to close, 50 most recently updated closed issues
- 1
- Median days to close, 50 most recently updated closed PRs
- 1
Stars over time
Forks over time
Issues over time
PRs over time
Commits over time
Checks run against github.com/jeffreyracine/r-package-crs on 2026-10-18.
No development-tooling practices detected in the upstream repository.
Dependencies
Installing crs adds 3 packages (2 with compiled code, 1.4 MB of source tarballs). Heaviest: quantreg 903 KB, SparseM 540 KB, MatrixModels 24 KB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 0.15-46Latest
- 0.15-45
- 0.15-442026-06-01 · diff ↗
- 0.15-432026-05-15 · diff ↗
- 0.15-422026-05-01 · diff ↗
- RR 4.6.0 released · 2026-04-24
- 0.15-41
- 0.15-392026-01-29 · diff ↗
- RR 4.5.0 released · 2025-04-11
- 0.15-382024-09-29 · diff ↗
- RR 4.4.0 released · 2024-04-24
- RR 4.3.0 released · 2023-04-21
- 0.15-372023-01-07 · diff ↗
- 0.15-362022-10-19 · diff ↗
- 0.15-352022-10-09 · diff ↗
- RR 4.2.0 released · 2022-04-22
Show 46 earlier eventsHide 46 earlier events
- 0.15-342022-03-31 · diff ↗
- RR 4.1.0 released · 2021-05-18
- 0.15-332021-02-02 · diff ↗
- RR 4.0.0 released · 2020-04-24
- 0.15-31.12019-11-25 · diff ↗
- RR 3.6.0 released · 2019-04-26
- 0.15-312018-05-01 · diff ↗
- RR 3.5.0 released · 2018-04-23
- 0.15-302018-01-05 · diff ↗
- 0.15-292017-10-31 · diff ↗
- 0.15-282017-10-29 · diff ↗
- 0.15-272017-05-07 · diff ↗
- 0.15-262017-05-03 · diff ↗
- RR 3.4.0 released · 2017-04-21
- RR 3.3.0 released · 2016-05-03
- RR 3.2.0 released · 2015-04-16
- 0.15-242014-12-18 · diff ↗
- 0.15-232014-08-11 · diff ↗
- RR 3.1.0 released · 2014-04-10
- 0.15-222014-01-22 · diff ↗
- 0.15-212014-01-09 · diff ↗
- 0.15-202014-01-03 · diff ↗
- 0.15-19
- RR 3.0.0 released · 2013-04-03
- 0.15-182012-12-29 · diff ↗
- 0.15-172012-06-04 · diff ↗
- 0.15-162012-04-30 · diff ↗
- 0.15-152012-04-16 · diff ↗
- RR 2.15.0 released · 2012-03-30
- 0.15-142012-03-22 · diff ↗
- 0.15-13
- 0.15-122011-12-07 · diff ↗
- 0.15-112011-12-03 · diff ↗
- 0.15-92011-11-26 · diff ↗
- 0.15-82011-11-16 · diff ↗
- RR 2.14.0 released · 2011-10-31
- 0.15-72011-10-24 · diff ↗
- 0.15-62011-10-19 · diff ↗
- 0.15-42011-10-15 · diff ↗
- 0.15-3
- 0.15-2
- 0.15-02011-06-24 · diff ↗
- 0.14-92011-06-20 · diff ↗
- 0.14-82011-06-15 · diff ↗
- 0.14-72011-06-09
- RR 2.13.0 released · 2011-04-13
Package metadata
- First published
- 2011-06-09
- Total releases
- 45 / 15 yrs
- License
- GPL (>= 3) OSI
- Bundled data
- 70 KB / 3 files
- Download size
- 1.5 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("crs")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.