8
Statistics and Computing (2001) 11, 75–82 Symbolic cumulant calculations for frequency domain time series BRUCE SMITH and CHRISTOPHER FIELD Department of Mathematics and Statistics, Dalhousie University, Halifax, NS B3H 3J5 Canada Received May 1998 and accepted May 1999 With time series data, there is often the issue of finding accurate approximations for the variance of such quantities as the sample autocovariance function or spectral estimate. Smith and Field (J. Time. Ser. Anal 14: 381–395, 1993) proposed a variance estimate motivated by resampling in the frequency domain. In this paper we present some results on the cumulants of this and other frequency domain estimates obtained via symbolic computation. The statistics of interest are linear combinations of products of discrete Fourier transforms. We describe an operator which calculates the joint cumulants of such statistics, and use the operator to deepen our understanding of the behaviour of the resampling based variance estimate. The operator acts as a filter for a general purpose operator described in Andrews and Stafford (J.R. Statist. Soc. B55, 613–627). Keywords: frequency domain, time series, cumulant, symbolic computation 1. Introduction In this paper, we are interested in the cumulants for estimates based on the discrete Fourier transform. These include, for example, the sample auto-covariance and cross-covariance func- tions and estimates of cumulant spectra. To be specific, we let X 0 , X 1 ,..., X T -1 be a stretch of data from a strictly stationary series having k ’th order joint cumulant c(u 1 ,..., u k-1 ), and k ’th order cumulant spectrum f (λ 1 ,...,λ k-1 ). We are concerned with calculating the cumulants of statistics of the form J (T ) ( A) = 2π T T -1 X s =1 A(2π s / T )d (2π s / T )d (-2π s / T ) where d (λ) = T -1 X t =0 X t exp(-i λt ) is the discrete Fourier transform at frequency λ. J (T ) ( A) is an estimate of the parameter J ( A) = Z 2π 0 A(α) f (α) d α. This family of parameters includes, for particular choices of A(·), the spectral measure, broad band spectral averages, the autocovariance function, and in the case of multivariate X , the cross covariance function. For notational convenience in what follows, functions of the form h (2π s / T ) will be abbreviated as h (s ) when it is clear that s is an integer. As an example of a statistic of this form, we consider the ‘resampled’ version of J (T ) ( A), J k ( A), developed in Smith and Field (1993). The idea there is to obtain an estimate of the vari- ance of J (T ) ( A) based on replicates J k ( A) and which is indepen- dent of any assumption of normality. Specifically J k ( A) = 1 T 2 T -1 X s =1 A(s )d (s ) d (s - k ) k ∈ {±1,..., ±M T }. The estimate of the variance of J (T ) ( A) is ˆ V ( A) = 1 2 M T k=M T X k=-M T ,k6=0 J k ( A) J k ( A) In order to evaluate the performance of the variance estimate, we need to compute the mean and variance of ˆ V ( A). To accom- plish this we have to compute the expected value of products of discrete Fourier transforms and their conjugates. Although in Smith and Field we were able to carry out these computations through brute force, it seems desirable to develop automatic al- gorithms to simplify the sums of the expected values of these 0960-3174 C 2001 Kluwer Academic Publishers

Symbolic cumulant calculations for frequency domain time series

Embed Size (px)

Citation preview

Page 1: Symbolic cumulant calculations for frequency domain time series

Statistics and Computing (2001) 11, 75–82

Symbolic cumulant calculations forfrequency domain time series

BRUCE SMITH and CHRISTOPHER FIELD

Department of Mathematics and Statistics, Dalhousie University, Halifax, NS B3H 3J5 Canada

Received May 1998 and accepted May 1999

With time series data, there is often the issue of finding accurate approximations for the variance ofsuch quantities as the sample autocovariance function or spectral estimate. Smith and Field (J. Time.Ser. Anal 14: 381–395, 1993) proposed a variance estimate motivated by resampling in the frequencydomain. In this paper we present some results on the cumulants of this and other frequency domainestimates obtained via symbolic computation. The statistics of interest are linear combinations ofproducts of discrete Fourier transforms. We describe an operator which calculates the joint cumulantsof such statistics, and use the operator to deepen our understanding of the behaviour of the resamplingbased variance estimate. The operator acts as a filter for a general purpose operator described inAndrews and Stafford (J.R. Statist. Soc. B55, 613–627).

Keywords: frequency domain, time series, cumulant, symbolic computation

