Kernel cumulative distribution/survival function estimate
kcde.RdKernel cumulative distribution/survival function estimate for 1- to 3-dimensional data.
Usage
kcde(x, H, h, gridsize, gridtype, xmin, xmax, supp=3.7, eval.points, binned,
bgridsize, positive=FALSE, adj.positive, w, verbose=FALSE,
tail.flag="lower.tail")
Hpi.kcde(x, nstage=2, pilot, Hstart, binned, bgridsize, amise=FALSE,
verbose=FALSE, optim.fun="optim", pre=TRUE)
Hpi.diag.kcde(x, nstage=2, pilot, Hstart, binned, bgridsize, amise=FALSE,
verbose=FALSE, optim.fun="optim", pre=TRUE)
hpi.kcde(x, nstage=2, binned, amise=FALSE)
# S3 method for class 'kcde'
predict(object, ..., x)Arguments
- x
matrix of data values
- H,h
bandwidth matrix/scalar bandwidth. If these are missing, then
Hpi.kcdeorhpi.kcdeis called by default.- gridsize
vector of number of grid points
- gridtype
not yet implemented
- xmin,xmax
vector of minimum/maximum values for grid
- supp
effective support for standard normal
- eval.points
vector or matrix of points at which estimate is evaluated
- binned
flag for binned estimation. Default is FALSE.
- bgridsize
vector of binning grid sizes
- positive
flag if 1-d data are positive. Default is FALSE.
- adj.positive
adjustment applied to positive 1-d data
- w
not yet implemented
- verbose
flag to print out progress information. Default is FALSE.
- tail.flag
"lower.tail" = cumulative distribution, "upper.tail" = survival function
- nstage
number of stages in the plug-in bandwidth selector (1 or 2)
- pilot
"dscalar" = single pilot bandwidth (default for
Hpi.diag.kcde)
"dunconstr" = single unconstrained pilot bandwidth (default forHpi.kcde)- Hstart
initial bandwidth matrix, used in numerical optimisation
- amise
flag to return the minimal scaled PI value
- optim.fun
optimiser function: one of
nlmoroptim- pre
flag for pre-scaling data. Default is TRUE.
- object
object of class
kcde- ...
other parameters
Value
A kernel cumulative distribution estimate is an object of class
kcde which is a list with fields:
- x
data points - same as input
- eval.points
vector or list of points at which the estimate is evaluated
- estimate
cumulative distribution/survival function estimate at
eval.points- h
scalar bandwidth (1-d only)
- H
bandwidth matrix
- gridtype
"linear"
- gridded
flag for estimation on a grid
- binned
flag for binned estimation
- names
variable names
- w
vector of weights
- tail
"lower.tail"=cumulative distribution, "upper.tail"=survival function
Details
If tail.flag="lower.tail" then the cumulative distribution
function \(\mathrm{Pr}(\bold{X}\leq\bold{x})\) is estimated, otherwise
if tail.flag="upper.tail", it is the survival function
\(\mathrm{Pr}(\bold{X}>\bold{x})\). For \(d>1\),
\(\mathrm{Pr}(\bold{X}\leq\bold{x}) \neq 1 - \mathrm{Pr}(\bold{X}>\bold{x})\).
If the bandwidth H is missing in kcde, then
the default bandwidth is the plug-in selector
Hpi.kcde. Likewise for missing h.
No pre-scaling/pre-sphering is used since the Hpi.kcde is not
invariant to translation/dilation.
The effective support, binning, grid size, grid range, positive, optimisation function
parameters are the same as kde.
References
Duong, T. (2016) Non-parametric smoothed estimation of multivariate cumulative distribution and survival functions, and receiver operating characteristic curves. Journal of the Korean Statistical Society 45, 33–50.
Examples
data(iris)
Fhat <- kcde(iris[,1:2])
predict(Fhat, x=as.matrix(iris[,1:2]))
#> [1] 0.183688941 0.053679294 0.059165038 0.037235867 0.171233241 0.331399053
#> [7] 0.060723956 0.141833006 0.010850701 0.070540280 0.306228130 0.098589783
#> [13] 0.044178204 0.011025553 0.484519776 0.464239041 0.331399053 0.183688941
#> [19] 0.423281009 0.220986454 0.234375209 0.212289270 0.069457262 0.142469530
#> [25] 0.098589783 0.064059122 0.141833006 0.209474854 0.186747475 0.059165038
#> [31] 0.058529954 0.234375209 0.268880526 0.383218639 0.070540280 0.103638300
#> [37] 0.290469242 0.143038196 0.015594786 0.164143253 0.158039099 0.003237532
#> [43] 0.025577055 0.158039099 0.220986454 0.044178204 0.220986454 0.046362995
#> [49] 0.274858173 0.123436960 0.590942414 0.464724980 0.506168207 0.023924663
#> [55] 0.246962280 0.125228142 0.480562519 0.014070811 0.321952279 0.046141146
#> [61] 0.002612815 0.233676715 0.022085413 0.237964280 0.131923170 0.476631014
#> [67] 0.159986140 0.115444809 0.025314094 0.055813718 0.310599008 0.193531790
#> [73] 0.097528227 0.193531790 0.294078825 0.391202688 0.268629462 0.405853834
#> [79] 0.216850377 0.081671601 0.036006132 0.036006132 0.115444809 0.141262255
#> [85] 0.119389914 0.418306942 0.476631014 0.044375268 0.159986140 0.049507527
#> [91] 0.063142109 0.284730436 0.091107545 0.012207127 0.089343058 0.183378215
#> [97] 0.152213679 0.258116833 0.026984633 0.125228142 0.480562519 0.115444809
#> [103] 0.442309263 0.276988979 0.374050503 0.465441626 0.017870367 0.364037178
#> [109] 0.109980288 0.822232406 0.492401678 0.183971408 0.417938760 0.062210492
#> [115] 0.142514569 0.464724980 0.374050503 0.917741051 0.161192058 0.022085413
#> [121] 0.576946795 0.108544065 0.290742107 0.175008490 0.596886547 0.612234147
#> [127] 0.209055514 0.284730436 0.236033529 0.447845419 0.284907984 0.927586071
#> [133] 0.236033529 0.223357182 0.117962727 0.468980309 0.523170273 0.412203734
#> [139] 0.259355951 0.506168207 0.476631014 0.506168207 0.115444809 0.560136651
#> [145] 0.596886547 0.405853834 0.097528227 0.374050503 0.488340514 0.233676715
## See other examples in ? plot.kcde