Lesson 4 – Instrumental Variables
Total Page:16
File Type:pdf, Size:1020Kb
Ph.D. IN ENGINEERING AND Advanced methods for system APPLIED SCIENCES identification Ph.D. course Lesson 4: Instrumental variables TEACHER Mirko Mazzoleni PLACE University of Bergamo Outline 1. Introduction to error-in-variables problems 2. Least Squares revised 3. The instrumental variable method 4. Estimate an ARX model from ARMAX generated data 5. Application study: the VRFT approach for direct data driven control 6. Conclusions 2 /44 Outline 1. Introduction to error-in-variables problems 2. Least Squares revised 3. The instrumental variable method 4. Estimate an ARX model from ARMAX generated data 5. Application study: the VRFT approach for direct data driven control 6. Conclusions 3 /44 Introduction Many different solutions have been presented for system identification of linear dynamic systems from noise-corrupted output measurements On the other hand, estimation of the parameters for linear dynamic systems when also the input is affected by noise is recognized as a more difficult problem Representations where errors or measurement noises are present on both inputs and outputs are usually called Errors-in-Variables (EIV) models In case of static systems, errors-in-variables representations are closely related to other well-known topics such as latent variables models and factor models 4 /44 Introduction Errors-in-variables models can be motivated in several situations: • modeling of the dynamics between the noise-free input and noise-free output. The reason can be to have a better understanding of the underlying relations (e.g. in econometrics), rather than to make a good prediction from noisy data • when the user lacks enough information to classify the available signals into inputs and outputs and prefer to use a “symmetric” system model. This is closely connected to the behavioral approach to modeling • In some settings, especially in non technical areas such as nature, biology, economics, the identification experiment may not be under full “control” of the modeler, so we have to work with observational data and treat confounding variables accordingly 5 /44 Example: data-driven control design Consider the Virtual Reference Feedback Tuning (VRFT) algorithm: • Unknown SISO linear system 퐺 푧 • Family of linear parametric 1-DOF controllers 휷 푧 = 훽 푧 훽 푧 … 훽 푧 푇 푦 푡 = 퐺 푧 푢 푡 + 푦 푡 푅 푧; 휽 = 휷푇 푧 휽 1 2 푛 1 × 푑 푑 × 1 푇 휽 = 휃1 휃2 … 휃푛 • Model reference specification 푦 푡 푀 푧 : Reference model + + Design 푅 푧; 휽 such that 푀 푧 푟ҧ 푡 푢 푡 푦0 푡 + 푦 푡 푅 푧; 휽 퐺 푧 − 퐺 푧 푅 푧; 휽 푀 푧 ≈ 1 + 퐺 푧 푅 푧; 휽 Campi, M. C., Lecchini, A., & Savaresi, S. M. (2002) 6 /44 Example: data-driven control design 푁 1 2 What we can minimize : 퐽푁 휽 = 푢 푡 − 푅 푧; 휽 푒 푡 푉푅 푁 퐿 퐿 푡=1 푀−1 푧 Given a set of I/O measures 푢 푡 , 푦 푡 푡=1,…,푁 Noisy «input» Compute: + 푟푣ҧ 푡 푒푣 푡 푢 푡 푦 푡 −1 • Virtual noisy reference 푟푣ҧ 푡 = 푀 푧 푦 푡 ? 퐺 푧 − • Filtered noisy virtual error 푒퐿 푡 = 퐿 푧 푟푣ҧ 푡 − 푦 푡 • Filtered input 푢퐿 푡 = 퐿 푧 푢 푡 If 푅 푧; 휽 is linear in the parameters, we can estiamate 휽 via Least Squares. However, in this case the noise is on the regressor signal 푒퐿 푡 and not on the output 푢 푡 7 /44 Basic setup We now describe the basic setup for an EIV problem: 푦 푡 • 푢 푡 푦 푡 푢 푡 + 0 and 0 denote the undisturbed 0 푦0 푡 푦 푡 푆 input and output, respectively, such that + −1 푛푎 • 퐴 푧 = 1 − 푎1푧 − ⋯ − 푧 + 퐴 푧 푦0 푡 = 퐵 푧 푢0 푡 푢 푡 푢 푡 −1 푛푏 • 퐵 푧 = 푏1푧 + ⋯ + 푧 + So that: 푦0 푡 = 푎1푦0 푡 − 1 + ⋯ + 푎푛푎푦0 푡 − 푛푎 + 푏1푢0 푡 − 1 + ⋯ + 푏푛푏 푢0 푡 − 푛푏 8 /44 Basic setup • 푢 푡 and 푦 푡 are zero-mean disturbances on input and output. The available signals are 푢 푡 = 푢0 푡 + 푢 푡 푦 푡 = 푦0 푡 + 푦 푡 Then: 푦0 푡 = 푎1푦0 푡 − 1 + ⋯ + 푎푛푎푦0 푡 − 푛푎 + 푏1푢0 푡 − 1 + ⋯ + 푏푛푏 푢0 푡 − 푛푏 푦 푡 − 푦 푡 = 푎1 푦 푡 − 1 − 푦 푡 − 1 + ⋯ + 푎푛푎 푦 푡 − 푛푎 − 푦 푡 − 푛푎 +푏1 푢 푡 − 1 − 푢 푡 − 1 + ⋯ + 푏푛푏 푢 푡 − 푛푏 − 푢 푡 − 푛푏 퐴 푧 푦 푡 = 퐵 푧 푢 푡 + 퐴 푧 푦 푡 − 퐵 푧 푢 푡 퐴 푧 푦 푡 = 퐵 푧 푢 푡 + 휂 푡 9 /44 ⊤ • 흋 푡 = 푦 푡 − 1 … 푦 푡 − 푛푎 푢 푡 − 1 … 푢 푡 − 푛푏 Basic setup ⊤ • 휽 = 푎1 … 푎푛푎 푏1 … 푏푛푏 We can then write the system as: 푦 푡 = 흋 푡 ⊤휽 + 휂 푡 Estimation problem 푁 Given 푁 observations 푢(푡 , 푦 푡 푡=1, estimate the system parameters ⊤ 휽 = 푎1 … 푎푛 푏1 … 푏푛 푑 × 1 푎 푏 We denote with 휽0, 퐴0 푧 , 퐵0 푧 the true values of the parameters and polynomials Consistency. An estimated parameter vector 휽푁 based on 푁 data points is said to be consistent if it converges to its “true” value 휽0 as the number of measured data grows without any limit 휽푁 → 휽0, 푁 → +∞ 10 /44 Outline 1. Introduction to error-in-variables problems 2. Least Squares revised 3. The instrumental variable method 4. Estimate an ARX model from ARMAX generated data 5. Application study: the VRFT approach for direct data driven control 6. Conclusions 11 /44 Least squares revised Consider a linear model having a the following structure: 푦 푡 = 푎1푦 푡 − 1 + ⋯ + 푎푛푎푦 푡 − 푛푎 + 푏1푢 푡 − 1 + ⋯ + 푏푛푏푢 푡 − 푛푏 + 휂 푡 퐴 푧 푦 푡 = 퐵 푧 푢 푡 + 휂 푡 where 휂 푡 denotes an equation error, which can describe disturbances as well as unmodeled dynamics (휂 푡 does not need to be white noise) 1 The Least Squares estimate, found by minimizing σ1 휂 푡 2, reads as: 푁 푡=1 −1 푁 푁 1 1 휽 = 흋 푡 흋 푡 ⊤ ⋅ 흋 푡 푦 푡 퐿푆 푁 푁 푑 × 1 푡=1 푑 × 1 1 × 푑 푡=1 푑 × 1 1 × 1 ⋯ ⋮ ⋮ ⋮ 12 /44 Least squares revised Consider now a linear system and write it as ⊤ 퐴0 푧 푦 푡 = 퐵0 푧 푢 푡 + 푣 푡 푦 푡 = 흋 푡 휽0 + 푣 푡 The 푣 푡 term can be evaluated as 푣 푡 = 퐴0 푧 푦 푡 − 퐵0 푧 푢 푡 = 퐴0 푧 푦0 푡 + 푦 푡 − 퐵0 푧 푢0 푡 + 푢 푡 = 퐴0 푧 푦 푡 − 퐵0 푧 푢 푡 Focus now on the estimation error: 휽퐿푆 − 휽0 13 /44 Least squares revised −1 푁 푁 1 1 휽 − 휽 = 흋 푡 흋 푡 ⊤ ⋅ 흋 푡 푦 푡 − 휽 퐿푆 0 푁 푁 0 푡=1 푡=1 −1 푁 푁 푁 1 1 = 흋 푡 흋 푡 ⊤ ⋅ 흋 푡 푦 푡 − 흋 푡 흋 푡 ⊤ 휽 푁 푁 0 푡=1 푡=1 푡=1 −1 푁 푁 1 1 = 흋 푡 흋 푡 ⊤ ⋅ 흋 푡 푦 푡 − 흋 푡 ⊤휽 푁 푁 0 푡=1 푡=1 −1 푁 푁 1 1 = 흋 푡 흋 푡 ⊤ ⋅ 흋 푡 푣 푡 푁 푁 푡=1 푡=1 14 /44 Least squares revised −1 푁 푁 1 1 휽 − 휽 = 흋 푡 흋 푡 ⊤ ⋅ 흋 푡 푣 푡 퐿푆 0 푁 푁 푡=1 푡=1 The summations in the equation converge to their expected values, under mild conditions. Thus, the estimate 휽퐿푆 is consistent if: • 피 흋 푡 흋 푡 ⊤ is invertible • 피 흋 푡 푣 푡 = ퟎ 15 /44 Least squares revised The second condition is the most resctrictive: 피 흋 푡 푣 푡 = ퟎ 푑 × 1 푑 × 1 If 푣 푡 is a white noise, it will be uncorrelated with all values in 흋 푡 , and so the estimate is consistent ⊤ 흋 푡 = 푦 푡 − 1 … 푦 푡 − 푛푎 푢 푡 − 1 … 푢 푡 − 푛푏 푦 푡 − 1 = 푓 푦 푡 − 2 , … , 푢 푡 − 2 , … , 푣 푡 − 1 , … ⊥ 푣 푡 In the EIV case, since 푣 푡 = 퐴0 푧 푦 푡 − 퐵0 푧 푢 푡 , it will be correlated with the variables in 흋 푡 , and so the estimate is NOT consistent 16 /44 Example (least squares with noise on regressor) Suppose that we want to estimate a static linear model, using regression and least squares 2 푦 푖 = 휃푥0 푖 + 푒푦 푖 휃 = 3, 푒푦 ∼ 풩 0, 휎푦 so that 푥0 푖 is noiseless. Suppose now that we measure and employ 2 푥 푖 = 푥0 푖 + 푒푥 푖 푒푥 ∼ 풩 0, 휎푥 instead of 푥0 푖 , i.e. we have a noisy regressor 푥 푖 The LS estimates are biased 2 proportionally to 휎푥 See static_system_regressor_noise.m MatLab file 17 /44 Example (least squares with noise on regressor) Let’s investigate the problem. 2 The relation assumed by LS is: 푦 푖 = 휃푥0 푖 + 푒푦 푖 휃 = 3, 푒푦 ∼ 풩 0, 휎푦 but we employ 푥 푖 = 푥0 푖 + 푒푥 푖 in place of 푥 푖 푦 푖 = 휃 푥 푖 − 푒푥 푖 + 푒푦 푖 = 휃푥 푖 − 휃푒푥 푖 + 푒푦 푖 = 휃푥 푖 + 휂 푖 So that employed regressor 푥 is correlated with the output noise 휂: 피 푥 푖 ⋅ 휂 푖 = 피 푥0 푖 + 푒푥 푖 ⋅ −휃푒푥 푖 + 푒푦 푖 ≠ 0 and a bias is present in the estimates See static_system_regressor_noise.m MatLab file 18 /44 Outline 1. Introduction to error-in-variables problems 2. Least Squares revised 3. The instrumental variable method 4. Estimate an ARX model from ARMAX generated data 5. Application study: the VRFT approach for direct data driven control 6.