Functions for bandwidth selection.
THESE FUNCTIONS SHOULD BE REGARDED AS SUB-OPTIMAL.
auto.dbw (x, ..., bw.method="ph.default", smoothness=1)
auto.cbw (x, ..., bw.method="ph.default", smoothness=1)
A numeric vector, of data. In the continuous case, x may also be a matrix.
String, the initial bandwidth selection method. Currently, "ph.default", "Scott" or "Silverman". Refer to details.
Numeric, smoothness (scaling) parameter. Refer to details.
Ignored.
In the discrete case, a single integer. In the continuous case, a numeric vector.
THESE FUNCTIONS SHOULD BE REGARDED AS SUB-OPTIMAL.
These functions computes an initial bandwidth. Then the initial bandwidth parameter is multiplied by the smoothness parameter.
In the discrete case (auto.dbw), this bandwidth is rounded up to the nearest odd integer.
Currently, there are three options:
(1) bw.method="ph.default".
For a single variable/column, the bandwidth is equal to the difference between the quantiles, marking the middle 0.66 of observations. i.e. diff (quantile (x, c (0.17, 0.83) ) )
For m variables/columns, 0.66 is replaced with 0.66^(1 / m).
(2) bw.method="Scott", which calls stats::bw.nrd, for each variable/column.
(3) bw.method="Silverman", which call stats::bw.nrd0, for each variable/column.
Refer to the vignette for an overview, references and better examples.
Also please refer to stats::bw.nrd and stats::bw.nrd0 for references, and more information.
# NOT RUN {
prep.ph.data ()
auto.cbw (trees2)
# }
Run the code above in your browser using DataLab