cv_optimal_density_estimate: Cross Validation to Choose the Best Penalty Parameter

View source: R/cross_validation_optimal_density_estimate.R

cv_optimal_density_estimateR Documentation

Cross Validation to Choose the Best Penalty Parameter

Description

Given a numeric vector of penalty parameter candidates, use the cross validation to choose the best one.

Usage

cv_optimal_density_estimate(
  data,
  domain,
  penalty_param_candidates,
  fold_number = 5
)

Arguments

data

A numeric vector whose log-concave density function is to be estimated; missing values are automatically removed.

domain

A numeric vector of length 2 specifying the left and right endpoints of the bounded domain; its components cannot be NaN.

penalty_param_candidates

A numeric vector of the penalty parameter candidates; each element must be non-negative.

fold_number

An integer to indicate the number of folds for cross validation. Default is 5.

Value

A object with class "LogConcaveDESM" with the penalty parameter being the optimal choice.

See Also

lcd_scorematching

Examples

set.seed(1119)
N <- 100
data <- rnorm(N)
domain <- c(-5, 5)
lambda_cand <- exp(c(-Inf, seq(-3, 1, by = 0.5)))

opt_result <- cv_optimal_density_estimate(data, domain, lambda_cand)


zhoucx1119/LogConcaveDESM documentation built on Aug. 28, 2024, 3:25 p.m.