det2 {detpack} | R Documentation |
Density Estimation for Bivariate Data Based on Distribution Element Trees
Description
Two-dimensional piecewise linear or constant probability density estimator based on distribution element trees (DETs).
Usage
det2(dta, mode = 2, bounds = list(NA, NA), alphag = 0.001,
alphad = 0.001, main = NULL, nc = 20, dtalim = Inf, cores = 1,
color = grDevices::colorRamp(c("white", "black")))
Arguments
dta |
matrix with two rows containing data (samples in columns). |
mode |
order of distribution elements applied, default is |
bounds |
|
alphag , alphad |
significance levels for goodness-of-fit and independence tests, respectively, in element refinement or splitting process. Default is |
main |
an overall plot title, see |
nc |
number of contour levels (default is 20). |
dtalim |
allows to limit the number of samples used in tests guiding the element splitting process. Default is |
cores |
number of cores for parallel tree construction. Default is |
color |
function to assign plot colors that is generated, e.g., by |
Examples
## uniform
require(stats)
det2(rbind(runif(5e3),1+2*runif(5e3)), mode = 1, bounds = list(c(-0.1,0),c(1.1,4)))
det2(rbind(1:100,101:200+runif(100)), mode = 2) # data on a line
## Gaussian
require(stats); require(graphics); require(grDevices)
n <- 5e3; x <- rnorm(n)
x <- matrix(c(x, x+rnorm(n,0,0.5)), ncol = 2)
split.screen(c(2,2))
color = colorRamp(c("#FFFFFF","#E6E680","#E6BF1A",
"#E68000","#FF4026","#993380",
"#4D26BF","#262680","#000000"))
screen(3); plot(x, type = "p", pch = ".", main = "data")
screen(1); det2(t(x), mode = 1, main = "constant det estimator", color = color)
screen(2); det2(t(x), main = "linear det estimator", color = color)
screen(4)
det2(t(x), mode = 1, bounds = list(0,0), main = "const. det, no pre-white", color = color)