Learn R Programming

scdensity (version 1.0.3)

Shape-Constrained Kernel Density Estimation

Description

Implements methods for obtaining kernel density estimates subject to a variety of shape constraints (unimodality, bimodality, symmetry, tail monotonicity, bounds, and constraints on the number of inflection points). Enforcing constraints can eliminate unwanted waves or kinks in the estimate, which improves its subjective appearance and can also improve statistical performance. The main function scdensity() is very similar to the density() function in 'stats', allowing shape-restricted estimates to be obtained with little effort. The methods implemented in this package are described in Wolters and Braun (2017) , Wolters (2012) , and Hall and Huang (2002) . See the scdensity() help for for full citations.

Copy Link

Version

Install

install.packages('scdensity')

Monthly Downloads

159

Version

1.0.3

License

GPL-2

Maintainer

Mark A Wolters

Last Published

August 27th, 2024

Functions in scdensity (1.0.3)

BuildConCheckGrid

A function to add the constraint-checking grid
BuildConstraints

Build objects Apos, Aunit, Aeq, Ashape, bshape
QPsolve

A wrapper to call solve.QP.
SequentialLineMin

Minimize a function of r variables by sequential univariate searches.
summary.scdensity

Summary method for class scdensity.
CleanWeights

Clean out near-zeros from a probability weights vector and re-normalize
scdensity

Shape-constrained kernel density estimation.
displayFailure

Display estimation results to console in an unsuccessful case.
ConvolutionMatrix

Computes a matrix of Gaussian kernel convolution values given two vectors.
SpectralShift

Performs the spectral shift on a matrix to make it numerically positive definite.
displaySuccess

Display estimation results to console in a successful case.
scdensity-package

scdensity: Shape-constrained kernel density estimation.
WeightedKDE

Function to carry out the weighted or adjusted KDE optimization.
isBoundedR

Check for zeros at the right side of a vector of function values.
isMonotoneL

Check for monotonicity of function values in the left tail.
BinningStep

Carry out the binning step.
print.scdensity

Print method for class scdensity.
print.summary.scdensity

Prints the information in a summary.scdensity object to the console.
AddBinObjects

A small function to add the objects needed for the binning QP to the problem list.
EstimationStep

Carry out the shape-constrained estimation
improve

Move points closer to a target while maintaining a constraint.
InitializeP

Initialize the list of problem-related objects.
isUnimodal

Check for unimodality of function values.
isMonotoneR

Check for monotonicity of function values in the right tail.
isBoundedL

Check for zeros at the left side of a vector of function values.
MakeCenters

Create a vector of kernel centers covering [LB, UB].
NormalGridFcn

Compute the values of n normal PDFs (or their derivatives at m grid points).
getQuantile

Estimate a specific quantile of a pdf given abscissa and ordinate values.
plot.scdensity

Plot method for class scdensity.
makeOF

A function factory for making the search objective function.
getQuantileFunction

Build a quantile function for a given constrained density estimator.