bartlettB.test | R Documentation |
Bartlett's test uses the Kolmogorov-Smirnov test applied to the cumulative normalized periodogram.
bartlettB.test(x, plot.it = FALSE)
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. |
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.
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 |
Code was based on Professor Newton's explanation
G. P. Nason
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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sta4.69")}
compute.rejection
, cumperiod
#
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.