Chapter 6

Stationary stochastic processes

Maria Sandsten

Lecture 8

September 24 2019

1 / 32 Chapter 6 Yesterday news: Filtering of stationary processes

From the continuous time stationary input process, X (t), t ∈ R the stationary output process, Y (t), t ∈ R, is given as Z ∞ Z ∞ Y (t) = h(t − u)X (u)du = h(u)X (t − u)du. −∞ −∞ For a causal filter h(t) = 0, for t < 0. A stationary Gaussian process is filtered to a stationary .

h(t) = R H(f )ei2πft df H(f ) = R h(t)e−i2πft dt R mY = mX h(u)du mY = mX H(0)

RR 2 rY (τ) = h(u)h(v)rX (τ + u − v)du dv RY (f ) = |H(f )| RX (f )

2 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Schedule for today

I Continuation chapter 6.2: Discrete time filters. Example

I Chapter 6.3.2: Differentiation - expected value and of the derivative. Example

I Spectral density relations for the derivative. Example.

I Chapter 6.5: Cross-covariance

I Cross-covariance including derivatives. Example.

I Chapters 6.5 and 9.5.4: Cross-spectrum and coherence spectrum. Estimation.

3 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Filtering of discrete time processes

Definition 6.1: The output process Yt , t = 0, ±1, ±2 ..., is obtained from the input Xt , t = 0, ±1, ±2 ..., through ∞ ∞ X X Yt = h(t − u)Xu = h(u)Xt−u, u=−∞ u=−∞ where h(t) is the impulse response.

Definition 6.2: The frequency function H(f ) of the discrete time impulse response is defined as ∞ X H(f ) = h(t)e−i2πft , t=−∞ with the inverse transform as Z 1/2 h(t) = H(f )ei2πft df . −1/2

4 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Relations

Mean value: ∞ X mY = mX h(u) = mX H(0). u=−∞ Covariance function:

∞ ∞ X X rY (τ) = h(u)h(v)rX (τ + u − v). u=−∞ v=−∞

Spectral density: 2 RY (f ) = |H(f )| RX (f ).

5 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Example

A discrete time filter is defined as

h(0) = 1/2, h(2) = 1/2,

and zero for all other values. The input process, Xt , t = 0, ±1, ±2 ... is a zero-mean with covariance function

rX (0) = 1, rX (±1) = −1/2.

Calculate the spectral density and the covariance function of the output process.

6 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Solution 1

The spectral density of Xt is

X −i2πf τ RX (f ) = rX (τ)e = 1 − cos(2πf ). τ The frequency function is

X 1 1 H(f ) = h(u)e−i2πfu = + e−i2πf 2. 2 2 u

The spectral density of the output process Yt is 1 1 R (f ) = |H(f )|2R (f ) = ( + cos(4πf )) · (1 − cos(2πf )) = Y X 2 2 1 3 1 1 ... = − cos(2πf ) + cos(4πf ) − cos(6πf ). 2 4 2 4

7 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Solution 2

The covariance function for Yt is X X rY (τ) = h(u)h(v)rX (τ + u − v) = u v 1 (2r (τ) + r (τ + 2) + r (τ − 2)), 4 X X X 1 3 1 1 with rY (0) = 2 , rY (1) = − 8 , rY (2) = 4 , rY (3) = − 8 and rY (τ) = 0 for τ > 3. Symmetry gives rY (−τ) = rY (τ). Check that rY (0) is positive and has the largest value! The spectral density is given as

3 X −i2πf τ RY (f ) = rY (τ)e = τ=−3 1 3 1 1 = − cos(2πf ) + cos(4πf ) − cos(6πf ). 2 4 2 4

8 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Differentiation

To solve a linear stochastic differential equation (SDE), with Y (t) and X (t), t ∈ R, e.g.,

00 0 Y (t) + a1Y (t) + a0Y (t) = X (t),

we need some knowledge of derivatives and integrals of stochastic processes. (For the interested reader, see chapter 8.2.2)

9 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Differentiation

A X (t), t ∈ R, is said to be differentiable (deriverbar) in quadratic mean with the derivative X 0(t) if

X (t + h) − X (t) → X 0(t), h

when h → 0 for all t ∈ R, i.e., if " # X (t + h) − X (t) 2 E − X 0(t) → 0, h

when h → 0.

10 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Differentiation

The derivative X 0(t), t ∈ R, of a weakly stationary process X (t), t ∈ R, is weakly stationary. The derivative X 0(t) of a Gaussian process X (t) is also a Gaussian process.

The expected value of the derivative is

mX 0 = 0,

as X (t + h) − X (t) E[X (t + h)] − E[X (t)] mX 0 = E[ lim ] = lim h→0 h h→0 h m − m = lim X X = 0. h→0 h

