lcd: Computation of Second Derivative of Score Matching...

lcdR Documentation

Computation of Second Derivative of Score Matching Log-concave Density Estimate

Description

Computes the second derivative of the logarithm of the (penalized) log-concave score matching density estimate based on i.i.d samples, assuming it is a continuous piecewise linear function with knots at the samples. The nature of the underlying density estimation problem is a constrained quadratic optimization problem, which is solved by CVXR package. The output is an object of class "LogConcaveDESM".

Usage

lcd_scorematching(data, domain, penalty_param = 0.1, verbose = FALSE)

lcd_scorematching_bounded(data, domain, penalty_param = 0.1, verbose = FALSE)

lcd_scorematching_R(data, domain, penalty_param = 0.1, verbose = FALSE)

lcd_scorematching_ninfb(data, domain, penalty_param = 0.1, verbose = FALSE)

lcd_scorematching_ainf(data, domain, penalty_param = 0.1, verbose = FALSE)

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 domain. The domain can be a bounded interval, the entire real line, a left-bounded and right-unbounded interval, or a left-unbounded and right-bounded interval. Its components cannot be NaN.

penalty_param

Penalty parameter for computing the density estimate; must be non-negative. Default is 1e-1.

verbose

An optional logical value to indicate whether to print detailed CVXR solver output. Default is FALSE.

Details

The functions lcd_scorematching_bounded, lcd_scorematching_R, lcd_scorematching_ninfb and lcd_scorematching_ainf compute the second derivative of the logarithm of the (penalized) log-concave score matching density estimate at data when the underlying domain is a bounded interval, the entire real line, an interval of the form -\infty, b for some b < \infty, and an interval of the form a, \infty for some a > -\infty, respectively. The function lcd_scorematching encompasses all four cases.

Value

An object of class "LogConcaveDESM" whose underlying structure is a list containing the following elements

call

call: the call which produced the result.

data

numeric: the original data whose log-concave density function is to be estimated.

sorted_unique_data

numeric: the sorted unique data.

data_weights

numeric: weight vector of the sorted_unique_data.

domain

numeric: the bounded domain over the density function is assumed and estimated.

opt_theta

numeric: the optimal second derivative of the logarithm of the (penalized) log-concave score matching density estimate at the sorted unique data and two boundary points.

matrix_A

numeric: matrix A used to compute the log-concave score matching density estimate.

matrix_B

numeric: matrix B used to compute the log-concave score matching density estimate.

penalty_param

numeric: the penalty parameter used to compute the log-concave score matching density estimate.

Examples

set.seed(1119)
N <- 100
data <- rnorm(N)
domain <- c(-5, 5)
# no penalty term
result <- lcd_scorematching(data, domain, penalty_param = 0)

# with penalty term
result <- lcd_scorematching(data, domain, penalty_param = 1e-10)


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