Description Usage Arguments Details Value Author(s)
This function provides a bandwidth for kernel denvolvolution density estimator. This works for several deconvolution scenarios, specifically, when the error distribution is known, when a sample of pure errors is available instead and when a contaminated sample is available as panel data.
1 2 3 4 5 6 | kerdec_dens(smp, method = c("CV", "NR")[1], kernel = "flat",
lower = NULL, upper = NULL, x_eval = NULL, h = NULL, h0 = NULL,
error_smp = NULL, error_dist = "Laplace", error_scale_par = NULL,
resolution = 128, error_proc = "all", panel_proc = "keep_first",
truncation_bound = NULL, bw_interval = NULL,
plot_search_interval = FALSE, bandwidth_only = FALSE)
|
smp |
It is either a vector of size n or a nxl matrix (for repeated observations; l per each individual). |
method |
Method used to select the bandwidth. The currently available methods are "CV" (cross-validation) and "NR" (normal reference). Cross-validation is the default. |
kernel |
Kernel whose Fourier transform has bounded support. There are currently 5 kernel programmed: "sinc", "triangular", "triw", "tric" and "flat". See vignette for further details and examples. Flat-top kernel is the default. |
lower |
Lower limit where the density will be evaluated. |
upper |
Upper limit where the density will be evaluated. |
x_eval |
Grid where the density will be evaluated. If provided, 'lower' and 'upper' will be dismissed. |
h |
Bandwidth parameter which is only required if method = NULL. |
h0 |
Optional argument used as initial value to look for the optimal value. |
error_smp |
Optional vector of errors. It is necessary to approximate the error distribution if it is unknown. |
error_dist |
Three possible values are accepted. c("Normal", "Laplace", "None"). |
error_scale_par |
Scale parameter matching the standard deviation. It is NULL by default and it is required if (and only if) error_dist is normal or Laplace and no sample of error is provided nor contaminated sample comes in panel structure. |
resolution |
Number of points to approximate integral in inversion formula, also to estimate the density (if grid was not given). |
error_proc |
This is required only for panel data
structure. It refers to the way errors are processed. See
|
panel_proc |
It defined what will be the contaminated sample (only) for panel data. "keep_first" will use the first column as sample while "take_aver" will take the average of contaminated samples per individual. |
truncation_bound |
It truncates the integrand in deconvolution formula when the denominator is smaller than this bound. |
bw_interval |
Do not modify it. |
plot_search_interval |
Logical value determining whether the interval where the bandwidth was optimized will be printed. It is taken into account only when 'bw_interval' is not NULL. |
bandwidth_only |
If TRUE, it does not evaluate the density at any value. |
See the vignette for more details.
A list
Guillermo Basulto-Elias
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.