11 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Differentiation

The covariance function of the derivative relates to the process covariance as 00 rX 0 (τ) = −rX (τ).

Proof:  X (t + k) − X (t) X (t + τ + h) − X (t + τ) rX 0 (τ) = C lim , lim k→0 k h→0 h 1 r (τ + h − k) − r (τ + h) r (τ − k) − r (τ) = lim lim X X − X X h→0 h k→0 k k 0 0 −rX (τ + h) + rX (τ) 00 = lim = −rX (τ). h→0 h

12 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Example

A Gaussian stationary process X (t), t ∈ R, has covariance function

2 rX (τ) = exp(−τ /2).

Calculate P(X 0(t) > 1).

13 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Solution

The mean value of the differentiated process X 0(t) is always zero, i.e.,

E[X 0(t)] = 0.

The variance is

0 00 −τ 2/2 2 −τ 2/2 V [X (t)] = rX 0 (0) = −rX (0) = e − τ e |τ=0 = 1.

Then follows P(X 0(t) > 1) = 1 − Φ(1) = 0.159.

14 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Differentiation, spectral density

To find the spectral density of X 0(t) we differentiate the definition R i2πf τ rX (τ) = e RX (f ) df twice. We get Z Z 00 i2πf τ 2 i2πf τ rX 0 (τ) = −rX (τ) = e (2πf ) RX (f ) df = e RX 0 (f ) df ,

i.e. the spectral density of X 0(t) is identified

2 RX 0 (f ) = (2πf ) RX (f ).

The spectral density RX 0 (f ) is positive and symmetric as RX (f ) is positive and symmetric. It is also integrable if Z ∞ Z ∞ 2 RX 0 (f )df = (2πf ) RX (f )df < ∞. −∞ −∞

15 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Differentiation, summary

Let X (t), t ∈ R, be a weakly stationary process with covariance function rX (τ). Then the following statements are equivalent:

I X (t) is differentiable in quadratic mean

I rX (τ) is two times differentiable for every τ R ∞ 2 I −∞(2πf ) RX (f )df < ∞

16 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Example

Let X (t), t ∈ R, be a stationary Gaussian process with the spectral density,  1 for |f | ≤ 1, R (f ) = X 0 for all other values. Show that the process, Z ∞ Y (t) = e−uX (t − u)du, 0 is differentiable in quadratic mean and determine V [Y 0(t)].

17 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Solution The impulse response of the filter is h(t) = e−t , t > 0, and frequency function, H(f ) = 1/(1 + i2πf ). We find

1 1 R (f ) = |H(f )|2R (f ) = = for |f | ≤ 1, Y X |1 + i2πf |2 1 + (2πf )2

and Z ∞ Z 1 2 2 1 (2πf ) RY (f )df = (2πf ) 2 df < ∞. −∞ −1 1 + (2πf ) Accordingly, Y (t) is differentiable in quadratic mean. The variance of the derivative is

Z ∞ Z 1 2 0 2 (2πf ) 1 V [Y (t)] = (2πf ) RY (f )df = 2 df = 2− arctan(2π). −∞ −1 1 + (2πf ) π

18 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Back to correlation

19 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Cross-covariance

Definition 6.5: The cross-covariance is defined as

rX ,Y (τ) = C[X (t), Y (t + τ)] = E[X (t)Y (t + τ)] − mX mY .

It is easily shown that

rY ,X (τ) = rX ,Y (−τ),

but in general the cross-covariance is not symmetric, i.e.

rX ,Y (τ) 6= rX ,Y (−τ),

20 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Cross-covariance of derivatives

If X (t), t ∈ R, is differentiable in quadratic mean, then X (t) and X 0(t) have a cross-covariance function,

0 X (t + τ + h) − X (t + τ) r 0 (τ) = C[X (t), X (t + τ)] = C[X (t), ], X ,X h 1 = (C[X (t), X (t + τ + h)] − C[X (t), X (t + τ)]), h 1 = (r (τ + h) − r (τ)) = r 0 (τ), h X X X when h → 0.

We know that rX (τ) = rX (−τ) is a symmetric even function so 0 0 rX (τ) = −rX (−τ) is odd and therefore

0 rX ,X 0 (0) = rX (0) = 0.

(Theorem 6.4: p. 149) 21 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Cross-covariance of derivatives

Note that the cross-covariance function of X 0(t) and X (t), i.e. the shifted order, is

0 0 rX 0,X (τ) = rX ,X 0 (−τ) = rX (−τ) = −rX (τ).

A general formulation of the cross-covariance of derivatives

j (j+k) rX (j),X (k) (τ) = (−1) rX (τ), included in the table of formulas.

