lcd | R Documentation |
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
".
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)
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 |
penalty_param |
Penalty parameter for computing the density estimate; must be non-negative.
Default is |
verbose |
An optional logical value to indicate whether to print detailed CVXR
solver output. Default is |
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.
An object of class "LogConcaveDESM" whose underlying structure is a list containing the following elements
call: the call which produced the result.
numeric: the original data whose log-concave density function is to be estimated.
numeric: the sorted unique data.
numeric: weight vector of the sorted_unique_data.
numeric: the bounded domain over the density function is assumed and estimated.
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.
numeric: matrix A used to compute the log-concave score matching density estimate.
numeric: matrix B used to compute the log-concave score matching density estimate.
numeric: the penalty parameter used to compute the log-concave score matching density estimate.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.