Description Usage Arguments Details Value Author(s) References See Also Examples
Can generate white noise sequences, or ARMA time series
and subject multiple realizations of these to various tests for
white noise. The function then counts how many have
been rejected to give some idea of empirical size (if no ar
or ma
term is specified) or power (if such terms are specified).
1 2 3 4 5 6  compute.rejection(ar = NULL, ma = NULL, npow = 100, nom.size = 0.05,
ndata = 1024, lapplyfn = lapply, Box.lag = 1, rand.gen = rnorm,
hwwn = TRUE, box = TRUE, bartlett = TRUE,
d00test = TRUE, genwwn = TRUE, hywn = TRUE, hywavwn = TRUE,
filter.number = 10, family = "DaubExPhase",
away.from = "standard", ...)

ar 
Any autoregressive terms to go directly to the

ma 
As 
npow 
The number of realizations to carry out. The best
assessments are carried out with high values of 
nom.size 
The nominal statistical size of the test. Note: this does not change the nomimal size for ALL tests. You need to check each help pages for each function to check what can be changed. 
ndata 
The length of the white noise or ARMA realizations. Power for both these tests depends on sample size. 
lapplyfn 
If you have the library 
Box.lag 
The Box test tests for white noise by examining
autocorrelation coefficients. This argument specifies the max number
of autocorrelation coefficients, ie. coefficients from lag 1 up
to 
rand.gen 
Alternative innovation generator. By default Gaussian innovations are used, but you can specify alternatives to get heavytailed innovations, for example. 
hwwn 
If TRUE then the 
box 
If TRUE then the 
bartlett 
If TRUE then the 
d00test 
If TRUE then the 
genwwn 
If TRUE then the 
hywn 
If TRUE then the 
hywavwn 
If TRUE then the 
filter.number 
The number of vanishing moments of wavelets used in the general wavelet tests (genwwn, hywn and hywavwn). 
family 
Wavelet family, as for 
away.from 
The number of finer scales not to use for the
general wavelet tests. These tests work by relying on the
asymptotic normality of wavelet coefficients, but this only
becomes useful away from the finer scales. This argument
can be an integer in which case it defines the number of fine
scales to ignore. Alternatively, you can supply the argument

... 
Other arguments to 
This function repeatedly runs the hypothesis tests on
realizations from a stochastic process which can be white
noise (if ar
and ma
are NULL
) or an ARMA
process specified by ar
and ma
. It then counts how
many times the null was rejected and returns this as proportion
of the total number of realizations. In this way, this function
can compute the empirical size and power of the tests.
A list with eight components. Each component is a number, between
zero and one, which corresponds to the empirical size or power
of each test. Note, if any component is NULL
this means
that it was not evaluated and was ‘turned off’ in the command
line by setting its name equal to FALSE
.
Delyan Savchev and Guy Nason
Nason, G.P. and Savchev, D. (2014) White noise testing using wavelets. Stat, 3, 351362. http://dx.doi.org/10.1002/sta4.69
bartlettB.test
,
d00.test
,
genwwn.test
,
hwwn.test
,
hywn.test
,
hywavwn.test
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62  #
# Compute empirical size of both tests using 1000 realizations
# with data of length 32
#
answer < compute.rejection(npow=100, ndata=32)
#
# Print the answer
#
print(answer)
#$hwwntest.rejprop
#[1] 0.03
#
#$box.rejprop
#[1] 0.02
#
#$bartlett.rejprop
#[1] 0.01
#
#$d00.pow
#[1] 0.03
#
#$genwwn.pow
#[1] 0.02
#
#$hywn.pow
#[1] 0.01
#
#$hywavwn.pow
#[1] 0.03
#
#
# So, all empirical sizes should be close to their nominal value of 0.05
#
# Now let's try and ascertain the empirical power on an AR(1)
#
answer < compute.rejection(ar=0.8, npow=100, ndata=32)
#
# Print the answer
#
print(answer)
#$hwwntest.rejprop
#[1] 0.79
#
#$box.rejprop
#[1] 0.98
#
#$bartlett.rejprop
#[1] 0.97
#
#$d00.pow
#[1] 0.97
#
#$genwwn.pow
#[1] 0.94
#
#$hywn.pow
#[1] 0.95
#
#$hywavwn.pow
#[1] 0.85
#
# Most powers are pretty good.

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.