This function fits a kernel density estimator to a set of data points. Another wrapper of ks::kde.

fit_kde_object(df, h_band = NULL, position = 1:2, grid_size = rep(1000, 2))

Arguments

df

data.frame with all the points

h_band

optional argument for the bandwidth of the kde object. If NULL, the optimal band would be selected through the ks::kde function. Default is NULL.

position

Columns position of x/y pair. Default is 1:2

grid_size

size of the grid which is going to be used for the evaluation of kde object. Can be reduced to speed-up computation.

Value

KDE object fitted to the df data.frame.

Details

This function is shared with TCpredictionbands on github: TCpredictionbands.

Examples

if (FALSE) { set.seed(8192) x <- 2^rnorm(100) y <- rnorm(100) dfmat <- cbind(x,y) kde_object <- fit_kde_object(dfmat) }