1. Introduction

In this paper, we are interested in the cumulants for estimatesbased on the discrete Fourier transform. These include, forexample, the sample auto-covariance and cross-covariance func-tions and estimates of cumulant spectra. To be specific, we letX0, X1, . . . , XT−1 be a stretch of data from a strictly stationaryseries having k’th order joint cumulant c(u1, . . . , uk−1), and k’thorder cumulant spectrum f (λ1, . . . , λk−1). We are concernedwith calculating the cumulants of statistics of the form

J (T )(A) = 2π

T

T−1∑s=1

A(2πs/T )d(2πs/T )d(−2πs/T )

where

d(λ) =T−1∑t=0

Xt exp(−iλt)

is the discrete Fourier transform at frequency λ. J (T )(A) is anestimate of the parameter

J (A) =∫ 2π

0A(α) f (α) dα.

This family of parameters includes, for particular choices ofA(·), the spectral measure, broad band spectral averages, the

autocovariance function, and in the case of multivariate X , thecross covariance function.

For notational convenience in what follows, functions of theform h(2πs/T ) will be abbreviated as h(s) when it is clear thats is an integer.

As an example of a statistic of this form, we consider the‘resampled’ version of J (T )(A), Jk(A), developed in Smith andField (1993). The idea there is to obtain an estimate of the vari-ance of J (T )(A) based on replicates Jk(A) and which is indepen-dent of any assumption of normality. Specifically

Jk(A) = 1

T 2

T−1∑s=1

A(s)d(s)d(s − k)

k ∈ {±1, . . . ,±MT }. The estimate of the variance of J (T )(A) is

V̂ (A) = 1

2MT

k=MT∑k=−MT ,k 6=0

Jk(A)Jk(A)

In order to evaluate the performance of the variance estimate,we need to compute the mean and variance of V̂ (A). To accom-plish this we have to compute the expected value of productsof discrete Fourier transforms and their conjugates. Although inSmith and Field we were able to carry out these computationsthrough brute force, it seems desirable to develop automatic al-gorithms to simplify the sums of the expected values of these

0960-3174 C© 2001 Kluwer Academic Publishers

Page 2: Symbolic cumulant calculations for frequency domain time series

76 Smith and Field

products. We decided to use symbolic computation to accom-plish this with the aim of having a tool that will be useful ina number of time series settings where the calculation of thecumulants in nonlinear situations can be quite daunting.

In the next section we describe the results that we need in orderto carry out the simplifications. In Section 3 we set down a gen-eral algorithm for carrying out our calculations, and in Section 4we include three examples which illustrate the use of Mathe-matica in carrying out frequency domain calculations. The firstexample concerns the well known formula for the variance ofthe smoothed periodogram. The second example is a problemwith asymmetry in the indices of summation and points out thatcareful consideration needs to be given in such cases. The thirdexample considers the first two moments of V̂ (A). The final sec-tion gives some conclusions and indicates some open questionsand directions.

2. Cumulants and cumulant spectra

Our goal is the development of an automated scheme for thecalculation of joint cumulants of linear combinations of prod-ucts of discrete Fourier transforms. To this end we will use twokey results on joint cumulants. The first concerns the decompo-sition of joint cumulants of product random variables in termsof joint cumulants of single random variables, and the secondsets down formulae for joint cumulants of discrete Fourier trans-forms. Used together, these two results allow one to develop cu-mulant and moment formulae for a variety of frequency domainstatistics.

Theorem 1. Consider the two way ragged array of randomvariables {Xi j , j = 1, . . . , Ji , i = 1, . . . , I } and the I productrandom variables

Yi =Ji∏

j=1

Xi j , i = 1, . . . , I

Then

cum(Y1, . . . ,YI ) =∑v

cum(Xi j ; i j ∈ v1) · · · cum(Xi j ; i j ∈ vp)

(1)

where the sum is taken over all indecomposable partitions of thetwo way table of indices {i, j}, j = 1, . . . , Ji , i = 1, . . . , I .

The definition of an indecomposable partition is given inBrillinger (1981), page 20 with the result given in Theo-rem 2.3.2 on page 21. McCullagh (1987) sets down the sameresult using set theoretic terminology whereby the sum is saidto be taken over the collection of complementary set partitions.

In terms of making effective use of this Theorem, the keypoints are firstly, that one needs a convenient algorithm for enu-merating indecomposable partitions (or complementary set par-titions), and secondly, that one has useful expressions for thejoint cumulants on the right hand side of (1).

