This function extracts a specific level of contour from a kde object.

This function only works for some levels that the kde object calculated originally (associated with the constraints in the alpha parameter).

extract_contour(kde_obj, alpha)

Arguments

kde_obj

kde object

alpha

contour level which needs to be extracted. Scalar in the sequence from .01 to .99 by .01. A value of .95 gives a contour level associated with the cumulative prob of 95% (and 95% confidence interval) - which is technically 1-alpha.

Value

List of contours at (100*alpha level) for the kde object - there is a contour for each disconnected contour that forms the (100*alpha level)

Details

This function (renamed as extract_countour) is shared with TCpredictionbands on github: TCpredictionbands.

Examples

if (FALSE) { set.seed(8192) x1 <- 2^rnorm(100) y1 <- rnorm(100) dfmat <- cbind(x1,y1) kde_object <- ks::kde(dfmat) cont <- extract_contour(kde_object, .05) }