Parameter Estimation (Theory)

37
Parameter Estimation (Theory) Al Nosedal University of Toronto April 15, 2019 Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 1 / 37

Transcript of Parameter Estimation (Theory)

Page 1: Parameter Estimation (Theory)

Parameter Estimation (Theory)

Al NosedalUniversity of Toronto

April 15, 2019

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 1 / 37

Page 2: Parameter Estimation (Theory)

METHOD OF MOMENTS

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 2 / 37

Page 3: Parameter Estimation (Theory)

The Method of Moments

The method of moments is frequently one of the easiest. The methodconsists of equating sample moments to corresponding theoreticalmoments and solving the resulting equations to obtain estimates of anyunknown parameters.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 3 / 37

Page 4: Parameter Estimation (Theory)

Example. Autoregressive Models

Consider the AR(2) case. The relationships between the parameters φ1and φ2 and various moments are given by the Yule-Walker equations.

ρ(1) = φ1 + φ2ρ(1)

ρ(2) = φ1ρ(1) + φ2

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 4 / 37

Page 5: Parameter Estimation (Theory)

Example. Autoregressive Models (cont.)

The method of moments replaces ρ(1) by r1 and ρ(2) by r2 to obtain

r1 = φ1 + r1φ2

r2 = φ1r1 + φ2

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 5 / 37

Page 6: Parameter Estimation (Theory)

Example. Autoregressive Models (cont.)

Solving for φ1 and φ2 yields

φ1 =r1(1− r2)

1− r21

φ2 =r2 − r211− r21

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 6 / 37

Page 7: Parameter Estimation (Theory)

Example. ARMA(1,1)

Consider the ARMA(1,1) case.Yt = φYt−1 − θWt−1 + Wt

γ(0) =(1− 2φθ + θ2)σ2W

1− φ2

γ(1) = φγ(0)− θσ2Wγ(2) = φγ(1)

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 7 / 37

Page 8: Parameter Estimation (Theory)

Example. ARMA(1,1) (cont.)

ρ(0) = 1

ρ(1) =(φ− θ)(1− φθ)

1− 2φθ + θ2

ρ(2) = φρ(1)

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 8 / 37

Page 9: Parameter Estimation (Theory)

Example. ARMA(1,1) (cont.)

Replacing ρ(1) by r1, ρ(2) by r2, and solving for φ yields

φ =r2r1

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 9 / 37

Page 10: Parameter Estimation (Theory)

Example. ARMA(1,1) (cont.)

To obtain θ, the following quadratic equation must be solved (and onlythe invertible solution retained)

θ2(r1 − φ) + θ(1− 2r1φ+ φ2) + (r1 − φ) = 0

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 10 / 37

Page 11: Parameter Estimation (Theory)

Estimates of the Noise Variance

The final parameter to be estimated is the noise variance, σ2W . In allcases, we can first estimate the process variance γ(0) = Var(Yt), by thesample variance (s2 = 1

n−1∑n

t=1(Yt − Y )2) and use known relationshipsamong γ(0).

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 11 / 37

Page 12: Parameter Estimation (Theory)

Example. AR(2) process

For an AR(2) process,

γ(0) = φ1γ(1) + φ2γ(2) + σ2W

Dividing by γ(0) and solving for σ2W yields

σ2W = s2[1− φr1 − φ2r2]

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 12 / 37

Page 13: Parameter Estimation (Theory)

LEAST SQUARES ESTIMATION

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 13 / 37

Page 14: Parameter Estimation (Theory)

Autoregressive Models

Consider the first-order case where

Yt − µ = φ(Yt−1 − µ) + Wt

Note that

(Yt − µ)− φ(Yt−1 − µ) = Wt

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 14 / 37

Page 15: Parameter Estimation (Theory)

Since only Y1,Y2, · · · ,Yn are observed, we can only sum from t = 2 tot = n. Let

SC (φ, µ) =n∑

t=2

[(Yt − µ)− φ(Yt−1 − µ)]2

This is usually called the conditional sum-of-squares function.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 15 / 37

