kda.kde {ks} | R Documentation |
Kernel density estimate for kernel discriminant analysis for 1- to 6-dimensional data
kda.kde(x, x.group, Hs, hs, prior.prob=NULL, gridsize, supp=3.7, eval.points=NULL)
x |
matrix of training data values |
x.group |
vector of group labels for training data |
Hs |
(stacked) matrix of bandwidth matrices |
hs |
vector of scalar bandwidths |
prior.prob |
vector of prior probabilities |
gridsize |
vector of number of grid points |
supp |
effective support for standard normal is [-supp, supp ] |
eval.points |
points that density estimate is evaluated at |
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.
For d > 1, the kernel density estimate is computed exactly i.e. binning
is not used. For d = 1, the binned estimator from the
KernSmooth
library is used.
For d = 1, 2, 3, if eval.points
is not specified, then the
density estimate is automatically computed over a grid whose
resolution is controlled by gridsize
(default is 101, 51 x 51
and 51 x 51 x 51 respectively).
For d > 3, eval.points
must be specified.
The kernel density estimate for kernel discriminant analysis is
based on kde
, one density estimate for each group.
The result from kda.kde
is a density estimate
for discriminant analysis is an object of class kda.kde
which is a
list with 6 fields
x |
data points - same as input |
x.group |
group labels - same as input |
eval.points |
points that density estimate is evaluated at |
estimate |
density estimate at eval.points |
prior.prob |
sample proportions of each group |
H |
bandwidth matrices (>1-d only) or |
h |
bandwidths (1-d only) |
Wand, M.P. & Jones, M.C. (1995) Kernel Smoothing. Chapman & Hall. London.
### bivariate example - restricted iris dataset library(MASS) data(iris) ir <- iris[,1:2] ir.gr <- iris[,5] H <- Hkda(ir, ir.gr, bw="plugin", pre="scale") kda.fhat <- kda.kde(ir, ir.gr, H=H)