bw.crit: Critical bandwidth

Description Usage Arguments Details Value Author(s) References Examples

View source: R/mode_testing_lin.R

Description

This function computes the critical bandwidth for a specified number of modes.

Usage

1
bw.crit(data,mod0=1,lowsup=-Inf,uppsup=Inf,n=2^15,tol=10^(-5),full.result=F)

Arguments

data

Sample for computing the critical bandwidth.

mod0

Number of modes for which the critical bandwidth is calculated. Default mod0=1.

lowsup

Lower limit for the random variable support in the computation of the critical bandwidth. Default is -Inf.

uppsup

Upper limit for the random variable support in the computation of the critical bandwidth. Default is Inf.

n

The number of equally spaced points at which the density is estimated. When n > 512, it is rounded up to a power of 2 as in the density function. Default n=2^15.

tol

Accuracy requested in the computation of the critical bandwidth. Default value of tol is 10^(-5).

full.result

If this argument is TRUE then it returns the full result list, see below. Default full.result=FALSE.

Details

With bw.crit the critical bandwidth for the number of modes specified in mod0 is calculated, e.g., the smallest bandwidth such that the kernel density estimator has at most mod0 modes. If the compact support is unknown, the critical bandwidth introduced by Silverman (1981) is computed and if it is provided that one of Hall and York (2001) is calculated.

Since a dichotomy method is employed for computing the critical bandwidth, the parameter tol is used to determine a stopping time in such a way that the error committed in the computation of the critical bandwidth is less than tol.

The NAs will be automatically removed.

Value

Depending on full.result either a number, the critical bandwidth of the sample for mod0 modes, or an object of class "estmod" which is a list containing the following components:

nmodes

The specified hypothesized value of the number of modes.

sample.size

The number of non-missing observations in the sample used for computing the number of modes.

bw

Value of the critical bandwidth test statistic.

lowsup

Lower limit of the support where the critical bandwidth is computed.

ippsup

Upper limit of the support where the critical bandwidth is computed.

fnx

The n coordinates of the points where the density is estimated for computing the critical bandwidth.

fny

The estimated density values.

Author(s)

Jose Ameijeiras-Alonso, Rosa M. Crujeiras and Alberto Rodríguez-Casal

References

Hall, P. and York, M. (2001). On the calibration of Silverman's test for multimodality, Statistica Sinica, 11, 515–536.

Silverman, B. W. (1981). Using kernel density estimates to investigate multimodality, Journal of the Royal Statistical Society. Series B, 43, 97–99.

Examples

1
2
3
4
5
6
7
8
# Critical bandwidth of Silverman (1981) for one mode.
set.seed(2016)
data=rnorm(50)
bw.crit(data)
# Critical bandwidth of Hall and York for two modes in the interval (-1.5,1.5).
set.seed(2016)
data=rnorm(50)
bw.crit(data,mod0=2,lowsup=-1.5,uppsup=1.5)

Example output

[1] 0.4180908
[1] 0.1717682

multimode documentation built on March 21, 2021, 1:06 a.m.