Last chance! 50% off unlimited learning
Sale ends in
compare(x.group, est.group, by.group=FALSE)
compare.kda.cv(x, x.group, bw="plugin", prior.prob=NULL, Hstart,
by.group=FALSE, trace=FALSE, binned=FALSE, bgridsize,
recompute=FALSE, ...)
compare.kda.diag.cv(x, x.group, bw="plugin", prior.prob=NULL,
by.group=FALSE, trace=FALSE, binned=FALSE, bgridsize,
recompute=FALSE, ...)
"plugin"
= plug-in, "lscv"
= LSCV, "scv"
= SCVbinned=TRUE
x.group
and the estimated ones.
It returns a list with fieldscompare
computes
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).
prior.prob
to these.
Otherwise prior.prob=NULL
is the default i.e. use
the sample proportions as
estimates of the prior probabilities. If trace=TRUE
, a message is printed in the command line
indicating that it's processing the i-th data item. This can be
helpful since the cross-validated estimates may take a long time to
execute completely.
Venables, W.N. & Ripley, B.D. (1997) Modern Applied Statistics with S-PLUS. Springer-Verlag. New York.
kda.kde
### univariate example -- independent test data
x <- c(rnorm.mixt(n=100, mus=1, sigmas=1, props=1),
rnorm.mixt(n=100, mus=-1, sigmas=1, props=1))
x.gr <- rep(c(1,2), times=c(100,100))
y <- c(rnorm.mixt(n=100, mus=1, sigmas=1, props=1),
rnorm.mixt(n=100, mus=-1, sigmas=1, props=1))
kda.gr <- kda(x, x.gr, hs=sqrt(c(0.09, 0.09)), y=y)
compare(x.gr, kda.gr)
compare(x.gr, kda.gr, by.group=TRUE)
### bivariate example - restricted iris dataset, dependent test data
library(MASS)
data(iris)
ir <- iris[,c(1,2)]
ir.gr <- iris[,5]
compare.kda.cv(ir, ir.gr, bw="plug-in", pilot="samse")
compare.kda.diag.cv(ir, ir.gr, bw="plug-in", pilot="samse",
pre="scaled", binned=TRUE)
compare.kda.cv(ir, ir.gr, bw="plug-in", pilot="samse", recompute=TRUE)
Run the code above in your browser using DataLab