extract_contour: Selection of specific contour level from KDE object

Description Usage Arguments Details Value Examples

View source: R/kde.R

Description

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).

Usage

1
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.

Details

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

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)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
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)

## End(Not run)

skgallagher/EpiCompare documentation built on Sept. 14, 2021, 5:45 a.m.