bartlettB.test: Bartlett's B test for white noise

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/bartlettB.test.R

Description

Bartlett's test uses the Kolmogorov-Smirnov test applied to the cumulative normalized periodogram.

Usage

1
bartlettB.test(x, plot.it = FALSE)

Arguments

x

The time series you wish to test, of any length.

plot.it

If TRUE then the normalized cumulative periodogram is plotted along with a straight line that indicates the theoretical line of this object under the null hypothesis. A further plot of the density of the true statistic under the null hypothesis is produced.

Details

This test: (i) computes the periodogram, (ii) derives the normalized cumulative periodogram using the cumperiod function. Under the null hypothesis of white noise the periodogram is a set of iid exponential random variables, asymptotically. So, the cumulative periodogram should look like a straight line at a 45 degree angle. The test statistic is the maximum deviation of the normalized cumulative periodogram and this straight line. The p-value of the test is computed within the function by the b.power function. This is an example of a Kolmogorov-Smirnov statistical test.

Value

An object of class htest. A list containing the following components:

statistic

The value of the Bartlett test statistic.

p.value

The p-value of the test

method

A text string saying what the method was

Note

Code was based on Professor Newton's explanation

Author(s)

G. P. Nason

References

Bartlett, M.S. (1967) Some Remarks on the Analysis of Time-Series. J. R. Statist. Soc. B, 54, 25-38.

http://www.stat.tamu.edu/~jnewton/stat626/topics/topics/topic13.pdf Link to Professor H. Joseph Newton's web page on Bartlett's test

Nason, G.P. and Savchev, D. (2014) White noise testing using wavelets. Stat, 3, 351-362. http://dx.doi.org/10.1002/sta4.69

See Also

compute.rejection, cumperiod

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#
# Do white noise test on smallish data set
#
x <- rnorm(30)
bartlettB.test(x)
#
# For my realization the answer was:
#
#
#	Bartlett B Test for white noise
#
#data:  
#= 0.3747, p-value = 0.999
#
# So, we accept H_0

Example output

	Bartlett B Test for white noise

data:  
= 0.51667, p-value = 0.9523

hwwntest documentation built on May 29, 2017, 7:22 p.m.