part 6 - instrumental variable methods

Upload: farideh

Post on 28-Feb-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    1/33

    System IdentificationControl Engineering B.Sc., 3rd yearTechnical University of Cluj-Napoca

    Romania

    Lecturer: Lucian Busoniu

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    2/33

    Analytical development Matlab example Theoretical guarantees

    Part VI

    Instrumental variable methods

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    3/33

    Analytical development Matlab example Theoretical guarantees

    Table of contents

    1 Analytical development

    2 Matlab example

    3 Theoretical guarantees

    We stay in the single-output, single-input case for this lecture.

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    4/33

    Analytical development Matlab example Theoretical guarantees

    Classification

    1 Mental or verbal models

    2 Graphs and tables (nonparametric)3 Mathematical models, with two subtypes:

    First-principles, analytical models

    Models from system identification

    Like prediction error methods, instrumental variable methods produce

    parametric, polynomial models.

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    5/33

    Analytical development Matlab example Theoretical guarantees

    Table of contents

    1 Analytical development

    Starting point: ARX

    Instrumental variables methods

    Comparison: IV versus PEM

    2 Matlab example

    3 Theoretical guarantees

    A l ti l d l t M tl b l Th ti l t

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    6/33

    Analytical development Matlab example Theoretical guarantees

    Setting: discrete time

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    7/33

    Analytical development Matlab example Theoretical guarantees

    Recall ARX model

    A(q1)y(k) =B(q1)u(k) + e(k)

    (1+a1q1 + + anaq

    na)y(k) =

    (b1q1 + + bnbq

    nb)u(k) + e(k)

    In explicit form:

    y(k) + a1y(k 1) + a2y(k 2) +. . .+ anay(k na)

    =b1u(k 1) + b2u(k 2) +. . .+ bnbu(k nb) + e(k)

    where the model parameters are: a1, a2, . . . , anaandb1, b2, . . . , bnb.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    8/33

    Analytical development Matlab example Theoretical guarantees

    Linear regression representation

    y(k) = a1y(k 1) a2y(k 2) . . . anay(k na)

    b1u(k 1) + b2u(k 2) +. . .+ bnbu(k nb) + e(k)

    = y(k 1) y(k na) u(k 1) u(k nb)

    a1 ana b1 bnb

    + e(k)

    =:(k)+ e(k)

    Regressor vector: Rna+nb, previous output and input values.Parameter vector: Rna+nb, polynomial coefficients.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    9/33

    Analytical development Matlab example Theoretical guarantees

    Identification problem and solution

    Given datasetu(k), y(k),k=1, . . . , N, find model parameters toachieve small equation errors(k)in:

    y(k) =(k)+(k)

    Formal objective: minimize the mean squared error:

    V() = 1

    N

    Nk=1

    (k)2

    Solution:can be written in several ways, we use:

    = 1N

    Nk=1

    (k)(k)

    1 1

    N

    Nk=1

    (k)y(k)

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    10/33

    Analytical development Matlab example Theoretical guarantees

    Theoretical guarantee

    Recall that for the guarantees, a true parameter vector0 is assumed

    to exist: y(k) =(k)0+ v(k)

    Analyze the parameter errors (a vector ofnelements):

    0 = 1NN

    k=1

    (k)

    (k)1

    1NN

    k=1

    (k)y(k)

    1

    N

    Nk=1

    (k)(k)

    1 1

    N

    Nk=1

    (k)(k)

    0

    =1

    N

    Nk=1

    (k)(k)1 1

    N

    Nk=1

    (k)[y(k) (k)0]

    = 1

    N

    N

    k=1 (k)(k)

    1

    1

    N

    N

    k=1 (k)v(k)

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    11/33

    y p p g

    Further assumptions

    We wish the algorithm to be consistent: the parameter errors tobecome 0 in the limit of infinite data.

    AsN :

    1

    N

    N

    k=1 (k)(k) E (k)(k)1

    N

    Nk=1

    (k)v(k) E {(k)v(k)}

    For the error to be well-defined and equal to zero, we need:

    E(k)(k)

    invertible.

    E {(k)v(k)}zero.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    12/33

    y p p g

    Table of contents

    1 Analytical development

    Starting point: ARX

    Instrumental variables methods

    Comparison: IV versus PEM

    2 Matlab example

    3 Theoretical guarantees

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    13/33

    Motivation: ARX requires white noise

    We have E {(k)v(k)}= 0 if the elements of (k)areuncorrelated withv(k)(note thatv(k)is assumed zero-mean).

    But(k)includesy(k 1), y(k 2), . . . , which depend onv(k 1), v(k 2), . . . !

    So the only option is to have v(k)uncorrelated withv(k 1), v(k 2), . . . v(k)must bewhite noise.

    Instrumental variablesare a solution to remove this limitation to whitenoise.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    14/33

    Intuition

    0 =

    1

    N

    Nk=1

    (k)(k)

    1 1

    N

    Nk=1

    (k)v(k)

    Idea:What if a different vector than (k)could be included in theparameter errors?

    0 =

    1

    N

    N

    k=1Z(k)(k)

    1 1

    N

    N

    k=1Z(k)v(k)

    where the elements ofZ(k)are uncorrelated withv(k). ThenE {Z(k)v(k)}= 0 and the error can be zero.

    VectorZ(k)has nelements, which are calledinstruments.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    15/33

    Instrumental variable method

    In order to have:

    0 = 1N

    Nk=1

    Z(k)(k)1 1

    N

    Nk=1

    Z(k)v(k)

    (6.1)

    the estimated parameter must be:

    = 1N

    Nk=1

    Z(k)(k)1 1N

    Nk=1

    Z(k)y(k) (6.2)This

    is the solution to the system of nequations:

    1N

    Nk=1

    Z(k)[(k) y(k)]= 0 (6.3)Constructing and solving this system comprises thebasicinstrumental variable (IV) method.

    Exercise: Show that(6.3) implies(6.2), and that (6.2)implies (6.1).

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    16/33

    Simple instruments

    So far the instrumentsZ(k)were not discussed. They are usuallycreated based on the inputs (including outputs would lead tocorrelation withvand so eliminate the advantage of IV).

    Simple possibility:just include additional delayed inputs to obtain avector of the appropriate size,n=na+ nb:

    Z(k) = [u(k nb 1), . . . u(k na nb), u(k 1), . . . , u(k nb)]

    Compare to original vector:

    (k) = [y(k 1), . . . , y(k na), u(k 1), . . . , u(k nb)]

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    17/33

    Generalization

    Pass the input through a transfer function:

    C(q1)x(k) =D(q1)u(k)

    (1+c1q1 + + cnbq

    nc)x(k) =

    (d1q1

    + + dndqnd

    )u(k)x(k) =c1y(k 1) c2y(k 2) . . . cncy(k nc)

    d1u(k 1) + d2u(k 2) +. . .+ dndu(k nd)

    and takenapast values from the outputx:

    Z(k) = [x(k 1), . . . , x(k na), u(k 1), . . . , u(k nb)]

    Remark: C(q1),D(q1)have different meanings than in PEM.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    18/33

    Generalized instruments: obtaining the simple case

    In order to obtain:

    Z(k) = [u(k nb 1), . . . u(k na nb), u(k 1), . . . , u(k nb)]

    setC=1, D=qnb.

    Exercise: Verify the desiredZ(k)is indeed obtained.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    19/33

    Generalized instruments: Initial model

    Generalized instruments:

    Z(k) = [x(k 1), . . . , x(k na), u(k 1), u(k 2), . . . , u(k nb)]

    Compare to original vector:

    (k) = [y(k 1), . . . , y(k na), u(k 1), . . . , u(k nb)]

    Idea:Take instrument generator equal to an initial model,

    C(q1) =

    A(q1),D(q1) =

    B(q1). This model can be obtained e.g.

    with ARX estimation.

    In the ideal case where the model is correct,A(q1) =A(q1),B(q1) =B(q1), we obtain noise-free outputsyat the appropriatepositions inZ(k). Otherwise, we have an approximation ofy:

    Z(k) = [y(k 1), . . . y(k na), u(k 1), . . . , u(k nb)]

    but without the disadvantage of correlation with the noise.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    20/33

    Table of contents

    1 Analytical development

    Starting point: ARX

    Instrumental variables methods

    Comparison: IV versus PEM

    2 Matlab example

    3 Theoretical guarantees

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    21/33

    Comparison

    Both PEM and IV can be seen as extensions of ARX:

    A(q1)y(k) =B(q1)u(k) + e(k)

    to disturbancesv(k)different from white noisee(k).

    PEMexplicitly include the disturbance model in the structure,e.g. in ARMAXv(k) =C(q1)e(k)leading toA(q1)y(k) =B(q1)u(k) + C(q1)e(k).

    IV methodsdo notexplicitly model the disturbance, but are

    designed to be resilient to non-white, colored disturbance (byusing instrumentsZ(k)uncorrelated with it).

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    22/33

    Comparison (continued)

    Advantage of IV: Simple model structure, identification consists ofsimply solving a system of linear equations. In contrast, PEMrequired solving optimization problems with Newtons method,

    susceptible to local minima etc.

    Disadvantage of IV: In practice (for finite numberNof data), modelquality depends heavily the choice of instrumentsZ(k).

    Methods exist to choose instrumentsZ(k)that are optimal in a certain sense,

    but they will not be discussed here.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    23/33

    Table of contents

    1 Analytical development

    2 Matlab example

    3 Theoretical guarantees

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    24/33

    Experimental data

    Separate identification and validation data sets:plot(id); and plot(val);

    From prior knowledge, the system has order 2 and the disturbance iscolored (does not obey the ARX model structure).

    Remarks: As before, the identification input is a pseudo-randombinary signal, and the validation input a sequence of steps.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    25/33

    IV identification with custom instruments

    Define the instruments by the generating transfer function, usingpolynomialsC(q1)and D(q1).

    model = iv(id, [na, nb, nk], C, D);

    Arguments:1 Identification data.

    2 Array containing the orders ofA and Band the delaynk (like forARX).

    3

    PolynomialsCandD, as vectors of coefficients in increasingpower ofq1.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    26/33

    Result with simple instruments

    TakeC(q1) =1, D(q1) =qnb, leading to

    Z(k) = [u(k nb 1), . . . u(k na nb), u(k 1), . . . , u(k nb)]

    .Compare to ARX.

    Conclusions:

    IV models arenot guaranteed to be stable!

    Results very bad with this simple choice.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    27/33

    Result with ARX-model instruments

    TakeC(q1) =A(q1),D(q1) =B(q1)from the ARX experiment,leading to

    Z(k) = [y(k 1), . . . y(k na), u(k 1), . . . , u(k nb)]

    .

    Conclusion:IV obtains better results. This is because the disturbanceis colored, and IV can deal effectively with this case (whereas ARXcannot).

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    28/33

    Result with automatic instruments

    model = iv4(id, [na, nb, nk]);

    Implements an algorithm that generates near-optimal instruments.

    Conclusion:Works slightly better than just ARX instruments.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    29/33

    Table of contents

    1 Analytical development

    2 Matlab example

    3 Theoretical guarantees

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    30/33

    Assumptions

    Assumptions (simplified)

    1 The disturbancev(k) =H(q1)e(k)wheree(k)is zero-meanwhite noise,H(q1)is a transfer function satisfying certainconditions.

    2 The input signalu(k)is sufficiently informative and does notdepend on the disturbance (the experiment is open-loop).

    3 The real system is stable and uniquely representable by themodel chosen: there exists exactly one0 so that polynomialsA(q1; 0)and B(q

    1; 0)are identical to those of the real

    system.4 Matrix E

    Z(k)Z(k)

    is invertible.

    Analytical development Matlab example Theoretical guarantees

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    31/33

    Discussion of assumptions

    Assumption 1 shows the main advantage of IV over PEM: the

    disturbance can be colored.Assumptions 2 and 3 are not very different from those made byPEM. Stability of a discrete-time system requires its poles to bestrictly inside the unit circle:

    Assumption 4 is required to solve the linear system, and given asufficiently informative input boils down to an appropriateselection of instruments (e.g. not repeating the same delayed

    inputu(k i)twice).

    Analytical development Matlab example Theoretical guarantees

    G

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    32/33

    Guarantee

    Theorem 1

    As the number of data points N , the solutionof IV estimationconverges to the true parameter vector 0.Remark:This is aconsistencyguarantee, in the limit of infinitelymany data points.

    Analytical development Matlab example Theoretical guarantees

    P ibl t i

  • 7/25/2019 Part 6 - Instrumental Variable Methods

    33/33

    Possible extensions

    Multiple-input, multiple-output systems.

    Larger-dimension instrumentsZthan parameter vectorswith other modifications, calledextendedIV methods.