• No results found

Time Series Analysis

N/A
N/A
Protected

Academic year: 2021

Share "Time Series Analysis"

Copied!
22
0
0

Loading.... (view fulltext now)

Full text

(1)

Time Series Analysis

Henrik Madsen

[email protected]

Informatics and Mathematical Modelling Technical University of Denmark

(2)

Outline of the lecture

Recursive and adaptive estimation: Introduction to Chapter 11

Recursive LS, Section 11.1 Cursory material:

(3)

Why recursive and adaptive estimation?

0 2000 4000 6000 8000 500 1500 2500 Heat Consumption (GJ/h) 0 2000 4000 6000 8000 30 20 10 0 −10 Temperature (°C)

As time passes we get more information Models are approximations

The best approximation change over time

Makes it possible to produce software which learns as new data becomes available

(4)

Types of models considered

REG: Yt = µ + β1U1,t + β2U2,t + . . . + βmUm,t + εt FIR: Yt = µ + ω(B)Ut + εt = µ + ω0Ut + ω1Ut−1 + +. . . ωsUt−s + εt AR: φ(B)Yt = µ + εt ⇔ Yt = µ − φ1Yt−1 − φ2Yt−2 − . . . − φpYt−p + εt ARX: φ(B)Yt = µ + ω(B)Ut + εt ⇔ Yt = µ − φ1Yt−1 − . . . − φpYt−p + ω0Ut + . . . + ωsUt−s + εt
(5)

Generic form of the models considered

Yt = xTt θ + εt = θ1x1,t + θ2x2,t + . . . + θxℓ,t + εt Example: Yt = µ · |{z}1 x1,t + φ2 · (−Yt−2) | {z } x2,t + ω1 · Ut−1 |{z} x3,t + εt
(6)

LS-estimate at time

t

Model:

Yt = xTt θ + εt

Data (x may contain lagged values of the “real” input):

Y1, Y2, Y3, Y4, . . . , Yt−1, Yt

x1, x2, x4, x4, . . . ,xt1, xt

LS-estimate based on t observations:

b θt = arg min θ St( θ) St) = t X s=1 (Ys − xT s θ) 2

(7)

LS-estimate at time

t

Model:

Yt = xTt θ + εt

Data (x may contain lagged values of the “real” input):

Y1, Y2, Y3, Y4, . . . , Yt−1, Yt

x1, x2, x4, x4, . . . ,xt1, xt

LS-estimate based on t observations:

b θt = arg min θ St( θ) = (XTX)−1 XT Y St) = t X s=1 (Ys − xT s θ) 2

(8)

From one time step to the next (in an easy way)

The trick is to realize that:

Rt = XT X = x1xT1 + x2xT2 + . . . + xtxT t = t X s=1 xsxT s ht = XTY = x1Y1 + x2Y2 + . . . + xtYt = t X s=1 xsYs Where: xtxT t =      x1,tx1,t x1,tx2,t · · · x1,txℓ,t x2,tx1,t x2,tx2,t · · · x2,txℓ,t .. . ... . .. ... xℓ,tx1,t xℓ,tx2,t · · · xℓ,txℓ,t      xtYt =      x1,tYt x2,tYt .. . xℓ,tYt     

(9)

From one time step to the next (cont’nd)

b θt = R−1 t ht Rt = t X s=1 xsxt s = xtxTt + t−1 X s=1 xsxT s = xtxTt + Rt−1 ht = t X s=1 xsYs = xtYt + t−1 X s=1 xsYs = xtYt + ht1 Initialization: R0 = 0 (matrix of zeros) h0 = 0 (vector of zeros)
(10)

Other formulations

1. Eliminating ht: Rt = xtxT t + Rt−1 b θt = θbt1 + R−1 t xt(Yt − x T t θbt−1)

2. Eliminating ht and avoiding matrix-inversion:

Kt = Pt−1xt 1 + xT t Pt−1xt b θt = θbt1 + Kt(Yt xT t θbt−1) Pt = Pt1 Pt−1xtx T t Pt−1 1 + xT t Pt−1xt

(11)

Example:

HC

t

=

µ

+

θ

1

T

t

+

ε

t

Hour from start

Temperature 0 2000 4000 6000 8000 −10 0 10 20 30

Hour from start

Consumption

0 2000 4000 6000 8000

500

1500

(12)

Example:

HC

t

=

µ

+

θ

1

T

t

+

ε

t

Hour from start

Intercept

0 2000 4000 6000 8000

0

500

1000

Hour from start

Slope 0 2000 4000 6000 8000 −60 −20 0 20

(13)

