kde(x, H, h, gridsize, gridtype, xmin, xmax, supp=3.7, eval.points,
binned=FALSE, bgridsize, positive=FALSE, adj.positive, w,
compute.cont=FALSE, approx.cont=TRUE, unit.interval=FALSE,
verbose=FALSE)## S3 method for class 'kde':
predict(object, ..., x)
Hpi
or hpi
is called by default.kde
kde
which is a
list with fields:eval.points
compute.cont=TRUE
)h
is missing, the default bandwidth is hpi
.
For d>1, if H
is missing, the default is Hpi
. For d=1, if positive=TRUE
then x<-log(x+adj.positive)
where the default adj.positive
is the minimum of x
.
For d=1, 2, 3, 4, and if eval.points
is not specified, then the
density estimate is computed over a grid
defined by gridsize
(if binned=FALSE
) or
by bgridsize
(if binned=TRUE
).
If eval.points
is specified, then the
density estimate is computed exactly at eval.points
.
For d>4, the kernel density estimate is computed exactly
and eval.points
must be specified.
The effective support for a normal kernel is where
all values outside [-supp,supp]^d
are zero.
The default xmin
is min(x)-Hmax*supp
and xmax
is max(x)+Hmax*supp
where Hmax
is the maximum of the
diagonal elements of H
. The grid produced is the outer
product of c(xmin[1], xmax[1])
, ..., c(xmin[d], xmax[d])
.
The default bgridsize, gridsize
are d=1: 401; d=2: rep(151, 2);
d=3: rep(31, 3); d=4: rep(21,4).
plot.kde
## positive data example
set.seed(8192)
x <- 2^rnorm(100)
fhat <- kde(x=x, positive=TRUE)
plot(fhat)
points(c(0.5, 1), predict(fhat, x=c(0.5, 1)))
## See other examples in ? plot.kde
Run the code above in your browser using DataLab