Skip to content

Nonparametric Kernel Smoothing Methods for Mixed Data Types

38packages dependsuggested by 5
121.5Kdownloads / year
9.4%test coverage
13/13flavors OK

Overview

About

Nonparametric (and semiparametric) kernel methods that seamlessly handle a mix of continuous, unordered, and ordered factor data types. We 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://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.

Changes in 0.70-5
  • Corrected the heteroskedasticity-robust Ichimura index-coefficient covariance returned by vcov(npindex(..., gradients = TRUE)) when the model has more than one free index coefficient. Link-gradient and residual weights are now applied observation by observation. Fits with one free coefficient remain exactly unchanged, as do beta, bandwidth, objective, fitted-value, residual, and gradient results.
  • Repaired finite-support bounded continuous-kernel normalization for all supported Gaussian, Epanechnikov, uniform, and truncated-Gaussian kernels. The centered normalization now avoids tail cancellation, uses the platform C99 error function where appropriate, and preserves the uniform-density limit as the bandwidth tends to infinity.
  • Replaced the bounded distribution operator with the mathematically correct observation-centered truncated-kernel CDF. Analytic centered interval primitives and hoisted invariant work preserve exact support endpoints, numerical accuracy, and the finite-support large-bandwidth uniform limit.
Show all changes in 0.70-5Hide the rest of the changes in 0.70-5
  • Corrected transform.bounds = TRUE initialization for regression initial starts and multistarts and for later conditional-distribution multistarts. External bandwidth starts are now inverse-mapped before transformed Powell search; the public default remains FALSE.
  • Clarified optimizer summaries so objective-cache lookups, NOMAD point lookups, family-native R-optim refinement, and total function-evaluation accounting are labelled consistently without implying that their denominators are interchangeable.
  • Clarified bandwidth-object replay documentation across estimator families. Stored bandwidth objects retain search and fit metadata but do not silently materialize or expand training data; callers must provide data again where the documented replay route requires it.
  • Standardized the public nomad.opts contract across supported bandwidth selectors and hardened native NOMAD callback cleanup, nearest-neighbor cache release, and native allocation-dimension guards.
  • Reworked npindexbw() / npindex() internals after 0.70-4. Ichimura and Klein-Spady single-index objectives now reuse the established npreg leave-one-out backend where applicable, preserving the public estimator contract while materially improving high-dimensional and local-polynomial objective evaluation. The single-index formula/materialization routes were tightened so formula-selected variables, explicit bandwidth objects, and direct formula calls with explicit smoothing parameters reenter consistently.
  • Added user documentation for npindex() optimizer choice and beta interpretation. The documentation now gives practical guidance on when derivative-free Nelder-Mead remains a reasonable low-dimensional default and when BFGS is useful for higher-dimensional index searches, and it explains the relative interpretation of normalized single-index beta coefficients.
  • Hardened single-index fit, evaluation, plotting, and summary behavior. Bounded continuous-kernel options are now carried consistently through objective, fit, evaluation, variance, and bootstrap routes; Klein-Spady confusion-matrix output is guarded against out-of-range fitted values; and large-bandwidth shortcuts are restricted to kernel/order combinations whose constant-weight approximation was validated.
  • Repaired single-index plot bootstrap memory usage. Wild-bootstrap self-maps now avoid public-facing O(n^2) kernel-weight allocations for the ordinary large-sample plot route, while preserving the public fitted and plotting contracts.
  • Repaired generalized-nearest-neighbor local-polynomial derivative ownership across npreghat() and related public routes. Mixed-degree local-polynomial fits now route available derivative components through the correct owner, preserve apply == H %*% y contracts, and report unavailable derivative components consistently rather than silently applying the wrong operator.
  • Repaired local-constant derivative ownership in npreghat() so degree-zero local-polynomial derivative requests use the analytic local-constant derivative contract only when that contract is mathematically available. Scalar, matrix, and multi-column apply routes were validated separately.
  • Improved conditional mixed-degree local-polynomial gradients for npcdens() / npcdist() and public conditional-gradient accessors. The partial-availability contract now matches the regression-family policy: available components are returned, unavailable components are represented as NA, and incoherent metadata fails clearly.
  • Repaired formula/data reentry contracts across density, distribution, conditional density, conditional distribution, single-index, smooth coefficient, partially linear, quantile, conditional-mode, copula, and significance-test routes. Explicit estimator data= now overrides stored bandwidth-object data where that public call shape is supported, formula newdata is validated against fitted RHS variables, and direct formula calls with numeric smoothing parameters no longer misroute formula objects as native data.
  • Repaired unconditional density and distribution edge contracts. Ordered kernel-code selection is now consistent between conditional bandwidth selection and fitting where normalization is required, all-NA input is rejected before native calls, training and evaluation omission metadata are retained separately where needed, categorical zero-bandwidth standard-error handling is consistent across categorical configurations, and unsupported bandwidth-selection method codes fail clearly.
  • Clarified normal-reference bandwidth documentation for density and distribution routes. The rule-of-thumb formulas are documented as fast exploratory Silverman-style heuristics, not production substitutes for cross-validation or likelihood-based selection.
  • Hardened npcdistbw() normal-reference method handling so the R method code and native C method code stay aligned, avoiding accidental fall-through to an unintended bandwidth-selection branch.
  • Repaired and hardened public estimator contracts found during adversarial audits of npscoef, npplreg, npqreg, nplsqreg, npconmode, npcopula, npreg, npcdens, npcdist, npudens, and npudist. Repairs include npscoef iterated backfit behavior, partially-linear fit reentry, quantile inversion/clamping contracts, conditional-mode probability/tie handling, copula sample reentry, regression tree/large-h predicate alignment, and density/distribution formula/native argument consistency.
  • Plot-bootstrap memory hardening now covers single-index, conditional-mode, and partially-linear plot routes. The default plot evaluation grids remain linear in the training sample size, and explicit neval == ntrain style requests remain user-controlled.
  • Categorical-gradient and derivative workspace handling were repaired so no-gradient and gradient calls can be mixed safely in one session without stale native derivative workspace state affecting later calls.
  • Native shadow-object and cache lifecycles were hardened. Conditional-density shadow pointers, native objective-cache state, and regression large-h / large-lambda caches are cleared at the appropriate top-level lifecycle boundary so pointer-keyed helper state cannot leak across independent calls or datasets.
  • npksum() numeric-bandwidth dispatch now constructs data-aware bandwidth objects for mixed continuous/categorical data instead of falling back to a default-typed object. The serial and MPI packages now share the same public behavior for numeric smoothing parameters.
  • The local-polynomial regression CVKS low-support objective path now uses a named bandwidth-method code and aligns the R and C routing contracts, reducing the risk of drift between search metadata and native objective handling.
  • Expanded focused tests, demos, benchmarks, and release-protocol sentinels across the public exported surface. The release protocol now requires an explicit public-exported-surface inventory, estimator-family sentinels, documentation/demo/benchmark smoke coverage, and installed package proof before release-ready claims.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 10.4 min · r-release-macos-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-06-09
  • ERROR12 OK, 1 ERROR2026-06-08
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.70-5
READMEYes · 354 wordsVignettesYes · 2 · dynamicNEWSYes · 100% structured · mentions 0.70-5Citation fileYes · cites a publicationWebsitenot declared in DESCRIPTION
Cites a JSS article
Help pages
60includes a package overview page
Examples that run
19%11 run in a plain check · 46 never run
Exported functions with examples
98%
Documented parameters
87%
Return-value docs
98%
Help pages citing references
78%

