kda(x, x.group, Hs, hs, prior.prob=NULL, gridsize, xmin, xmax, supp=3.7,
eval.points, binned=FALSE, bgridsize, w, compute.cont=FALSE,
approx.cont=TRUE, kde.flag=TRUE)
Hkda(x, x.group, Hstart, bw="plugin", nstage=2, pilot="samse", pre="sphere",
binned=FALSE, bgridsize)
Hkda.diag(x, x.group, bw="plugin", nstage=2, pilot="samse", pre="sphere",
binned=FALSE, bgridsize)
hkda(x, x.group, bw="plugin", nstage=2, binned=TRUE, bgridsize)compare(x.group, est.group, by.group=FALSE)
compare.kda.cv(x, x.group, bw="plugin", prior.prob=NULL, Hstart,
by.group=FALSE, verbose=FALSE, binned=FALSE, bgridsize, recompute=FALSE,
...)
compare.kda.diag.cv(x, x.group, bw="plugin", prior.prob=NULL, by.group=FALSE,
verbose=FALSE, binned=FALSE, bgridsize, recompute=FALSE, ...)
Hkda or hkda is called by default.pre.scale, "sphere" = pre.spherekda
which is a list with fieldseval.points, one for each group labeleval.points are given then these are classified. Otherwise
the training data x are classified.Hkda and Hkda.diag is a stacked matrix
of bandwidth matrices, one for each training data group. The result
from hkda is a vector of bandwidths, one for each training data
group. --The compare functions create a comparison between the true
group labels x.group and the estimated ones.
It returns a list with fields
compare computes MR = (number of points wrongly classified)/(total number of points).
In the case where we don't have independent test data e.g.
we are classifying the training data set itself, then the cross
validated estimate of MR is more appropriate. These
are implemented as compare.kda.cv (full bandwidth
selectors) and compare.kda.diag.cv (for diagonal bandwidth
selectors). These functions are only available for d > 1. If by.group=FALSE then only the total MR rate is given. If it
is set to TRUE, then the MR rates for each class are also given
(estimated number in group divided by true number).
Hs are missing from kda, then the default bandwidths are the
binned 2-stage plug-in selectors Hkda(, bw="plugin", nstage=2, binned=TRUE).
Likewise for missing hs.
--The values that valid for bw are "plugin", "lscv" and
"scv" for
Hkda. These in turn call Hpi,
Hlscv and Hscv. For plugin selectors, all
of nstage, pilot and pre need to be set. For SCV
selectors, currently nstage=1 always but pilot and pre
need to be set. For LSCV selectors, none of them are required.
Hkda.diag makes analogous calls to diagonal selectors. --If you have prior probabilities then set prior.prob to these.
Otherwise prior.prob=NULL is the default i.e. use the sample
proportions as estimates of the prior probabilities.
As of kda.kde has been subsumed
into kda, so all prior calls to kda.kde can be replaced
by kda. To reproduce the previous behaviour of kda, the
command is kda(, kde.flag=FALSE).
plot.kdax <- c(rnorm.mixt(n=100, mus=1), rnorm.mixt(n=100, mus=-1))
x.gr <- rep(c(1,2), times=c(100,100))
y <- c(rnorm.mixt(n=100, mus=1), rnorm.mixt(n=100, mus=-1))
kda.gr <- kda(x, x.gr, eval.points=y)
compare(kda.gr$x.group, kda.gr$x.group.est, by.group=TRUE)
## See other examples in ? plot.kdaRun the code above in your browser using DataLab