# leafsfirst: Computes a level set tree, shape tree, or tail tree In denpro: Visualization of Multivariate Functions, Sets, and Data

## Description

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

## Usage

 ```1 2 3``` ```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

## Value

a level set tree, shape tree, or tail tree

## Author(s)

Jussi Klemela

`pcf.kern`, `treedisc`, `plotvolu`, `plotbary`,
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23``` ```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) ```