| kdensity_grid | R Documentation |
kdensity_grid() evaluates a fitted kdensity() object on a grid. The
"fft" method uses weighted linear binning and an FFT convolution with the
fitted kernel, the algorithm of stats::density(), for every built-in
symmetric kernel. It also supports the Gaussian-copula kernel through its
exact Gaussian-convolution representation on the probit scale.
kdensity_grid(
object,
from = NULL,
to = NULL,
n = 512L,
method = c("auto", "exact", "fft"),
fft_n = NULL,
truncate = 8
)
object |
A fitted |
from, to |
Finite endpoints of the evaluation interval. By default,
|
n |
Number of returned grid points. |
method |
One of |
fft_n |
Size of the internal convolution grid. The default is at least
four times |
truncate |
Number of Gaussian standard deviations used to pad an FFT
convolution. The Laplace kernel is padded by |
The FFT method approximates only the binning and interpolation steps. The
fitted parametric start and the normalization constant from object are
retained. Calling the kdensity object itself always uses exact evaluation.
An object of class "density". Its method element records whether
exact or FFT evaluation was used.
kdensity()
set.seed(1)
fit <- kdensity(rbeta(1000, 2, 5), kernel = "gcopula", bw = 0.12)
fast <- kdensity_grid(fit, n = 512)
plot(fast)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.