Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I am attempting to build a Walsh-Fourier spectral density and it appears that it is first required to compute the logical covariance which in turn involves a dyadic add.

I am not at all familiar with dyadics or their operations and introductory references are hard to come by. In Stoffer (1988) the logical covariance of a categorical series $X(0), X(1),\dots,X(N-1)$ is described as being: \begin{align} \tau(j)=N^{-1} \sum_{j=0}^{N-1} \gamma(j\oplus k-k) \end{align} where $j\oplus k$ is the dyadic addition. $\gamma$, is our usual autocovariance, $\gamma(h)=cov\{X(n), X(n+h)\}$.

The Walsh-Fourier spectral density is then:

\begin{align} f(\lambda)=\sum_{j=0}^{\infty}\tau(j)W(j, \lambda) \end{align}

where $W(j, \lambda)$ is the $j$th sequency (zero-crossings) with $0\leq\lambda < 1$.

I'm sure a HMM would be great for categorical times series but at the moment I am restricted to spectral analysis so I must continue with this approach. It's not exactly homework. It's a final project that has moved a little beyond the coursework. The professor is a little hard to get a hold of and thus the question is posed here.

Is it just addition? I haven't even been able to confirm that.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

After digging about and reading various papers I discovered that the definition is referenced as given in a paper by R.Kohn in 1980, On the Spectral Decomposition of Stationary Time Series Using Walsh Functions. I

In short there are two definitions depending upon whether or not the values being added are integers or reals. Luckily I am only concerned with the integer case which is a little simpler.

Kohn defines the $\oplus$ operation on integers as follows:

Let $m,n$ be integers and $m_j,n_j$ be restricted to 0 or 1, then

\begin{align} m=\sum_{j=0}^fm_j2^j \hspace{2mm} \text{and} \hspace{2mm} n=\sum_{j=0}^fn_j2^j \end{align}

the dyadic sum then is

\begin{align} m\oplus n=\sum_{j=0}^f|m_j-n_j|2^j \end{align}

He gives as an example $5\oplus 3=6$. While $f$ isn't defined it appears to mean the 'useful' domain of the function because

\begin{align} 5=2^0*1+2^1*0+2^2*1+\sum_{j=3}^{\infty}0*2^j\hspace{2mm} \text{and} \hspace{2mm} 3=2^0*1+2^1*1+\sum_{j=2}^{\infty}0*2^j \end{align}


\begin{align} 5\oplus 3=2^0*|1-1|+2^1*|0-1|+2^2*|1-0|+\sum_{j=3}^{\infty}|0-0|*2^j=6 \end{align}

share|improve this answer
so basically XOR –  MAB Nov 22 '12 at 3:22
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.