Plots univariate density estimates estimates to be used in a
lattice::splom()
call with the diag.panel
argument.
diag.panel.splom.density(x, bw = "nrd0", adjust = 1, kernel = "gaussian",
weights = NULL, n = 512, ...)
data vector corresponding to that row / column (which will be the same for diagonal 'panels').
the smoothing bandwidth to be used. The kernels are scaled such that this is the standard deviation of the smoothing kernel. (Note this differs from the reference books cited below, and from S-PLUS.)
bw
can also be a character string giving a rule to choose the
bandwidth. See bw.nrd
.
The default,
"nrd0"
, has remained the default for historical and
compatibility reasons, rather than as a general recommendation,
where e.g., "SJ"
would rather fit, see also Venables and
Ripley (2002).
The specified (or computed) value of bw
is multiplied by
adjust
.
the bandwidth used is actually adjust*bw
.
This makes it easy to specify values like ‘half the default’
bandwidth.
a character string giving the smoothing kernel
to be used. This must partially match one of "gaussian"
,
"rectangular"
, "triangular"
, "epanechnikov"
,
"biweight"
, "cosine"
or "optcosine"
, with default
"gaussian"
, and may be abbreviated to a unique prefix (single
letter).
"cosine"
is smoother than "optcosine"
, which is the
usual ‘cosine’ kernel in the literature and almost MSE-efficient.
However, "cosine"
is the version used by S.
numeric vector of non-negative observation weights,
hence of same length as x
. The default NULL
is
equivalent to weights = rep(1/nx, nx)
where nx
is the
length of (the finite entries of) x[]
.
the number of equally spaced points at which the density is
to be estimated. When n > 512
, it is rounded up to a power
of 2 during the calculations (as fft
is used) and the
final result is interpolated by approx
. So it almost
always makes sense to specify n
as a power of two.
Further arguments passed on to lattice::diag.panel.splom()
and
lattice::panel.lines()
.
splom(~ iris[1:4],
data = iris,
diag.panel = diag.panel.splom.density,
pscales = 0)
Run the code above in your browser using DataLab