estimateDensityBySpline: Estimate the density value from a sample by a spline...

View source: R/circGLM.R

estimateDensityBySplineR Documentation

Estimate the density value from a sample by a spline interpolation of the kernel density

Description

This function estimates the density at x0 by first taking a kernel density estimate of a sample from the probability density x, and then interpolating it by a spline.

Usage

estimateDensityBySpline(x, x0 = 0, npow = 15, rangeExtend = 1/4)

Arguments

x

A (large) sample of from the probability density function of interest, such as a posterior.

x0

The value at which to evaluate the density.

npow

The precision used with the density function.

rangeExtend

The number of standard deviations past the range of x to start the density estimate.

Value

Numeric; a scalar of the estimated probability density at x0.

Examples

# Compare the estimate from this function with the analytic result.
estimateDensityBySpline(rnorm(1000), 0.1)
dnorm(.1)


keesmulder/circglmbayes documentation built on July 24, 2022, 6:39 a.m.