Learn R Programming

probhat (version 0.4.1)

30_bandwidth_selection: Bandwidth Selection

Description

Functions for bandwidth selection.

THESE FUNCTIONS SHOULD BE REGARDED AS SUB-OPTIMAL.

Usage

auto.dbw (x, ..., bw.method="ph.default", smoothness=1)
auto.cbw (x, ..., bw.method="ph.default", smoothness=1)

Arguments

x

A numeric vector, of data. In the continuous case, x may also be a matrix.

bw.method

String, the initial bandwidth selection method. Currently, "ph.default", "Scott" or "Silverman". Refer to details.

smoothness

Numeric, smoothness (scaling) parameter. Refer to details.

Ignored.

Value

In the discrete case, a single integer. In the continuous case, a numeric vector.

Details

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.

References

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.

See Also

bw.nrd, bw.nrd0

Discrete Kernel Smoothing, Continuous Kernel Smoothing

Examples

Run this code
# NOT RUN {
prep.ph.data ()
auto.cbw (trees2)
# }

Run the code above in your browser using DataLab