np.pairs: Cross-Validated Pairs Plot (Helper Functions)

View source: R/np.pairs.R

np.pairsR Documentation

Cross-Validated Pairs Plot (Helper Functions)

Description

Compute pairwise nonparametric regressions and densities for a set of variables, then plot a pairs-style display with fitted smoothers.

Usage

np.pairs(y.vars, y.dat, ...)
np.pairs.plot(pair.list)

Arguments

Data, Bandwidth Inputs And Formula Interface

These arguments identify the variables, data, and pair specifications to plot.

pair.list

list returned by np.pairs.

y.dat

data frame containing the variables listed in y.vars. With two or more distinct selected variables, each must be a numeric (integer or double) response vector, because each appears as an off-diagonal regression outcome. Factors, ordered factors and logical responses are rejected before fitting; their integer codes are not treated as numeric outcomes.

y.vars

character vector of column names in y.dat. If y.vars is named, the names are used as plot labels.

Additional Arguments

Further graphical arguments are passed through to plotting methods.

...

additional arguments passed to npudens and npreg.

Details

Documentation guide: see np.kernels for kernels, np.options for global options, and plot for plotting options.

On the diagonal, npudens is used to compute kernel density estimates. Off-diagonal panels use npreg with residuals to draw scatterplots and smoothers.

Value

np.pairs returns a list with components y_vars, pair_names, and pair_kerns. np.pairs.plot returns NULL (invisibly).

See Also

np.kernels, np.options, plotnpudens, npreg

Examples

## Not run: 
data("USArrests")
y.vars <- c("Murder", "UrbanPop")
names(y.vars) <- c("Murder Arrests per 100K", "Pop. Percent Urban")

pair.list <- np.pairs(
  y.vars = y.vars,
  y.dat = USArrests,
  ckertype = "epanechnikov",
  bwscaling = TRUE
)

np.pairs.plot(pair.list)

## End(Not run)

np documentation built on Nov. 25, 2026, 1:06 a.m.