| select_wavelet | R Documentation |
Chooses the resolution level and the post-smoothing bandwidth of
[qdf_wavelet()] by 'folds'-fold cross-validation. The implied density of the
data is \hat g(x) = 1/\hat q(\hat G_{\rm train}(x)). With
'criterion = "lscv"' (default) the pair minimises the least-squares
criterion \int \hat g^2 - 2 n_k^{-1} \sum \hat g(x_i) over held-out
observations, using \int \hat g(x)^2 dx = \int_0^1 1/\hat q(u)\,du;
this targets integrated squared error (Rudemo 1982; Bowman 1984). With
'criterion = "loglik"' it maximises the held-out log-likelihood. Pairs
with h below the lattice spacing 1/(2^{j_0}-1) are not
considered, since the local-linear smoother is then ill-conditioned.
select_wavelet(
x,
j0_grid = 3:6,
h_grid = c(0.03, 0.05, 0.08, 0.12, 0.2, 0.3),
folds = 5L,
criterion = c("lscv", "loglik"),
...
)
x |
numeric sample. |
j0_grid, h_grid |
candidate values. |
folds |
number of folds. |
criterion |
'"lscv"' or '"loglik"'. |
... |
passed to [qdf_wavelet()] (e.g. 'threshold', 'smooth', 'filter'). |
a list with 'j0', 'h', and the matrix of criterion values ('ll', rows 'j0_grid', columns 'h_grid').
Fold assignment (or bootstrap resampling) uses R's random number generator; call [set.seed()] beforehand to make results exactly reproducible.
set.seed(2)
x <- rbeta(300, 0.5, 0.5)
select_wavelet(x, j0_grid = 4:6, h_grid = c(0.05, 0.15), folds = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.