22 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Example

The continuous time stationary Gaussian process X (t), t ∈ R, has expected value E[X (t)] = 2 and covariance function

2 rX (τ) = exp(−τ /2).

A new process Y (t), t ∈ R, is created as Y (t) = 5X (t) − 2X 0(t − 1).

Calculate the the expected value, E[Y (t)] and the variance, V [Y (t)].

23 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Solution The expected value is

E[Y (t)] = 5E[X (t)] − 2E[X 0(t − 1)] = 10

The variance is

V [Y (t)] = V [5X (t) − 2X 0(t − 1)] =

25rX (0) + 4rX 0 (0) − 10rX ,X 0 (−1) − 10rX 0,X (1) =

25rX (0) + 4rX 0 (0) − 20rX ,X 0 (−1) = 00 0 25rX (0) + 4(−rX (0)) − 20rX (−1).

The and cross-covariances are given by rX (0) = 1, 0 −1/2 00 rX (−1) = e , rX (0) = −1, and

V [Y (t)] = 25 + 4 − 20e−1/2 ≈ 16.87.

24 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Cross-spectrum

The cross-spectrum, RX ,Y (f ), in continuous time is defined as Z ∞ −i2πf τ RX ,Y (f ) = rX ,Y (τ)e dτ, −∞ and Z ∞ i2πf τ rX ,Y (τ) = RX ,Y (f )e df . −∞ The corresponding formulas in discrete time are:

∞ X −i2πf τ RX ,Y (f ) = rX ,Y (τ)e , τ=−∞ and Z 1/2 i2πf τ rX ,Y (τ) = RX ,Y (f )e df . −1/2 (Theorem 6.6) 25 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Cross-amplitude and phase spectrum

The cross-spectrum is complex valued,

iΦX ,Y (f ) RX ,Y (f ) = AX ,Y (f )e ,

where AX ,Y (f ) = |RX ,Y (f )| is the cross-amplitude spectrum and ΦX ,Y (f ) = arg RX ,Y (f ) is the phase spectrum.

26 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Example The respiratory signal and the heart rate variability signal can be analysed using the cross-spectrum.

a) Respiratory signal b) HRV signal 0.2 0.9

0.1 0.8

0 0.7

−0.1 0.6

−0.2 0.5 0 50 100 150 0 50 100 150 s s

c) Cross amplitude spectrum d) Phase spectrum 0.2 5

4 0.15 3 (f)

(f) 2 0.1 * X,Y * X,Y A Φ 1

0 0.05 −1

0 −2 0 0.1 0.2 0.3 0.4 0 0.1 0.2 0.3 0.4 Hz Hz

27 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Coherence spectrum

The (squared) coherence spectrum is defined as

2 2 |RX ,Y (f )| κX ,Y (f ) = , RX (f )RY (f )

2 and 0 ≤ κX ,Y ≤ 1.

28 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Estimation of coherence spectrum

If we use the periodogram for estimation of the coherence spectrum

2 1 ∗ 1 ∗ |Rbx,y (f )| X (f )Y(f ) · X (f ) Y(f ) κ2 = = n n =?, dx,y 1 ∗ 1 ∗ Rbx (f )Rby (f ) n X (f )X (f ) · n Y(f )Y(f ) where X (f ) and Y(f ) are the discrete Fourier transforms of the two sequences, the resulting estimate is obviously worthless. The solution is to use the Welch method or some multitaper approach!

29 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Example We then find that the respiratory signal and the heart rate variability signal have strong correlation around 0.2 Hz.

Coherence spectrum 1

0.9

0.8

0.7

0.6 *

(f)) 0.5 2 X,Y κ ( 0.4

0.3

0.2

0.1

0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 Hz

30 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Filtering with disturbance

A common model is Z ∞ Y (t) = h(u)X (t − u)du + Z(t), −∞

where X (t), t ∈ R, is the input process and Z(t), t ∈ R, the disturbance process. The processes X (t) and Z(t) are stationary and uncorrelated. We find the cross-covariance, Z ∞ rX ,Y (τ) = h(u)rX (τ − u)du, −∞ and the cross-spectral density

RX ,Y (f ) = H(f )RX (f ).

For derivation of these expressions see Example 7-5.pdf among the lecture notes.

31 / 32 Chapter 6 6.2 6.3.2 6.5 9.5.4 Estimation of frequency function

We then find R (f ) H(f ) = X ,Y , RX (f ) and an estimate of the frequency function is found as

Rbx,y (f ) Hb(f ) = , Rbx (f ) where we should use low variance estimators (the Welch method or some multitaper approach) for Rbx,y (f ) and Rbx (f ) as two estimates are divided.

32 / 32