Skip to contents

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.

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.

Value

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

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.

Examples

if (FALSE) { # \dontrun{
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)
} # }