covIwrap | R Documentation |
Computation of the covI
function is
intensive. This function permits values of covI
to be stored in an object, and then if these values are
requested again the values can be obtained from a store
rather than being computed from scratch.
covIwrap(S, m, n, ll, storewrap, P)
S |
Same argument as for |
m |
The same argument as in |
n |
The same argument as in |
ll |
The same argument as in |
storewrap |
A list. On first call to this function the user should
supply |
P |
Same argument as in |
Note: covIwrap
could be removed from the function tree
altogether. I.e. varip2
could call
covI
directly. However,
covIwrap
considerably improves the efficiency of the algorithm
as it stores intermediate calculations that can be reused rather
than being computed repeatedly.
A list containing the following components:
ans |
The appropriate covariance |
storewrap |
A list containing information about all previously
computed covariances. This list should be supplied as the
|
Guy Nason.
Nason, G.P. (2013) A test for second-order stationarity and approximate confidence intervals for localized autocovariances for locally stationary time series. J. R. Statist. Soc. B, 75, 879-904. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/rssb.12015")}
varip2
, covI
P1 <- PsiJ(-5, filter.number=1, family="DaubExPhase")
#
# First call to covIwrap
#
ans <- covIwrap(S=c(1/2, 1/4, 1/8, 1/16, 1/32), m=1, n=3, ll=5,
storewrap=NULL, P=P1)
#
# Make sure you keep the storewrap component.
#
my.storewrap <- ans$storewrap
#
# What is the answer?
#
ans$ans
#[1] 0.8430809
#
# Issue next call to covIwrap: but storewrap argument is now the one we stored.
#
ans <- covIwrap(S=c(1/2, 1/4, 1/8, 1/16, 1/32), m=1, n=3, ll=5,
storewrap=my.storewrap, P=P1)
#
# This call will reuse the stored value. However, if you change any of the
# arguments then the store won't be used.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.