npsymtest {np}R Documentation

Kernel Consistent Asymmetry Test with Mixed Data Types

Description

npsymtest implements a consistent entropy-based test for asymmetry as described in Maasoumi and Racine (2009).

Usage

npsymtest(data = NULL,
          boot.num = 399,
          bw = NULL,
          random.seed = 42)

Arguments

data a vector containing the variable.
boot.num an integer value specifying the number of bootstrap replications to use. Defaults to 399.
bw a numeric (scalar) bandwidth. Defaults to plug-in (see details below).
random.seed an integer used to seed R's random number generator. This is to ensure replicability. Defaults to 42.

Details

npsymtest computes the Bhattacharya-Matusita-Hellinger metric entropy measure of divergence between the densities/probabilities of the data and the rotated data. See Maasoumi and Racine (2009) for details.

Value

npsymtest returns an object of type symtest with the following components

Srho the statistic Srho
Srho.bootstrap contains the bootstrap replications of Srho
P the P-value of the statistic
boot.num number of bootstrap replications
data.rotate the rotated data series
bw the numeric (scalar) bandwidth


summary supports object of type symtest.

Usage Issues

When using data of type factor it is crucial that the variable not be an alphabetic character string (i.e. the factor must be integer-valued). The rotation is conducted about the median after conversion to type numeric which is then converted back to type factor. Failure to do so will have unpredictable results. See the example below for proper usage.

Author(s)

Tristen Hayfield hayfield@phys.ethz.ch, Jeffrey S. Racine racinej@mcmaster.ca

References

Maasoumi, E. and J. S. Racine(2009), “A robust entropy-based test of asymmetry for discrete and continuous processes”, Econometric Reviews, 28, 246-261.

Examples

set.seed(1234)

# Asymmetric discrete probability function

x <- factor(rbinom(50,2,.8))
npsymtest(x,boot.num=99)

Sys.sleep(5)

# Symmetric discrete probability function

x <- factor(rbinom(50,2,.5))
npsymtest(x,boot.num=99)

Sys.sleep(5)

# Asymmetric continuous density function

y <- rchisq(50,df=2)
npsymtest(y,boot.num=99)

Sys.sleep(5)

# Symmetric continuous density function

y <- rnorm(50)
npsymtest(y,boot.num=99)


[Package np version 0.30-4 Index]