Contour levels and sizes.

1 2 3 4 5 6 7 | ```
contourLevels(x, ...)
## S3 method for class 'kde'
contourLevels(x, prob, cont, nlevels=5, approx=TRUE, ...)
## S3 method for class 'kda'
contourLevels(x, prob, cont, nlevels=5, approx=TRUE, ...)
contourSizes(x, abs.cont, cont=c(25,50,75), approx=TRUE)
``` |

`x` |
an object of class |

`prob` |
vector of probabilities corresponding to highest density regions |

`cont` |
vector of percentages which correspond to the complement
of |

`abs.cont` |
vector of absolute contour levels |

`nlevels` |
number of pretty contour levels |

`approx` |
flag to compute approximate contour levels. Default is TRUE. |

`...` |
other parameters |

–For `contourLevels`

, the most straightforward is to specify `prob`

. Heights of
the corresponding highest density region with probability `prob`

are
computed. The `cont`

parameter here is consistent with
`cont`

parameter from `plot.kde`

and `plot.kda`

i.e. `cont=(1-prob)*100`

%.
If both `prob`

and `cont`

are missing then a pretty set of
`nlevels`

contours are computed.

–For `contourSizes`

, the approximate Lebesgue measures are approximated by Riemann sums. Thsese are rough approximations and depend highly on the estimation grid, and so should
be interpreted carefully.

If `approx=FALSE`

, then the exact KDE is computed. Otherwise
it is interpolated from an existing KDE grid. This can dramatically
reduce computation time for large data sets.

–For `contourLevels`

, for `kde`

objects, returns vector of heights. For `kda`

objects, returns a list of vectors, one for each training group.

–For `contourSizes`

, an approximation of the Lebesgue measure of
level set, i.e. length (d=1), area (d=2), volume (d=3), hyper-volume (d>4).

1 2 3 4 5 6 | ```
set.seed(8192)
x <- rmvnorm.mixt(n=1000, mus=c(0,0), Sigmas=diag(2), props=1)
fhat <- kde(x=x, binned=TRUE)
contourLevels(fhat, cont=c(75, 50, 25))
contourSizes(fhat, cont=25, approx=TRUE)
## compare to approx circle of radius=0.75 with area=1.77
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.