Beginning with Stafford (1994), and continuing in a more re-fined way with Andrews and Stafford (1993), the first point hasbeen thoroughly addressed by the development of a computeralgebra system which generates the collection of indecompos-able partitions (the complementary set partitions) over whichthe sum in (1) is taken.

As regards the second point, it happens that in many timeseries calculations, there are useful expressions for the joint cu-mulants on the right hand side of (1) which are provided by thefollowing result of Brillinger and Rosenblatt (1967).

We note that the k’th order cumulant spectrum of the sta-tionary series X (t), f (λ1, . . . , λk−1) is related to the k’th ordercumulant c(u1, . . . , uk−1) by

f (λ1, . . . , λk−1) = (2π )−k+1∑

u1

· · ·

×∑uk−1

exp{−i(λ1u1 + . . .+ λk−1uk−1}c(u1, . . . , uk−1)

Theorem 2. Assume that the time series X(t) is second orderstationary with k’th order joint cumulant

c(u1, . . . , uk−1) = cum{X (t + u1), . . . , X (t + uk−1), X (t)}and that for each k = 2, 3 . . . and for each j = 1, . . . , k − 1,

∞∑u1,...,uk−1=−∞

(1+ |u j |)|c(u1, . . . , uk−1)| <∞

Then

cum(d(λ1, . . . , d(λk−1)}

= (2π )k−11(T )

(k∑1

λ j

)f (λ1, . . . , λk)+ O(1) (2)

Here |1(T )(λ)| ≤ 1/| sin(λ/2)|, and so 1(T )(λ) has reducedmagnitude for λ not near a multiple of 2π . Furthermore, for san integer

1(T )(2πs/T ) = T, s = 0 (mod T )

0, s 6= 0 (mod T )

In the following sections we will present an algorithm andMathematica code which ties together Theorems 1 and 2 toprovide a tool for calculating cumulants of a variety of frequencydomain statistics, In doing so we will also make use the followingthree well know properties of cumulants.

Property 1. cum(a1 Z1, . . . , aI Z I ) = a1 . . . aI cum(Z1, . . . ,

Z I )

Property 2. cum(X1 + Z1, Z2, . . . , Z I ) = cum(X1, Z2, . . . ,

Z I )+ cum(Z1, Z2, . . . , Z I )

Property 3. For complex valued random variables Cov(X, Z )= cum(X, Z̄ ) where Z̄ denotes complex conjugate.

Page 3: Symbolic cumulant calculations for frequency domain time series

Symbolic cumulant calculations 77

3. Algorithm

Consider the I random variables

Yi =T−1∑s=0

Ai (s)Ki∏j=1

d(λi (s, j)), i = 1, . . . , I (3)

where the Ai are non-stochastic. Following is a general algorithmto evaluate cum{Y1, . . . ,YI }.

Step 1: Apply properties 1 and 2 to pass the cumulantoperator inside of sums and constants and thereby reducecum{Y1, . . . ,YI } to∑

s1

. . .∑

sI

A1(s1) . . . AI (sI )

×cum

{K1∏

j1=1

d(λ1(s1, j1), . . . ,K I∏

jI=1

d(λI (sI , jI )

}Step 2: Apply Theorem 1 to expand the joint cumulant from

step 1 in terms of the joint cumulants of discrete Fourier trans-forms.

Step 3: Apply Theorem 2 to re-write joint cumulants of dis-crete Fourier transforms in terms of cumulant spectra and solvethe equations specified by the functions 1(T )(λ).

Implementation of step 1 is straightforward. Step 2 has beenautomated by Andrews and Stafford (1997), who have kindlyprovided us with their Mathematica function CSP to carry outthe step. The CSP function is included in the Appendix belowunder the name Cum.

It remains to consider step 3, which consists principally ofrestricting the indices of summation according to the equationsspecified by the functions 1(T )(λ). In all examples which weconsider, the frequencies λ are Fourier frequencies of the form2πs/T . Therefore, by definition of the function 1(T ), the pres-ence of a term such as 1(T )(2π (s− t)/T ), which is only non-zero under the restriction that s− t = 0 (mod T ), reduces thenumber of indices of summation by one. We have written a Math-ematica function Kf which filters the cumulants generated atstep 2 by solving the associated systems of equations modulo T ,and incorporating the various constants and definitions associ-ated with Theorem 2. We illustrate its use with several examples.

To keep the Mathematica code as concise as possible we havewritten k’th order cumulant spectra as f (λ1, . . . , λk) rather thanf (λ1, . . . , λk−1), which presents no restriction as the two formsare equivalent in the stationary case.

4. Examples

4.1. The CSP operator

Our function Cum is the CSP operator of Andrews and Stafford(to appear), renamed. CSP, the complementary set partition op-erator, returns all partitions of a set which are complementary to

a specified partition, where two partitions are said complemen-tary if they are not both sub-partitions of any partition other thanthe full set. For example, the partitions of the set {a,b,c,d}whichare complementary to the partition [{a,b}, {c,d}] are given by:

In[1]:= Cum[PE[PE[a,b],PE[c,d]]]/.F->’’Out[1]= [{a, b, c, d}] + [{a}, {b, c, d}]

+ [{a, c}, {b, d}] +> [{a, d}, {b, c}] + [{a, b, c}, {d}]

+ [{a, b, d}, {c}] +> [{a, c, d}, {b}] + [{a}, {b, c}, {d}]

+ [{a}, {b, d}, {c}] +> [{a, c},{b},{d}] + [{a, d}, {b}, {c}]

If the set elements are the two way table of indices indi-cated in Theorem one, then CSP generates the subsets of in-dices v1, . . . , vp over which the sum is taken in (1). Wherea= X11, b= X12, c= X21, d = X22, it follows for this examplethat the joint cumulant of X11 X12 and X21 X22 can be written as

Cum(X11, X12, X21, X22)+ Cum(X11)Cum(X12, X21, X22)

+Cum(X11, X21)Cum(X12, X22)

+Cum(X11, X22)Cum(X12, X21)

+Cum(X11, X12, X21)Cum(X22)

+Cum(X11, X12, X22)Cum(X21)

+Cum(X11, X21, X22)Cum(X12)

+Cum(X11)Cum(X12, X21)Cum(X22)

+Cum(X11)Cum(X12, X22)Cum(X21)

+Cum(X11, X21)Cum(X12)Cum(X22)

+Cum(X11, X22)Cum(X12)Cum(X21)

4.2. Covariance of the smoothed periodogramat frequencies 2πs/T and 2πt/T

In this example we are interested in calculating the covariancebetween smoothed periodogram ordinates

∑T−1s=1 A(s)d(s)d(−s)

at two Fourier frequencies. To better illustrate steps 1 and 3, wewill work through them manually prior to executing the functionKf.

Step 1: Use property 1 to reduce the covariance to a jointcumulant. Then apply properties 1 and 2 which imply

cum

{T−1∑s=1

A(s)d(s)d(−s),T−1∑t=1

B(t)d(t)d(−t)

}

=T−1∑s=1

T−1∑t=1

A(s)B(t)cum{d(s)d(−s), d(t)d(−t)}

Step 2: Use Theorem 1 to expand the cumulant on the righthand side of the above expression in terms of joint cumulants of

Page 4: Symbolic cumulant calculations for frequency domain time series

78 Smith and Field

discrete Fourier transforms.

cum{d(s)d(−s), d(t)d(−t)} =cum{d(s), d(−s), d(t), d(−t)} +cum{d(s)}cum{d(−s), d(t), d(−t)} +

three similar terms +cum{d(s), d(t)}cum{d(−s), d(−t)} +cum{d(s), d(−t)}cum{d(−s), d(t)}

Step 3: Use Theorem 2 to rewrite joint cumulants of discreteFourier transforms in terms of cumulant spectra.

cum{d(s), d(−s), d(t), d(−t)}= 2πT f (s,−s, t,−t)+ O(1)

cum{d(−s), d(t), d(−t)}= 2πT f (−s, t,−t)1(T )(−2πs/T )+ O(1)

cum{d(s), d(t)}= 2πT f (s, t)1(T )(−2π (s + t)/T )+ O(1)

cum{d(s)}= 2πT f (s)1(T )(−2πs/T )+ O(1)

The final step in simplification entails restricting the indices ofsummation according to the linear constraints imposed by theterms1(T )(λ). For example, from Theorem 2 cum{d(s), d(t)} =2πT f (s,−s) + O(1) when s + t = 0 (mod T ), and is O(1)otherwise. Similarly cum{d(−s), d(−t)} = 2πT f (s,−s) when−s − t = 0 (mod T ), and is O(1) otherwise. Thus in step 2 theterm cum{d(s), d(t)} cum{d(−s), d(−t)} leads to the system ofequations

s + t = 0 (mod T )

−s − t = 0 (mod T )

As will typically be the case, there are more variables thanequations in the system. The solution is t = K T − s for K anyinteger. As f is 2π periodic in each of its arguments, this meansthat

cum{d(s), d(t)}cum{d(−s), d(−t)} = [2πT f (s,−s)]2 + O(1)

when s + t = T , and is otherwise O(1).Steps 1, 2 and 3 have been combined in the Mathematica

function Kf listed in the Appendix. Kf is essentially a cumulantfilter which operates on the output of Cum, the complementaryset partition function of Andrews and Stafford. Other functionswhich are required are drop0s which is a preliminary filter thateliminates terms for which the system of equations sets oneor more indices equal to an integer multiple of T , sEq whichgenerates and solves the systems of equations, and reArrange,which incorporates the constants of Theorem 2.

Summation notation is used, whereby the presense of any in-dex indicates summation over the associated variable. Fourierfrequencies such as 2πs/T are denoted by s, and products of

discrete Fourier transforms, such as d(s)d(−s) are replaced bythe notation d[“s”,“−s”]. The example is carried out in Mathe-matica as

In[1]:= Kf[{A[s] d["s","-s"],B[t] d["t","-t"]}]

with output

2 2Out[1]= 4 Pi T A[KT - t] B[t] f[KT - t, t]

f[-KT + t, -t] +

2 2> 4 Pi T A[-KT + t] B[t] f[KT - t, t]

f[-KT + t, -t] +

3> 8 Pi T A[s] B[t] f[s, -s, t, -t]

which agrees with (5.10.13) of Brillinger (1981).

4.3. Problems with asymmetry

Apart from the unspecified constants A and B, Example 1 issymmetric in its indices s and t . In cases where this symmetryis lacking, care needs to be taken in terms of identifying whichvariables are to be solved for. Where MT = o(T ), consider thefollowing expression of the type occurring in V̂ (A).

T−1∑t=1

T−1∑s=t

k=MT∑k=−MT ,k 6=0

A cum{d(s), d(t − k)}

=T−1∑t=1

T−1∑s=t

k=MT∑k=−MT ,k 6=0

A (2πT f [s, t − k]1(T )

× (2π (s + t − k)/T )+ O(1))

This problem is asymmetric in s, t and k. In particular s and ttake values on {1, . . . , T − 1}, while k ∈ {±1, . . . ,±MT }. Thesystem of equations to be solved is s+t−k = 0 (mod T ) and thenumber of points (s, t, k) with nonzero summand is O(T MT ).The function sEq has been written in such a way that if theglobal variable vars has been set prior to execution, then theresulting system is solved with respect to vars. Otherwise, allvariables in the system are candidates, and Mathematica choosesthe variables for solution on the basis of the dimension of thesystem and lexicographic ordering of variable names.

The form of the output solution depends on which variablehas been solved for.

In[2]:= vars={s};Kf[{A d["s","t-k"]}]Out[2]= 2 A Pi T f[k + KT - t, -k + t]

In[3]:= vars={t};Kf[{A d["s","t-k"]}]Out[3]= 2 A Pi T 1[{k}] f[s, KT - s]

In[4]:= vars={k};Kf[{A d["s","t-k"]}]Out[4]= 2 A Pi T 1[{t}] f[s, KT - s]

Page 5: Symbolic cumulant calculations for frequency domain time series

Symbolic cumulant calculations 79

In two instances sEq has included the identity function 1(·)which is a placeholder and indicates that summation shouldalso be over the arguments of that function. Taking account ofthe ranges of the indices s, t and k, it follows from the as-sumption of Theorem 2 that Out[2] and Out[3] both have orderO(T 2 MT ). As written, it appears that Out[4] = O(T 3). How-ever, the solution k = s+ t − K T must still be compatible withk ∈ {±1, . . . ,±MT }, and so Out[4] is again O(T 2 MT ).

The general algorithm is valid regardless of the symmetry orasymmetry of the problem. However, this example does pointout that care must be taken in step 3 depending on the planneduse of the output. In particular the order of the solution must becorrectly specified.

4.4. Consistency of V̂(A)

In this example we will show the consistency of V̂ (A) as anestimator of V [J (T )(A)], which is the asymptotic variance ofJ (T )(A) set down as (5.10.13) of Brillinger (1981). We first con-sider the mean.

In[5] := vars={s,t,s2,t2};Kf[{A[s,t,k]d["s","k-s","-t","t-k"]}]

2 2Out[5]=4 Pi T A[k+KT-t,t,k]f[k+KT-t,-k+t]

f[-KT+t,-t] +

2 24 Pi T A[-KT+t,t,k]f[k+KT-t,-k+t]f[-KT+t,-t]+

38 Pi T A[s,t,k]f[s,k-s,-t,-k+t]

If MT = o(T ) and A is continuous then

1

2MT

k=MT∑k=−MT ,k 6=0

A

(2π (k − t + T )

T

)

× f

(2π (t − k)

T,−2π (t − k)

T

)is an average of a continuous function over an arbitrarily smallneighbourhood as T→∞. It follows that

TE [V̂ (A)] = T V[J (T )(A)

]+ O

(MT

T

)where V [J (T )(A)] is given by (5.10.13) of Brillinger, or byOut[5] above.

To assert the consistency of V̂ (C), it remains to show thatT 2V[V̂ (A)] = o(1). Because of the asymmetry of the indices inthis example, we will proceed in stepwise fashion rather than byapplying Kf directly.

Steps 1 and 2—expand cumulant

In[6]:= out=eCd[{a d["s","k-s","-t","t-k"],b d["-s2","s2-k2","t2","k2-t2"]}]

The output of this step has 3915 terms.

Step 3: The goal of the present analysis is to get the asymp-totic order of the covariance term. As such, the asymmetryof the indices is important in that k and k2 both take valuesin {±1, . . . ,±MT } while the other subscripts take values in{1, . . . , T − 1}. To easily assess the order of the output expres-sion, we therefore solve the constraint equations first in terms of{s, t, s2, t2}, and then again with respect to {k, k2}.In[7]:= vars={s,t,s2,t2};In[8]:= out2=Map[fCd,out][[1]]In[9]:= vars={k,k2}In[10]:= out3=Map[fCd,out2][[1]]\vspace*{-2pt}

We now re-write the joint cumulants according to Theorem 2,and rearrange.

In[11]:= out4=Map[reArrange,out3]

The result has 184 terms, each of which is a function of T andMT . The function orderTM is now used to determine the orderof the overall expression, which we find to be T 6 MT .

In[12]:= Map[orderTM,out4]

2 5 6Out[12]= 173 M T + 11 M T

It follows that

V[JT (A)] = O[MT−1T−2]

or T 2V[V̂ (A)] = O(MT−1), leading to the consistency of V̂ (A).

Further insight is obtained by more careful examination ofthe eleven terms of order MT T 6, which are listed in AppendixB. It follows from the periodicity properties of polyspectra thatthese eleven terms fall into three distinct classes. One class hastwo terms each containing a product of two fourth order spec-tra, a second class has four terms each containing a productof four second order spectra,and a third has five terms eachwith a product of two second order spectra and a fourth orderspectrum.

Nine of the eleven terms in Appendix B are sums of two ormore underlying parts. In particular, recalling from (2) that thek’th order spectrum carries a coefficient 2k−1, it follows that ofthe 3915 terms from step 2, there are exactly 18 which are oforder MT T 6. Two of these correspond to products of two fourthorder cumulants. They are

cum{d(s), d(k − s), d(−s2), d(s2− k2)}× cum{d(−t), d(t − k), d(t2), d(k2− t2)}

and the symmetric term with t2 and s2 interchanged. Each im-poses the single constraint k2 = k. Eight terms in the overallexpansion result in non-negligible products of four second orderspectra. One is

cum{d(s), d(−s2)}cum{d(k − s), d(s2− k2)}×cum{d(−t), d(t2)}cum{d(t − k), d(k2− t2)}

Page 6: Symbolic cumulant calculations for frequency domain time series

80 Smith and Field

which imposes constraints on s − s2, k − k2 and t − t2. Thereare seven similar terms of equal magnitude which impose twoconstraints on {s, t, s2, t2} and one constraint on {k, k2}. Theeight different terms correspond to pairing s with−s2 or s2−k2,and −t with t2 or k2 − t2, and invariance when s2 and t2 areinterchanged. In an analogous manner there are 8 non-negligibleterms resulting in a product of two second order spectra and afourth order spectrum. One is

cum{d(s), d(−s2)}cum{d(k − s), d(s2− k2)}×cum{d(−t), d(t2), d(t − k), d(k2− t2)}

which imposes constraints on s−s2 and k−k2. The eight termsresult from pairing of s1 with −s2 or s2 − k2 (and simulta-neously pairing k1 − s1 with s2 − k2 or −s2), a similar set ofpairings associated with the indices {−t, t2, t − k, k2− t2}, andinvariance when s2 and t2 are interchanged.

5. Discussion

An algorithm for evaluating joint cumulants of products of dis-crete Fourier transforms at Fourier frequencies has been setdown. The steps of the algorithm are well known, and our prin-ciple contribution has been to implement this the procedure in acomputer algebra system.

We have used Mathematica functions to carry out a compli-cated cumulant calculation involving the asymptotic order ofthe variance of an estimator V̂ (A) of the asymptotic variance ofthe smoothed periodogram. In the nonlinear case it is difficultto find plug-in style estimates of the asymptotic variance whichcapture the nonlinear structure, and it is important to have con-sistent estimates which are easily calculated. Our computationsin Mathematica have allowed us to assert the consistency ofV̂ (A), and while we had claimed this previously in Smith andField (1993), we are only now fully confident of our calculations

Appendices

A. Mathematica functions

Cum[expr_]:=Map[Flatten,Map[# /. (PE->List)&,Map[(-1)^(Length[#]-1)*(Length[#]-1)!*#&,Map[Distribute,Map[FP,Map[Flatten,FP[expr],{-3}],{-2}],{-5}]],{-2}],{-4}] /. PE->F

F[x__]:=H[ToExpression[List[x]]]

InverseFunction[Mod,1,2][0,T]:=KT

drop0s:=H[x_]:>Which[Min[Map[Length,x,2]]==1,0,MemberQ[(Variables[x]/.Solve[Mod[Apply[Plus, x, 1],T] == 0,Variables[x]])[[1]]/.KT->0, 0],0,True,G[x]]

after having implemented them within Mathematica. In partic-ular, the eight highest order terms containing products of twosecond order spectra and a fourth order spectrum were incor-rectly identified as being of lower order in Smith and Field. Thatthey were correctly identified here indicates the usefulness of acomputer algebra system to facilitate such calculations.

Step two of our algorithm expands cumulants of productsin terms of joint cumulants and is implemented with the CSPfunction of Andrews and Stafford (1997). This step is completelygeneral, and has nothing to do with Fourier transforms. Thetheory on which it is based originates with Leonof and Shiryaev(1959).

Step three is a simplification, and is based on a fundamentalTheorem of Brillinger and Rosenblatt (1969) concerning jointcumulants of Fourier transforms. The algorithmically interestingpart of step three involves the solution of an underdeterminedsystem of equations modulo T , which leads to constraints onindices of summation.

One could generalise the scope of problems addressed by re-placing the sum in (3) by an integral over continuous frequencyω. The algorithm would be unchanged except that in the contin-uous case1(T )(ω) behaves similarly to a period 2π extension ofthe Dirac δ function, and the solution of systems modulo T mustbe replaced by an appropriate approximation. In the appendixto Brillinger (1981) there are extensions of time series resultsto spatial data, point processes, and Schwartz distributions inwhich analogues of Theorem 2 are set down. In each case theonly changes required are to step three of our algorithm. A fur-ther problem of interest is the use of a computer algebra systemto prove results such as Theorem 2. While we have not addressedthese extensions, we believe that they are tractable within currentcomputer algebra systems.

The functions and examples in this paper are included in aMathematica notebook available at www.mscs.dal.ca/∼bsmith/fcum.nb.

Page 7: Symbolic cumulant calculations for frequency domain time series

Symbolic cumulant calculations 81

reArrange[G[x_] y__:1]:=Expand[Apply[Times,Map[G,x]]*y]/.G[List[z__]]:>T f[z] (2 Pi)^(Length[List[z]]-1)

sEq[G[x_] y__:1,vars_]:= Module[{vIn,soluTion,vSubst,ouT,vOut},vIn=Variables[x];soluTion=Solve[Mod[Apply[Plus, x, 1],T] == 0,vars];vSubst=Map[First,soluTion[[1]]];ouT=G[x] y/.soluTion; vOut=Variables[ouT/.

{G->List,V->List,W->List}];H[Complement[vIn,vOut,vSubst]] ouT /.{H[{}]->1,H[z_]->1[z]} ]

fCd[x_]:=Module[{lvars},lvars=If[ValueQ[vars],vars,Variables[DeleteCases[x,Z[y__]]/.

G->List]];sEq[x,lvars]]

eCd[x_]:=Expand[Times[ZZZ[Apply[Times,Map[First,x]]] ,Cum[Map[Rest,x]/.{d->PE,List->PE} ]]]/.drop0s

Kf[x_]:=Module[{temp},temp=eCd[x];If[SameQ[Head[temp],Times],reArrange[fCd[temp][[1]]],

Map[reArrange,First[Map[fCd,eCd[x]]]]]/.ZZZ[y__]->y]

orderTM[x_] := T^Length[Intersection[Variables[x /.

{a -> List, b -> List, Times -> List, f -> List, V -> List,H -> List}], {s, t, s2, t2}]]*

M^Length[Intersection[Variables[x /.{Times -> List, a -> List, b -> List, f -> List, V -> List,H -> List}], {k, k2}]]*T^Exponent[x, T]

B. The O(MT T 6) components of out4

32*Pi^4*T^4*f[2*KT - k2 - s, -KT + k2 + s]*f[s, KT - s]*f[KT + k2 - s2, -k2 + s2]*f[-3*KT + s2, -s2] +

32*Pi^4*T^4*f[2*KT - k2 - s, -KT + k2 + s]*f[s, KT - s]*f[-3*KT + k2 - s2, -k2 + s2]*f[KT + s2, -s2] +

32*Pi^4*T^4*f[-2*KT + k2 - s, 3*KT - k2 + s]*f[s, -3*KT - s]*f[-t, KT + t]*f[2*KT - k2 + t, -KT + k2 - t] +

32*Pi^4*T^4*f[-2*KT + k2 - s, -KT - k2 + s]*f[s, KT - s]*f[-t, KT + t]*f[2*KT - k2 + t, -KT + k2 - t] +

32*Pi^5*T^3*f[KT + k2 - s2, -k2 + s2]*f[-2*KT + s2, -s2]*f[s, KT - k2 - s, t2, k2 - t2] +

32*Pi^5*T^3*f[-2*KT + k2 - s2, -k2 + s2]*f[KT + s2, -s2]*f[s, KT - k2 - s, t2, k2 - t2] +

64*Pi^5*T^3*f[KT - t2, t2]*f[KT - k2 + t2, k2 - t2]*f[s, -2*KT + k2 - s, -s2, -k2 + s2] +

Page 8: Symbolic cumulant calculations for frequency domain time series

82 Smith and Field

64*Pi^5*T^3*f[KT + k2 - s2, -k2 + s2]*f[-2*KT + s2, -s2]*f[-t, KT - k2 + t, t2, k2 - t2] +

64*Pi^5*T^3*f[KT - t2, t2]*f[KT - k2 + t2, k2 - t2]*f[-t, -2*KT + k2 + t, -s2, -k2 + s2] +

64*Pi^6*T^2*f[s, -KT + k2 - s, -s2, -k2 + s2]*f[-t, KT - k2 + t, t2, k2 - t2] +

64*Pi^6*T^2*f[s, KT - k2 - s, t2, k2 - t2]*f[-t, -KT + k2 + t, -s2, -k2 + s2]

Acknowledgments

The authors were supported by grants from NSERC. We thankJames Stafford for introducing us to Mathematica, and providingus with the CSP operator, and he and two referees for a numberof comments which substantially improved the manuscript.

References

Andrews D.A. and Stafford J. 1993. Tools for the symbolic computationof asymptotic expansions. J. R. Statist. Soc. B 55: 613–627.

McCullagh P. 1987. Tensor Methods in Statistics. Chapman and Hall,London.

Brillinger D.R. and Rosenblatt M. 1967. Computuation and interpreta-tion of k-th order spectra. In Harris B. (Ed.), Spectral Analysis ofTime Series. Wiley, New York, pp. 189–232.

Leonof V.P. and Shiryaev A.N. 1959. On the method of calculation ofsemi-invariants. Theor. Prob. Appl. 4: 319–329.

Smith B. and Field C. 1993. Variance estimation for quadratic statistics.J. Time. Ser. Anal 14: 381–395.

Stafford James E. 1994. Automating the partition of indices. Journal ofComputational and Graphical Statistics 3: 249–259.