Page 16: Parameter Estimation (Theory)

Now, consider the equation ∂SC∂µ = 0

∂SC∂µ

= 2(φ− 1)n∑

t=2

[(Yt − µ)− φ(Yt−1 − µ)] = 0

Solving it for µ yields

µ =1

(n − 1)(1− φ)

[n∑

t=2

Yt − φn∑

t=2

Yt−1

]Now, for large n,

µ ≈ Y

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 16 / 37

Page 17: Parameter Estimation (Theory)

Consider now the minimization of SC (φ, Y ) with respect to φ.

∂SC (φ, Y )

∂φ

n∑t=2

(Yt − Y )(Yt−1 − Y )− φn∑

t=2

(Yt−1 − Y )2 = 0

Solving for φ gives

φ =

∑nt=2(Yt − Y )(Yt−1 − Y )∑n

t=2(Yt−1 − Y )2

Except for one term missing in the denominator, this is the same as r1.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 17 / 37

Page 18: Parameter Estimation (Theory)

Entirely analogous results follow for the general stationary AR(p) case: toan excellent approximation, the conditional least squares estimates of theφ’s are obtained by solving the sample Yule-Walker equations.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 18 / 37

Page 19: Parameter Estimation (Theory)

Moving Average Models

Consider now the least-squares estimation of θ in the MA(1) model

Yt = Wt −Wt−1

Recall that an invertible MA(1) can be expressed as

Yt = Wt − θYt−1 − θ2Yt−2 − θ3Yt−3 − · · ·

an autoregressive model but of infinite order.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 19 / 37

Page 20: Parameter Estimation (Theory)

In this case,

SC (θ) =∑

[Yt + θYt−1 + θ2Yt−2 + θ3Yt−3 + · · · ]2

It is clear from this equation that the least squares problem is nonlinear inthe parameters.We will not be able to minimize SC (θ) by taking a derivative with respectto θ, setting it to zero, and solving. We must resort to techniques ofnumerical optimization.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 20 / 37

Page 21: Parameter Estimation (Theory)

For the simple case of one parameter, we could carry out a grid search overthe invertible range (−1,+1) for θ to find the minimum sum of squares.For more general MA(q) models, a numerical optimization algorithm, suchas Gauss-Newton will be needed.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 21 / 37

Page 22: Parameter Estimation (Theory)

Example. MA(1) simulation

set.seed(19)

# simulating MA(1);

ma1.sim<-arima.sim(list(ma = c( -0.2)),

n = 1000, sd=0.1);

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 22 / 37

Page 23: Parameter Estimation (Theory)

Example. MA(1) time series plot

MA(1), b= −0.2, n=1000

Time

ma1

.sim

0 200 400 600 800 1000

−0.

30.

00.

3

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 23 / 37

Page 24: Parameter Estimation (Theory)

## SC = conditional sum of squares function for MA(1)

SC<-function(y,theta){n<-length(y);

error<-numeric(n);

error[1]<-y[1];

for (i in 2:n){error[i]<-y[i]-theta*error[i-1]

}

SSE<-sum(error^2)

return(SSE)

}

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 24 / 37

Page 25: Parameter Estimation (Theory)

SC.VEC<-function(y,theta){

N<-length(theta);

SSE.VEC<-numeric(N);

for (j in 1:N){

SSE.VEC[j]<-SC(y,theta[j])

}

return(SSE.VEC)

}

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 25 / 37

Page 26: Parameter Estimation (Theory)

## Testing function SC

theta=seq(-1,1, by=0.001)

sc.values=SC.VEC(ma1.sim,theta);

plot(theta,log(sc.values),type="l")

index=seq(1,length(sc.values),by=1);

theta.hat.one=theta[index[sc.values==min(sc.values)]];

theta.hat.one

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 26 / 37

Page 27: Parameter Estimation (Theory)

−1.0 −0.5 0.0 0.5 1.0

24

68

theta

log(

sc.v

alue

s)

## [1] -0.228

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 27 / 37