Forgetting old observations

So far we have a way of updating the estimates as the data set grows

If we want a method which forgets old observations we apply weights which start at 1 and goes to 0 when observations gets old: b θt = arg min θ St( θ) St(θ) = t X s=1 β(t, s)(Ys − xTs θ) 2

(14)

Forgetting old observations

So far we have a way of updating the estimates as the data set grows

If we want a method which forgets old observations we apply weights which start at 1 and goes to 0 when observations gets old: b θt = arg min θ St( θ) = (XT W X)−1 XTW Y St(θ) = t X s=1 β(t, s)(Ys − xTs θ) 2 where W = diag(β(t,1), β(t,2), . . . , β(t, t 1), 1)

(15)

Exponential decay of weights

Let’s first consider β(t, s) = λt−s

(0 < λ ≤ 1)

λ = 1: What we did with the previous algorithms

λ < 1: We forget in an exponential manner

Observation number

Weight

0 5 10 15 20 25 30

0 1

In the general case it turns out that if the sequence of weights can be written

β(t, s) = λ(t)β(t − 1, s) 1 ≤ st − 1 β(t, t) = 1

(16)

The Adaptive Recursive LS algorithm

Rt = xtxT t + λ(t)Rt−1 ht = xtYt + λ(t)ht1 b θt = R−1 t ht
(17)

Other formulations

1. Eliminating ht: Rt = xtxT t + λ(t)Rt−1 b θt = θbt1 + R−1 t xt(Yt − x T t θbt−1)

2. Eliminating ht and avoiding matrix-inversion:

Kt = Pt−1xt λ(t) + xT t Pt−1xt b θt = θbt1 + Kt(Yt xT t θbt−1) Pt = 1 λ(t) Pt1 Pt−1xtx T t Pt−1 λ(t) + xT t Pt−1xt

(18)

Constant forgetting

If λ(t) = λ we call λ the forgetting factor and define the

memory as T0 = ∞ X i=0 λi = 1 + λ + λ2 + λ3 + λ4 + . . . = 1 1 − λ

Given a data set an optimal value of λ can be found by “trial

and error”

It is often a good idea to select the values of λ to be

investigated so that the corresponding values of T0 are

approximately equidistant

The criteria to evaluate may depend on the application, but the sum of squared one-step prediction errors is often appropriate The initialization period should be excluded from the evaluation

(19)

Variable forgetting

Many methods exists

One is based on the aim of keeping the criteria functions

defining the estimates constant at S0

Leads to: λ(t) = 1 − ε 2 t S0 1 + xT t P t−1xt

A lower bound λmin on λ(t) should be applied

(20)

Example:

HC

t

=

µ

+

θ

1

T

t

+

ε

t

Hour from start

Temperature 0 2000 4000 6000 8000 −10 0 10 20 30

Hour from start

Consumption

0 2000 4000 6000 8000

500

1500

(21)

Example:

HC

t

=

µ

+

θ

1

T

t

+

ε

t

,

λ

= 0

.

995

Hour from start

Intercept

0 2000 4000 6000 8000

0

500

1500

Hour from start

Slope 0 2000 4000 6000 8000 −80 −40 0 20

(22)

Example (cont’nd)

Hour from start

Temperature (blue) 0 2000 4000 6000 8000 −10 0 10 20 30 500 1500 2500 Consumption (red)

Hour from start

Intercept (black) 0 2000 4000 6000 8000 0 500 1500 −80 −40 0 20 Slope (green)

References

Related documents

After successfully supporting the development of the wind power technology, an approach is needed to include the owners of wind turbines in the task of realizing other ways, other

Field experiments were conducted at Ebonyi State University Research Farm during 2009 and 2010 farming seasons to evaluate the effect of intercropping maize with

In the study presented here, we selected three rep- resentative pathogenic PV mAbs cloned from 3 different PV patients: F706, an anti-Dsg3 IgG4 isolated by heterohybridoma, F779,

No studies to our knowledge have examined all three health measures (MVPA, sedentary behavior, components of sleep quality) using accelerometers to 1) compare health behaviors

National Conference on Technical Vocational Education, Training and Skills Development: A Roadmap for Empowerment (Dec. 2008): Ministry of Human Resource Development, Department

4.1 The Select Committee is asked to consider the proposed development of the Customer Service Function, the recommended service delivery option and the investment required8. It

Augmented Reality * is to augment the real world with virtual information. It is the opposite of Virtual Reality that is to create a synthesised environment

Other specific objectives of this study are to: demonstrate high electric current generation in MECs continuously fed with real wastewater by using sandwiched electrode