Hpi, Hpi.diag {ks} | R Documentation |
Plug-in bandwidth matrix for for 2- to 6-dimensional data.
Hpi(x, nstage=2, pilot="samse", pre="sphere", Hstart, binned=FALSE, bgridsize) Hpi.diag(x, nstage=2, pilot="amse", pre="scale", Hstart, binned=FALSE, bgridsize)
x |
matrix of data values |
nstage |
number of stages in the plug-in bandwidth selector (1 or 2) |
pilot |
"amse" = AMSE pilot bandwidths,
"samse" = single SAMSE pilot bandwidth |
pre |
"scale" = pre-scaling, "sphere" = pre-sphering |
Hstart |
initial bandwidth matrix, used in numerical optimisation |
binned |
if TRUE use binned pilot estimation otherwise use exact pilot estimation |
bgridsize |
vector of binning grid sizes - required only if binned=TRUE |
Use Hpi
for full bandwidth matrices and Hpi.diag
for diagonal bandwidth matrices.
For AMSE pilot bandwidths, see Wand & Jones (1994). For SAMSE pilot bandwidths, see Duong & Hazelton (2003). The latter is a modification of the former, in order to remove any possible problems with non-positive definiteness.
For details on the pre-transformations in pre
, see
pre.sphere
and pre.scale
.
If Hstart
is not given then it defaults to
k*var(x)
where k = 4/(n*(d + 2))^(2/(d+ 4)), n = sample size, d = dimension of data.
Plug-in bandwidth matrix.
Wand, M.P. & Jones, M.C. (1994) Multivariate plugin bandwidth selection. Computational Statistics 9, 97-116.
Duong, T. & Hazelton, M.L. (2003) Plug-in bandwidth matrices for bivariate kernel density estimation. Journal of Nonparametric Statistics 15, 17-30.
### bivariate example data(unicef) Hpi(unicef, nstage=1, pilot="amse", pre="scale") Hpi(unicef, nstage=2, pilot="samse", pre="sphere") Hpi.diag(unicef, nstage=2, pilot="amse", pre="scale") ### large sample - 10000 sample from bivariate standard normal x <- rmvnorm.mixt(10000, c(0,0), diag(2)) Hpi(x, binned=TRUE) ### trivariate example mus <- rbind(c(0,0,0), c(2,2,2)) Sigma <- matrix(c(1, 0.7, 0.7, 0.7, 1, 0.7, 0.7, 0.7, 1), nr=3, nc=3) Sigmas <- rbind(Sigma, Sigma) x <- rmvnorm.mixt(n=100, mus=mus, Sigmas=Sigmas, props=c(1/2, 1/2)) Hpi(x)