det1 {detpack}R Documentation

Density Estimation for Univariate Data Based on Distribution Element Trees

Description

One-dimensional piecewise linear or constant probability density estimator based on distribution element trees (DETs).

Usage

det1(dta, mode = 2, bounds = c(0, 0), alpha = 0.001, main = NULL,
  dtalim = Inf, cores = 1)

Arguments

dta

vector with data

mode

order of distribution elements applied, default is mode = 2. Use +/-1 for constant or +/-2 for linear elements. mode > 0 and mode < 0 lead to equal-size and -score splits, respectively, in the element-refinement process.

bounds

c(lb,ub), where lb and ub are lower and upper bounds of the probability space. If both bounds are set to 0 (default), the bounds are determined based on the data dta.

alpha

significance level for goodness-of-fit testing in element refinement or splitting process. Default is alpha = 1.0e-3.

main

an overall plot title, see title.

dtalim

allows to limit the number of samples used in tests guiding the element splitting process. Default is dtalim = Inf, which corresponds to using all available samples, see det.construct.

cores

number of cores for parallel tree construction. Default is 1 for serial construction, see det.construct.

Examples

require(stats)
det1(rbeta(5e5, shape1 = 1.05, shape2 = 0.8), mode = -1,
     bounds = c(-0.1,1.1), main = "beta, const. elements, equal-scores splits")
x <- seq(-0.1,1.1,0.005); lines(x, dbeta(x,shape1 = 1.05,shape2 = 0.8), col = "red")
det1(rbeta(5e5, shape1 = 1.05, shape2 = 0.8), mode = -2,
     bounds = c(-0.1,1.1), main = "beta, linear elements, equal-scores splits")
x <- seq(-0.1,1.1,0.005); lines(x, dbeta(x,shape1 = 1.05,shape2 = 0.8), col = "red")
det1(rnorm(5e5), mode = 2, cores = 1, main = "Gaussian, linear elements, equal-size splits")
x <- seq(-5,5,0.05); lines(x, dnorm(x), col = "red")
det1(runif(5e5), mode = 1, bounds = c(-0.1,1.1),
     main = "uniform, const. elements, equal-size splits")
x <- seq(-0.1,1.1,0.005); lines(x, dunif(x), col = "red")

[Package detpack version 1.1.3 Index]