Also includes 3 demo scripts (run with demo())

Downloads

121.5K
CRAN downloads in the past year
Rank #1,298 · ~333/day · ~10.1K/mo
Daily download trend is not available in this view yet.
8.6K30 days
23.1K90 days
121.5K1 year
Compare downloads with other packages →
Also on1.6K r2u3 autocran7.4K conda_forge256 c2d4u

Repository

54Stars
16Forks
0Open issues
0Open PRs
0Releases
4,062Commits
5Commit identities
4,062 commits · Last activity 2026-10-18 · +1.9% stars, 30d · Default branch at 0.80-1, ahead of CRAN 0.70-5 (checked 2026-10-11)
Responsiveness
How these are sampled
PRs merged (all time)
86%
Median days to close, 50 most recently updated closed issues
7
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2024-12-12 · 482026-09-30 · 54
PracticesBeta

Checks run against github.com/jeffreyracine/r-package-np on 2026-10-11.

No development-tooling practices detected in the upstream repository.

How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
12 external dependencies (excludes base and recommended)

Installing np adds 7 packages (6 with compiled code, 8.0 MB of source tarballs). Heaviest: cubature 3.2 MB, Rcpp 1.8 MB, crs 1.5 MB.

Depends (1)
R >= 3.5.0
Imports (7)
LinkingTo (1)
Enhances (0)
none

Datasets

People & History

People (2)
Author, Maintainer since 0.12-1 (2006)
Releases (57)
Submitted 0.80-1, in pretest since 2026-10-18 19:08 UTC, as of the 2026-10-18 19:08 UTC queue snapshot. See the queue →

Pick two releases to compare their code metrics.

  • 0.70-5Latest
    record
    2026-07-15 · current release · diff ↗
  • 0.70-4
    record
    2026-06-26 · diff ↗
  • 0.70-3
    record
    2026-06-04 · diff ↗ ·
    added 2 exports
    nplsqregbw, nplsqreg
  • 0.70-2
    record
    2026-05-15 · diff ↗ ·
    added 3 exports
    np_boot_control, np_grid_control, np_render_control
  • 0.70-1
    record
    2026-05-02 · diff ↗ ·
    removed 1 export
    npplot
    added 11 exports
    dimBS, npudenshat, npudisthat, npreghat, npindexhat, npplreghat, npscoefhat, npcdenshat, npcdisthat, np.pairs, np.pairs.plot
  • R
    R 4.6.0 released · 2026-04-24
  • 0.60-20
    record
    2026-02-12 · diff ↗
  • 0.60-19
    record
    2026-01-29 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • 0.60-18
    record
    2024-12-10 · diff ↗
  • R
    R 4.4.0 released · 2024-04-24
  • R
    R 4.3.0 released · 2023-04-21
  • 0.60-17
    record
    2023-03-13 · diff ↗
  • 0.60-16
    record
    2022-10-19 · diff ↗
  • 0.60-15
    record
    2022-10-09 · diff ↗
  • 0.60-14
    record
    2022-09-05 · diff ↗
Show 67 earlier eventsHide 67 earlier events

Package metadata

First published
2006-11-19
Total releases
57 / 20 yrs
License
GPL
Minimum R
≥ 3.5.0
Bundled data
101 KB / 5 files
Download size
1.5 MB
Appears in task views

Cite

Cite this package

Run in R for the authors' entry:

citation("np")

The package provides a citation file, so citation() returns the authors' own entry.

It points to 10.18637/jss.v027.i05.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for np version 0.70-5 [Data set]. HJJB, LLC. Data release v2026-10-18. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy