Learn R Programming

denpro (version 0.9.2)

leafsfirst: Computes a level set tree, shape tree, or tail tree

Description

Computes a level set tree or shape tree from a piecewise constant function, or calculates a tail tree from a data set.

Usage

leafsfirst(pcf = NULL, lev = NULL, refe = NULL, type = "lst", levmet = "radius", ordmet = "etaisrec", ngrid = NULL, dendat = NULL, rho = 0, propor= NULL, lowest = "dens", f=NULL)

Arguments

pcf
piecewise constant function; output of "pcf.kern", or "pcf.func", for example
lev
positive real number; a level of the level set whose shape tree will be calculated
refe
vector of d real numbers; the reference point of the shape tree
type
"lst" or "shape"; not needed
levmet
"radius" or "proba"; radius plot or probability content plot
ordmet
"etaisrec" or "baryrec"; a distance to a rectangle is defined to be the distance to the boundary or the distance to the barycenter; concerns shape trees
ngrid
a positive integer; the tree will be pruned to contain "ngrid" levels
dendat
n*d data matrix; gives the data set when a tail tree will be calculated
rho
positive real number; the resolution threshold for the tail tree
propor
0
lowest
a character; if lowest="dens", then it is assumed that the function whose level set tree we calculate is nonnegative
f
a vector of estimated values of the density at the data points; this is used in the case of tail trees to estimate the volumes of the regions

Value

See Also

pcf.kern, treedisc, plotvolu, plotbary,

Examples

Run this code
dendat<-sim.data(n=100,type="mulmod")
pcf<-pcf.kern(dendat,h=1,N=c(32,32))

# level set tree

lst<-leafsfirst(pcf)          

td<-treedisc(lst,pcf,ngrid=30)
plotvolu(td)

# shape tree

st<-leafsfirst(pcf,propo=0.1)   # 10% level set  

tdst<-treedisc(st,pcf,ngrid=30)
plotvolu(tdst)

# tail tree

rho<-0.65
tt<-leafsfirst(dendat=dendat,rho=rho)

plotbary(tt)

Run the code above in your browser using DataLab