Start Here
Gallery of code for np, npRmpi, and crs
This site is meant to help you get to working code quickly. The sidebar is now organized by task rather than by old document names, and the search box should find function names such as npreg, npudens, crs, and npRmpi.init.
This gallery complements the package help pages, examples, and vignettes. The aim is simple: make it easy to see what each package is for, copy a small working example, and then move on to longer scripts only if you need them.
If you are new to these packages, start with Choose a Package. If you want runnable code immediately, go to Quickstarts. If you already know the method you want, go directly to Kernel Methods, MPI and Large Data, Splines, or Worked Examples.

This website is linked from my academic site and is intended as a practical working companion, not as a substitute for the package manuals or the underlying papers.
This Gallery now tracks the current np / npRmpi 0.70-2 plotting interface on CRAN as of Friday, May 15, 2026.
The redesigned examples use public controls such as errors, bootstrap, band, data_rug, data_overlay, and other snake_case option names. Older plotting code may need small argument-name updates once the new release is installed.
Recent Extensions
- Local polynomial workflows:
npandnpRmpinow support local polynomial capability across the conditional family, with joint selection of polynomial degrees and bandwidths for mixed data, gradient support throughout the conditional estimators, and derivative estimation of arbitrarily high order, limited only by the selected polynomial degree whether set manually or chosen automatically for the underlying smoothness class. - Bounded-support and proper conditional density/distribution methods: conditional density and distribution workflows now include bounded-kernel routes for known bounds and practical unknown-bound settings, plus
proper = TRUEfor proper local-polynomial conditional density/distribution estimates when degree exceeds zero. - Conditional quantile regression:
npqregnow has a direct formula interface, automaticnpcdistbw()bandwidth selection whenbwsis omitted, vectortausupport,plot(..., tau = ...)reuse of existing bandwidths, conditional-quantile gradients and standard errors, andnomad = TRUEpass-through for local-polynomial degree-and-bandwidth search. - Conditional mode classification:
npconmodeis now a first-class high-level estimator, with direct formula/data/newdata workflows, automaticnpcdensbw()bandwidth selection whenbwsis omitted, conditional-density search controls includingnomad = TRUE, mirrored degree/search metadata in returned objects and summaries, properized fitted class probabilities for non-local-constant routes before selecting the modal outcome, and level-specific class-probability effects. - Copula estimation:
npcopulais now a first-class high-level estimator too, with a direct formula interface, automaticnpudistbw()ornpudensbw()selection whenbwsis omitted, automatic two-dimensional probability-grid construction for the default grid route, and easy reuse of the selected bandwidth object when you want a customugrid or copula-density target. - Hat-matrix and operator helpers:
npreghat,npindexhat,npplreghat, andnpscoefhatnow provide one-call operator routes that simplify constrained nonparametric and semiparametric estimation by replacing much of the older manual hat-matrix construction and solve-based setup, whilenpudenshat,npudisthat,npcdenshat, andnpcdisthatextend the same streamlined operator style to the density/distribution family. - Variability bounds on plots: Bonferroni and simultaneous bounds are new additions to the plotting surface, while
band = "all"now presents those together with the traditional pointwise bounds. - Interactive plotting surfaces:
renderer = "rgl"now supports interactive 3D rotation/zoom whenrglis installed, whiledata_ruganddata_overlaycontrol rugs and observed-data overlays on supported routes. - MPI operational routes:
npRmpiis no longer limited to the older profile/manual-broadcast interface; currentsessionandattachroutes let users work far more directly withnp-style code while retaining the profile route when needed.
Choose a Package
Start here if you are deciding between np, npRmpi, and crs, or if you want a quick route to the right tool.
Install and Get Started
Short install notes, a minimal first run, and pointers for what to do next once the packages are installed.
Quickstarts
Small runnable scripts for np, npRmpi, and crs, shown inline so you can copy directly from the page.
Kernel Methods
Core workflows for np, together with a clean route to npRmpi when jobs become larger or more time consuming.
MPI and Large Data
Updated guidance for npRmpi, with session mode now treated as the main interactive path rather than an afterthought.
Worked Examples
Copyable code snippets on the page, plus links to longer scripts when you want the full commented version.
Multivariate Regression
Mixed-data regression, partial plots, and prediction using wage1 as a practical first multivariate example.
FAQ and Troubleshooting
Common questions, support routes, and links to the current canonical sources.
Learn by topic
Kernel Primer
Short conceptual introduction to mixed-data kernels, bandwidth objects, and the basic np workflow.
Density, Distribution, Quantiles
Route to npudens, npudist, npcdens, npcdist, and npqreg workflows.
Semiparametric Models
Partially linear, single-index, and varying-coefficient workflows in one place.
Entropy and Testing
Overview of the entropy-based testing procedures and a small “roll your own” example.
Classification and Modes
Nonparametric classification and conditional-mode workflows, including the birthwt example.
Build With npksum
For users who want to construct custom kernel objects or estimators rather than only use the higher-level wrappers.
Spline Primer
Conceptual introduction to regression splines, knots, basis functions, and how that connects to crs.
Code Catalog
Broader script library across np, npRmpi, and crs, including older scripts and fuller worked examples beyond the first quickstarts.
Need help fast?
FAQ and Troubleshooting
Short answers to the most common “where do I start?” and “why is this happening?” questions.
Data Preparation
Variable classes, factors, ordered variables, formulas, and the data-typing mistakes that most often trip people up.
Runtime and Scaling
What to do when cross-validation, bootstrap, spline search, or large jobs become slow or memory-hungry.
Spline Search and Tuning
Practical crs advice on search size, smoothness, knots, and when to narrow the spline search space.
Notes
- Search should help if you know the function name but not where it lives.
- Quickstarts is the shortest route to a small runnable script.
- The reference page groups functions by task rather than repeating a long handwritten index.
- Additional resources, including books and papers, are collected on Books, Papers, and Citation.
Feedback is welcome. My academic page is experts.mcmaster.ca/display/racinej, and additional materials remain available at jeffreyracine.github.io/research.