pcf.greedy.kernelR Documentation

Computes a discretized kernel estimator with an adaptive partition

Description

Computes a discretized kernel estimator with an adaptive partition and the output is a piecewise constant function object.

Usage

pcf.greedy.kernel(dendat, h, leaf=round(dim(dendat)[1]/2), minobs=NULL,
type="greedy")

Arguments

dendat

n*d matrix of real numbers; the data matrix

h

d vector of positive real numbers; vector of smoothing parameters

leaf

positive integer

minobs

positive integer smaller than n; the partition is such that there are at most "minobs" observation in each member

type

a character string; "greedy" (partition is generated by binary splits using maximum likelihood), "cpp" (just like "greedy" but uses C++ code, which is not a part of the package but has to loaded separately), "dyadic" (only splits at the midpoints are made, which leads to a loss of accuracy), "prune" (using CART pruning), "old" (not recommended).

Value

a piecewise constant function object with an adaptive partition, see the web site

Author(s)

Jussi Klemela

See Also

densplit

Examples

# generate data
seed<-1
n<-50
d<-2
l<-3; D<-4; c<-D/sqrt(2)
M<-matrix(0,l,d); M[2,]<-c; M[3,]<--c
sig<-matrix(1,l,d)
p<-rep(1/l,l)
dendat<-sim.data(type="mixt",n=n,M=M,sig=sig,p=p,seed=seed)

# colored volume function 
h<-(4/(d+2))^(1/(d+4))*n^(-1/(d+4))*apply(dendat,2,sd)
minobs<-1
pcf<-pcf.greedy.kernel(dendat,h,minobs=minobs,type="cpp")
#lst<-leafsfirst.adagrid(pcf)
#plotvolu(lst,colo=TRUE)

#dp<-draw.pcf(pcf)
#contour(dp$x,dp$y,dp$z,drawlabels=FALSE)