2.1 Scalar

Say we begin with a series $p_ t$, where $1<=t<=N_ t$ is the sample number, and $N_ t$ is the total number of samples.

Mean

  \begin{equation}  \label{eq:tsbar} \mu =\frac{\displaystyle {\sum _ t}{p_ t}}{N_ t} \end{equation}   (3)

“dat-ts-stats” return the values $\mu _ u=1.0132$ and $\mu _ v=0.51483$. Note that these are different from the correct means ($1.0$ and $1/2$) if the time-series were infinitely long. This illustrates the difference between the sample mean and the real mean.

Variance

  \begin{equation}  \label{eq:tsvar} \sigma ^2=\frac{\displaystyle {\sum _ t}{(p_ t-\mu )^2}}{N_ t} \end{equation}   (4)

The standard deviation is the square root of the variance “dat-ts-stats” return the values $\sigma ^2_ u=1.005$ and $\sigma ^2_ v=0.427$. Note that these numbers change a little bit each time you recalculate them, because the function rand gives a new sequence of numbers each time.

Histogram and probability distribution function

For this we need to set a number of value bins,say $N_{bins}=20$ that covers the rage of expected values of the time series, say $p=-2:0.1:4$ octave, conveniently has the routine hist(u,p)

  \begin{equation}  f(p)=number of observations between p(k) and p(k+\delta k) \end{equation}   (5)

Note that the mean and variances can also be estimates s moments of the pdf:

Auto-covariance & auto-correlation

\includegraphics{figs/autocuv.eps}
Figure 2: Autocorrelation $u$ and $v$
  \begin{equation}  \label{eq:tsautocov} C_{pp}(\tau )=\frac{1}{N_ t-k}\displaystyle {\sum _{t=1}^{N_ t-k}}(p_ t-\mu )(p_{t+k}-\mu ) \end{equation}   (6)

where $\tau =k\Delta t$. The time when $C_ pp$ goes to zero defines a characteristic time-scale for the time-series $p$. The degrees of freedom is often estimates as the length of the time series, $N_ t\Delta t$, divided by this characteristic time scale. The auto correlation is the co-variance normalized by the variance:

  \begin{equation}  \label{eq:tsautocov} R_{pp}(\tau )=\frac{C_{pp}}{\sigma ^2} \end{equation}   (7)

Note that for a single real series such as $u$, $R_{uu}$ is a symmetric function, so that $R_{pp}(-\tau )=R_{pp}(tau)$.

Variance as a function of frequency: Fourier transform, filters, spectra, etc...

In many cases physical systems behave differently on different time series, and it is important to describe the behavior of the observation in each band of periods, or frequencies.

  1. The Fourier transform and fft Fourier transforms are always implemented with the Fast Fourier Transform algorithm, an efficient method of computing the Fourier coefficients. For an infinitely long continuous series, the Fourier transform is defined as

      \begin{equation}  \label{eq:tsft} U(\omega )=\int _{-\infty }^{\infty }u(t)e^{-i\omega t}dt \end{equation}   (8)

    Practically time series ($u(t_ n),1\le t_ n\le N_ t$) are made up of a finite number of discrete samples, and the Fourier transform is evaluated as:

      \begin{equation}  \label{eq:tsfft} U(k)=\displaystyle \sum _{t_ n=1}^{N_ t}u(t_ n)e^{-2\pi i k t_ n/N_ t}\qquad k=1,\cdots ,N_ t \end{equation}   (9)

    Each value of $U$ represents the complex amplitude of the Fourier transform at the frequency $\omega _ k=2\pi k/(N_ t\delta t)$ (in units of radians per second,or $s^{-1}$), where $\delta t$ represents the sampling period. The lowest frequency resolved by the period of observations ($2\pi /(N_ t\delta t)$)corresponds to one full cycle over time $N_ t\delta t$. The Nyquist frequency, half the sampling frequency of the time series ($\omega _ N=\pi /\delta t$), represents the highest frequency that can be unambiguously determined from the observations. This raises the question of the meaning of $U(k>N_ t/2$). A typical fft routine return an output vector of $N_ t$ complex values when called with a similar length series. The order of frequencies is:

    if N is even: WATCH OUT THE FREQUECIES ARE IN CYCLES/TIME, NOT RAD/TIME

      \begin{equation}  0 df=1/(N*dt) ... N/2*df=f_ Nyquist=1/(2*dt) -(N/2-1)*df ... -df \end{equation}   (10)

    if $N_ t$ is odd:

      \begin{equation}  0 df=1/(N*dt) ... (N-1)/2*df=1/(2*dt)-df -(N-1)/2*df ... -df \end{equation}   (11)

    Function fftshift will reorganize the complex amplitudes in ascending order, from negative to positive frequencies. For example the real and imaginary parts of fftshift(fft(u)) are illustrated below:

    \includegraphics{figs/fftshiftu.eps}
    Figure 3: Fourier coefficients of $u$. Imaginary coefficients have been offset by -500

    If $N_ t$ is even, the mean value of the time series is in $U(N_ t/2+1)$,visible s the blue peak that extends to $1024$ at the middleofthe real spectrum. There are four otherpeaks in each of the other spectra. They are located at $\pm \pi /5$ and $\pm \pi /20$, the two frequencies included in the defintions of $u$.

    The inverse transform is:

      \begin{equation}  \label{eq:itsfft} u(t_ n)=\frac{1}{N_ t}\displaystyle \sum _{k=1}^{N_ t}U(k)e^{2\pi i k t_ n/N_ t} \end{equation}   (12)

    It is important to understand that in the above relations, both $u$ and $U$ can be complex series. If the fourier coefficients are known

  2. Filters: If interest is focused on a particular band of frequecies, the fft-ifft sequence can be used to produce a filtered version of the series. The cyan time series illustrated in Fig. 4...

    \includegraphics{figs/crude_filter.eps}
    Figure 4: Filtered version of $u$ produced by setting several values of $U$ equal to zero before calling ifft(U)
  3. The spectrum shows the distribution of the variance as a function of frequency, $\omega $. It can be estimated in several ways. One simple way is to define it as the Fourier transform of the auto-correlation function:

    \includegraphics{figs/specuv.eps}
    Figure 5: Spectra of $u$ and $v$
      \begin{equation}  \label{eq:tspectrum} S_ p(\omega )=\int _{-\infty }^{\infty } R(\tau )e^{-2\pi i \omega \tau } d\tau \end{equation}   (13)

    Note that $S_ p$ is also a symmetric function of $\omega $.

  4. Windows

  5. Ensemble and band averging