kdens {PPMiss}R Documentation

Kernel density estimator

Description

The probability density function FF' is estimated using a kernel density approach. More specifically, first yi=f^(xi)y_i = \hat{f}(x_i^\ast) is estimated using T=512T = 512 (default for the function density) equally spaced points xix_i^\ast, 1iT1 \leq i \leq T, in the interval [x(1)3b,x(n)+3b][x_{(1)} - 3b, x_{(n)} + 3b], where bb is the bandwidth for the Gaussian kernel density estimator, chosen by applying the Silverman's rule of thumb (the default procedure in density). A cubic spline interpolation (the default method for spline) is then applied to the pairs {(xi,yi)}i=1T\{(x_i^\ast, y_i)\}_{i=1}^T to obtain F^n(x)\hat F_n'(x) for all x[x(1)3b,x(n)+3b]x \in [x_{(1)} - 3b, x_{(n)} + 3b].

Usage

kdens(x)

Arguments

x

the data from which the estimate is to be computed.

Value

a function that approximates the probability density function.

Examples

# creating a time series
trunc = 50000
cks <- arfima.coefs(d = 0.25, trunc = trunc)
eps <- rnorm(trunc+1000)
x <- sapply(1:1000, function(t) sum(cks*rev(eps[t:(t+trunc)])))

# kernel density function
dfun <- kdens(x)

# plot
curve(dfun, from = min(x), to = max(x))


[Package PPMiss version 0.1.1 Index]