Page 28: Parameter Estimation (Theory)

EXACT LIKELIHOOD FUNCTIONS

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 28 / 37

Page 29: Parameter Estimation (Theory)

To illustrate the derivation of the exact likelihood function for a time seriesmodel, consider the AR(1) process

(1− φB)Yt = Wt

or

Yt = φYt−1 + Wt

where Yt = Yt − µ, |φ| < 1 and the Wt are iid N(0, σ2W ).

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 29 / 37

Page 30: Parameter Estimation (Theory)

Rewriting the process in the moving average representation, we have

Yt =∞∑j=0

φjWt−j

E [Yt ] = 0

V [Yt ] =σ2W

1− φ2

Clearly, Yt will be distributed as N(

0,σ2W

1−φ2

).

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 30 / 37

Page 31: Parameter Estimation (Theory)

To derive the joint pdf of (Y1, Y2, · · · , Yn) and hence the likelihoodfunction for the parameters, we consider

e1 =∞∑j=0

φjW1−j = Y1

W2 = Y2 − φY1

W3 = Y3 − φY2

...

Wn = Yn − φYn−1

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 31 / 37

Page 32: Parameter Estimation (Theory)

Note that e1 follows the Normal distribution N(

0,σ2W

1−φ2

).

Wt , for 2 ≤ t ≤ n, follows the Normal distribution N(0, σ2W ) and they areall independent of one another. Hence, the joint probability density of(e1,W2,W3, · · · ,Wn) is

[1− φ2

2πσ2W

]1/2exp

[−e21(1− φ2)

2σ2W

]×[

1

2πσ2W

](n−1)/2exp

[− 1

2σ2W

n∑t=2

W 2t

]

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 32 / 37

Page 33: Parameter Estimation (Theory)

Now consider the following transformation

Y1 = e1

Y2 = φY1 + W2

Y3 = φY2 + W3

...

Yn = φYn−1 + Wn

(Note that the Jacobian of this transformation and its inverse is one).

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 33 / 37

Page 34: Parameter Estimation (Theory)

It follows that the joint probability density of (Y1, Y2, Y3, · · · , Yn) is[1−φ22πσ2

W

]1/2exp

[− Y 2

1 (1−φ2)2σ2

W

]×[

12πσ2

W

](n−1)/2exp

[− 1

2σ2W

∑nt=2(Yt − φYt−1)2

]

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 34 / 37

Page 35: Parameter Estimation (Theory)

Hence for a given series (Y1, Y2, Y3, · · · , Yn) we have the following exactlog-likelihood function:

λ(φ, µ, σ2W ) = −n

2ln(2π) +

1

2ln(1− φ2)− n

2lnσ2W −

S(φ, µ)

2σ2W

whereS(φ, µ) = (Y1 − µ)2(1− φ2) +

∑nt=2[(Yt − µ)− φ(Yt−1 − µ)]2 =

(Y1 − µ)2(1− φ2) + SC (φ, µ)

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 35 / 37

Page 36: Parameter Estimation (Theory)

For given values of φ and µ, λ(φ, µ, σ2W ) can be maximized analyticallywith respect to σ2W in terms of yet to be determined estimators of φ and µ.

σ2W =S(φ, µ)

n

(Just find ∂λ∂σ2 , set it equal to zero, and solve for σ2W .)

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 36 / 37

Page 37: Parameter Estimation (Theory)

Summary

Starting with the most precise method and continuing in decreasing orderof precision, we can summarize the various methods of estimating anAR(1) model as follows:

1 Exact likelihood method. Find parameters φ, µ such that λ(φ, µ, σ2W )is maximized. This is usually nonlinear and requires numericalroutines.

2 Unconditional least squares. Find parameters such that S(φ, µ) isminimized. Again, nonlinearity dictates the use of numerical routines.

3 Conditional least squares. Find φ such that SC (φ, µ) is minimized.This is the simplest case since φ can be solved analytically.

Al Nosedal University of Toronto Parameter Estimation (Theory) April 15, 2019 37 / 37