Learn R Programming

hwwntest (version 1.3.2)

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

Description

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

Usage

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

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

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.

Author

G. P. Nason

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.

References

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

https://web.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. tools:::Rd_expr_doi("10.1002/sta4.69")

See Also

compute.rejection, cumperiod

Examples

Run this code
#
# 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

Run the code above in your browser using DataLab