# Flexible Least Squares Algorithm for Switching Models

Authors: Yunxia Ni; Lixing Lv; Yuejiang Ji
Journal: Complexity
 (2022)

---

## Abstract

The self-organizing model and expectation-maximization method are two traditional identification methods for switching models. They interactively update the parameters and model identities based on offline algorithms. In this paper, we propose a flexible recursive least squares algorithm which constructs the cost function based on two kinds of errors: the neighboring two-parameter estimation errors and the output estimation errors. Such an algorithm has several advantages over the two traditional identification algorithms: it (1) can estimate the parameters of all the sub-models without prior knowledge of the model identities; (2) has less computational efforts; and (3) can update the parameters with newly arrived data. The convergence properties and simulation examples are provided to illustrate the efficiency of the algorithm.


---

## Body

## 1. Introduction

Least squares (LS) algorithm is the most widely used method in parameter estimation [1–3]. It defines a cost function which is composed of the errors between the true outputs and the predicted outputs. Then, the estimations can be obtained by solving the derivative function of the cost function. The LS algorithm has fast convergence rates but with the cost of heavy computational efforts [4, 5]. In addition, the LS algorithm needs to compute the inverse of a matrix. If the matrix has a high order or is ill-conditioned, the LS algorithm is inefficient [6–9].To reduce the computational efforts and to avoid the matrix inversion, the recursive least squares (RLS) algorithm is a good choice. The basic idea of the RLS algorithm is to update the parameter estimations using the newly arrived data, that is, the cost function of the RLS algorithm is composed of only one set of data rather than all the collected data [10–12]. Therefore, the RLS algorithm has less computational efforts, and it does not require calculating the matrix inverse. However, the RLS algorithm has slow convergence rates when compared with the LS algorithm [13, 14]. With the aim to increase the convergence rates, many modified RLS algorithms are developed, e.g., the multi-innovation RLS algorithm [15, 16] and the hierarchical RLS algorithm [17, 18].Although the RLS algorithm and its modified counterparts can identify systems with less computational efforts and fast convergence rates, they have the assumption that the considered model is a single model. If the system is described by a switching model, those algorithms are inefficient. Switching models are widely used in engineering practices [19, 20]. Such models have several modes with different dynamical properties, and the modes are associated with various operating conditions [21, 22]. The difficulty in switching system identification is that the times of the operating points (model identities) may be unknown. To identify the switching models, one should first determine the operating points/model identities.The self-organizing model (SOM)-based method and the expectation-maximization (EM) method are two classical identification algorithms which are usually used for switching models [23–26]. The SOM method introduces several cost functions which correspond to each sub-model in each iteration, and the smallest cost function is associated with the true model in this sampling instant [23]. The EM algorithm regards the model identities as hidden variables and updates these identities in the EM-E step; once the identity estimations are obtained, the parameter estimations are computed in the EM-M step. These two steps run interactively until these two kinds of estimations converge to their true values [27, 28]. The SOM method should compute several cost functions in each iteration, and the EM algorithm needs to compute the model identities first. In addition, both these algorithms are offline algorithms. That is, they have heavy computational efforts and cannot update the parameters based on newly arrived data.The flexible least squares (FLS) algorithm, first developed by Kalaba and Tesfatsion [29], is used for time-varying system identification. Its cost function contains two parts: one is the error of the two parameters in the two neighboring instants, and the other is the error between the true outputs and predicted outputs [30–32]. Due to the first error, the parameter estimations can catch the varying parameters. Inspired by the FLS algorithm, we develop a novel FLS algorithm for switching models. This algorithm is termed as flexible recursive least squares (FRLS) algorithm. Compared with the SOM, EM, and FLS algorithms, this algorithm has the following advantages: (1) the FRLS algorithm is an online algorithm, and thus it can update the parameters with newly arrived data; (2) the FRLS algorithm has less computational efforts; and (3) the FRLS algorithm can estimate the parameters of all the sub-models without prior knowledge of the model identities.The remainder of the paper is organized as follows. Section 2 explains the switching model and traditional identification algorithms. Section 3 proposes the offline FLS algorithm and online FLS algorithm. Section 4 provides several simulation examples. Finally, Section 5 summarizes the paper and gives some future directions.


## 2. Problem Statement

Let us define some notations first:I means an identity matrix of the appropriate sizes; the superscript T stands for the matrix transpose; the norm of a matrix X is defined as X=λmaxXXT; λmaxXXT means the maximum eigenvalue of matrix XXT; and the norm of a vector z=z1,z2,…,znT∈ℝn is defined as z=∑i=1nzi21/2.


### 2.1. Switching Model

Consider the following switching model:(1)yit=φiTtϑi+vit,i=1,…,N,where yit is the output of the i-th model; φit∈ℝmi is the information vector of the i-th model, which is composed of the input and output data before the sampling instant t; ϑi is the parameter vector of the i-th model; vit is a Gaussian white noise and satisfies vit∼N0,σi2; and N is the number of the sub-models.In the sampling instantt, there is no knowledge of the identity of the model. We aim to estimate the parameter vectors ϑi,i=1,…,N based on the collected data.CollectL sets of input and output data, and define the following cost function:(2)Jϑ1,ϑ2,…,ϑN=∑t=1L∑i=1Nwityit−φiTtϑi2,where wit is the model identity in the sampling instant t. For example, in the sampling instant t, the true model is the s-th model, and then the true values of the identities of all the sub-models are w1t=0,w2t=0, ⋯, ws−1t=0,wst=1,ws+1t=0,…,wNt=0. To estimate the parameters, the following assumptions are introduced.Assumption 1.
The number of the collected data is larger than the number of the unknown parameters, that is,(3)L>m1+m2+⋯+mN.
In addition, assume that the number of data of thei-th sub-model is Li; then,(4)Li>mi.Assumption 2.
For the switching model proposed in (1), all the input data are taken as persistent excited.Assumption 3.
All the sub-models have the same information vector but different parameter vectors, that is, the switching model can be written by(5)yit=φTtϑi+vit,i=1,…,N,φt∈ℝm.Remark 1.
Assumptions1 and 2 can ensure that the information matrices of all the sub-models are nonsingular [6]. Assumption 3 can also be easily obtained [33]. For example, for a switching model with unknown structures, we can use the kernel method to describe the model, and all the sub-models approximated by using the kernel method can have the same structure.


### 2.2. Traditional Identification Algorithms

Rewrite the cost function of the switching model as follows:(6)Jϑ1,ϑ2,…,ϑN=∑t=1L∑i=1Nwityt−φTtϑi2.Assume that the parameter estimations and identity estimations in iterationk−1 are ϑ^ik−1,i=1,2,…,N and w^ik−1t,t=1,2,…,L.Both the SOM and EM algorithms estimate the parameters through two steps:(1)
Estimate the model identity estimationsw^ikt,i=1,2,…,N,t=1,2,…,L, based on the parameter estimations ϑ^ik−1,i=1,2,…,N.(2)
Update the parameter estimationsϑ^ik,i=1,2,…,N based on the model identity estimations w^ikt,i=1,2,…,N,t=1,2,…,L.The difference between the SOM and EM algorithms is in the first step. In the SOM algorithm, the model identity estimatew^ikt is 1 or 0. For example, in iteration k of the sampling instant t, let(7)ϑ^sk−1=argminϑ^ik−1tyt−φTtϑ^ik−12,i=1,2,…,N.Then,wskt=1 and the other identity estimations wikt=0,i≠s.On the other hand, in the EM algorithm, let(8)εit=yt−φTtϑ^ik−12,i=1,2,…,N.Then, the identity estimatewjkt can be computed by(9)wjkt=1/εjt∑i=1N1/εjt.Remark 2.
Both the SOM and EM algorithms are offline algorithms; if the order of the system is large, their computational efforts are heavy. In addition, they cannot update the parameters with newly arrived data [23, 34].


## 2.1. Switching Model

Consider the following switching model:(1)yit=φiTtϑi+vit,i=1,…,N,where yit is the output of the i-th model; φit∈ℝmi is the information vector of the i-th model, which is composed of the input and output data before the sampling instant t; ϑi is the parameter vector of the i-th model; vit is a Gaussian white noise and satisfies vit∼N0,σi2; and N is the number of the sub-models.In the sampling instantt, there is no knowledge of the identity of the model. We aim to estimate the parameter vectors ϑi,i=1,…,N based on the collected data.CollectL sets of input and output data, and define the following cost function:(2)Jϑ1,ϑ2,…,ϑN=∑t=1L∑i=1Nwityit−φiTtϑi2,where wit is the model identity in the sampling instant t. For example, in the sampling instant t, the true model is the s-th model, and then the true values of the identities of all the sub-models are w1t=0,w2t=0, ⋯, ws−1t=0,wst=1,ws+1t=0,…,wNt=0. To estimate the parameters, the following assumptions are introduced.Assumption 1.
The number of the collected data is larger than the number of the unknown parameters, that is,(3)L>m1+m2+⋯+mN.
In addition, assume that the number of data of thei-th sub-model is Li; then,(4)Li>mi.Assumption 2.
For the switching model proposed in (1), all the input data are taken as persistent excited.Assumption 3.
All the sub-models have the same information vector but different parameter vectors, that is, the switching model can be written by(5)yit=φTtϑi+vit,i=1,…,N,φt∈ℝm.Remark 1.
Assumptions1 and 2 can ensure that the information matrices of all the sub-models are nonsingular [6]. Assumption 3 can also be easily obtained [33]. For example, for a switching model with unknown structures, we can use the kernel method to describe the model, and all the sub-models approximated by using the kernel method can have the same structure.


## 2.2. Traditional Identification Algorithms

Rewrite the cost function of the switching model as follows:(6)Jϑ1,ϑ2,…,ϑN=∑t=1L∑i=1Nwityt−φTtϑi2.Assume that the parameter estimations and identity estimations in iterationk−1 are ϑ^ik−1,i=1,2,…,N and w^ik−1t,t=1,2,…,L.Both the SOM and EM algorithms estimate the parameters through two steps:(1)
Estimate the model identity estimationsw^ikt,i=1,2,…,N,t=1,2,…,L, based on the parameter estimations ϑ^ik−1,i=1,2,…,N.(2)
Update the parameter estimationsϑ^ik,i=1,2,…,N based on the model identity estimations w^ikt,i=1,2,…,N,t=1,2,…,L.The difference between the SOM and EM algorithms is in the first step. In the SOM algorithm, the model identity estimatew^ikt is 1 or 0. For example, in iteration k of the sampling instant t, let(7)ϑ^sk−1=argminϑ^ik−1tyt−φTtϑ^ik−12,i=1,2,…,N.Then,wskt=1 and the other identity estimations wikt=0,i≠s.On the other hand, in the EM algorithm, let(8)εit=yt−φTtϑ^ik−12,i=1,2,…,N.Then, the identity estimatewjkt can be computed by(9)wjkt=1/εjt∑i=1N1/εjt.Remark 2.
Both the SOM and EM algorithms are offline algorithms; if the order of the system is large, their computational efforts are heavy. In addition, they cannot update the parameters with newly arrived data [23, 34].


## 3. Flexible Recursive Least Squares Algorithm

The SOM and EM algorithms update the parameters through two steps, and these two steps are related to each other. If one kind of estimations has poor estimation accuracy, the other may be also poor or divergent. In this section, we use the FLS algorithm for the switching models, which can estimate the parameters without prior knowledge of the model identities.


### 3.1. Offline FLS Algorithm

Define(10)YL=yL,yL−1,…,y1T,ΦL=φL⋯0⋮⋱⋮0⋯φ1∈ℝLm×L,ΘL=ϑTL,…,ϑT1∈ℝLm,VL=vL,vL−1,…,v1T.Then, the switching model can be written as(11)YL=ΦTLΘL+VL.Let(12)Ω=μI−μI0⋯00−μI2μI−μI⋯000−μI2μI⋯00⋮⋮⋮⋱⋮⋮000⋯2μI−μI000⋯−μIμI.Unlike the SOM and EM algorithms, the cost function of the offline FLS algorithm is written by(13)JΘL=YL−ΦTLΘL2+ΘTLΩΘL.Using the FLS algorithm to update the parameters yields(14)Θ^L=Ω+ΦLΦTL−1ΦLYL.Remark 3.
From equation (5), we can get that the offline FLS (O-FLS) algorithm can estimate the parameters in only one iteration and does not require the model identify estimation. However, it increases the order of the information matrix intensively. For example, the order of the information matrix is Lm in the O-FLS algorithm, while in the EM and SOM methods, the order is m.Remark 4.
The offline FLS (O-FLS) algorithm requires a high-order matrix inverse calculation, e.g.,Ω+ΦLΦTL−1. When the high-order matrix is singular or ill-conditioned, computing its inverse is impossible.


### 3.2. Flexible Recursive Least Squares Algorithm

To reduce the computational efforts and to avoid a high-order matrix inversion, this section proposes an online FLS algorithm which is termed as flexible recursive least squares (FRLS) algorithm.Assume that the parameter vector in the sampling instantt−1 is ϑ^t−1. Define the following cost function:(15)Jϑt=∑s=1tys−φTsϑs2+μ∑s=1tϑs−ϑs−1Tϑs−ϑs−1.In the sampling instantt, all the parameter estimations before t have been obtained, and thus (15) is simplified as(16)Jϑt=yt−φTtϑt2+μϑt−ϑ^t−1Tϑt−ϑ^t−1.Taking the derivative ofJϑt with respect to ϑt yields(17)ϑ^t=φtφTt+μI−1φtyt+μϑ^t−1.Next, we use the recursive method to obtain the relationships betweenϑ^t and ϑ^t−1.(17) is transformed into(18)ϑ^t=φtφTt+μI−1φtyt+μϑ^t−1+φtφTtϑ^t−1−φtφTtϑ^t−1=φtφTt+μI−1μϑ^t−1+φtφTtϑ^t−1+φtyt−φtφTtϑ^t−1=ϑ^t−1+φtφTt+μI−1φt×yt−φTtϑ^t−1.Then, the FRLS algorithm can be summarized as follows:(19)ϑ^t=ϑ^t−1+QtφtEt,Et=yt−φTtϑ^t−1,Qt=φtφTt+μI−1.Remark 5.
Compared with the O-FLS algorithm, the FRLS algorithm performs a low-orderm−order matrix inversion rather than a high-order Lm−order matrix inversion. Therefore, the FRLS algorithm has less computational efforts than the O-FLS algorithm (Algorithm1).
Then, the steps of the FRLS algorithm are listed as follows.
Algorithm 1: FRLS algorithm.
(i)
Initialiseϑ^0=1/p0, p0=106,1 is a vector whose(ii)
entries all equal to 1, and assign a positive constantμ(iii)
repeat(iv)
fort=1,2,…, do(v)
Collect the input-output dataut,yt(vi)
Formφt(vii)
ComputeEt(viii)
ComputeQt(ix)
Updateϑ^t(x)
end(xi)
until convergence
In the FRLS algorithm, there exists a dense matrix inversion, which leads to heavy computational efforts. To further reduce the computational efforts, the following lemma is introduced.Lemma 1.
For the matricesA∈ℝn×n, B∈ℝn×r, and C∈ℝr×n, if the matrix A is nonsingular, the following equality holds:(20)A+BC−1=A−1−A−1BI+CA−1B−1CA−1.Proof.
For the matrixA+BC, we have(21)A+BCA−1−A−1BI+CA−1B−1CA−1=I−BI+CA−1B−1CA−1+BCA−1−BCA−1BI+CA−1B−1CA−1=I−B+BCA−1BI+CA−1B−1CA−1+BCA−1=I−BI+CA−1BI+CA−1B−1CA−1+BCA−1=I.
In addition, we can obtain(22)A−1−A−1BI+CA−1B−1CA−1A+BC=I+A−1BC−A−1BI+CA−1B−1C−A−1BI+CA−1B−1CA−1BC=I+A−1BC−A−1BI+CA−1B−1C+CA−1BC=I+A−1BC−A−1BI+CA−1B−1I+CA−1BC=I.
Then, the proof is completed.
According to Lemma1, the matrix Qt is simplified as(23)Qt=φtφTt+μI−1=1μI−1/μ2φtφTt1+1/μφTtφt=1μI−φtφTtμ2+μφTtφt.Remark 6.
Based on equation (15), in each sampling instant, a dense matrix inversion is transformed into vector multiplication. Therefore, the computational efforts are reduced.


### 3.3. Convergence Properties of the Two Kinds of FLS Algorithms

The convergence properties of the O-FLS and FRLS algorithms are given in this section which can help the researchers follow these two algorithms.


#### 3.3.1. Convergence Property of the O-FLS Algorithm

Theorem 1.
For the switching model proposed in (1), the parameter estimations Θ^L updated by the O-FLS algorithm are expressed by (5). Then, Θ^L are biased.Proof.
Rewrite the O-FLS algorithm as follows:(24)Θ^L=Ω+ΦLΦTL−1ΦLYL.
SubstitutingYL=ΦTLΘL+VL into the above equation yields(25)Θ^L=Ω+ΦLΦTL−1ΦLΦTLΘL+VL,where VL is Gaussian white and independent on ΦL, and the above equation can be written by(26)Θ^L=Ω+ΦLΦTL−1ΦLΦTLΘL.
SinceΦL∈ℝLm×L, the matrix ΦLΦTL is singular, and the matrix Ω cannot be a zero matrix. Therefore, the O-FLS algorithm is a biased algorithm.Remark 7.
A smallμ can get more accurate parameter estimations. However, a small μ may lead to slow convergence rates between the two neighboring sub-models. Therefore, we should assign different values for μ. For example, in the fixed interval, a small μ is better, while near the switching points, a larger one is better.


#### 3.3.2. Convergence Property of the FRLS Algorithm

Theorem 2.
For the switching model proposed in (1), the parameter estimations ϑ^t updated by the FRLS algorithm are expressed by (10)–(12). Then, the sequence ϑ^t is convergent.Proof.
The FRLS algorithm is written by(27)ϑ^t=ϑ^t−1+φtφTt+μI−1φtyt−φTtϑ^t−1.
Assume that the data from1⟶L1,L1≫m belong to model 1, and subtracting the true value ϑ1 on both sides of the above equation yields(28)e^t=e^t−1−φtφTt+μI−1φtφTe^t−1=I−φtφTt+μI−1φtφTte^t−1.
For the reason that(29)I−φtφTt+μI−1φtφTt<1,we have(30)e^t<e^t−1.
Therefore, the FRLS algorithm is convergent.Remark 8.
The FRLS algorithm has the assumption that the identities of the data are unchanging in a fixed interval. If the identities are changing continually, the FRLS algorithm is divergent.


## 3.1. Offline FLS Algorithm

Define(10)YL=yL,yL−1,…,y1T,ΦL=φL⋯0⋮⋱⋮0⋯φ1∈ℝLm×L,ΘL=ϑTL,…,ϑT1∈ℝLm,VL=vL,vL−1,…,v1T.Then, the switching model can be written as(11)YL=ΦTLΘL+VL.Let(12)Ω=μI−μI0⋯00−μI2μI−μI⋯000−μI2μI⋯00⋮⋮⋮⋱⋮⋮000⋯2μI−μI000⋯−μIμI.Unlike the SOM and EM algorithms, the cost function of the offline FLS algorithm is written by(13)JΘL=YL−ΦTLΘL2+ΘTLΩΘL.Using the FLS algorithm to update the parameters yields(14)Θ^L=Ω+ΦLΦTL−1ΦLYL.Remark 3.
From equation (5), we can get that the offline FLS (O-FLS) algorithm can estimate the parameters in only one iteration and does not require the model identify estimation. However, it increases the order of the information matrix intensively. For example, the order of the information matrix is Lm in the O-FLS algorithm, while in the EM and SOM methods, the order is m.Remark 4.
The offline FLS (O-FLS) algorithm requires a high-order matrix inverse calculation, e.g.,Ω+ΦLΦTL−1. When the high-order matrix is singular or ill-conditioned, computing its inverse is impossible.


## 3.2. Flexible Recursive Least Squares Algorithm

To reduce the computational efforts and to avoid a high-order matrix inversion, this section proposes an online FLS algorithm which is termed as flexible recursive least squares (FRLS) algorithm.Assume that the parameter vector in the sampling instantt−1 is ϑ^t−1. Define the following cost function:(15)Jϑt=∑s=1tys−φTsϑs2+μ∑s=1tϑs−ϑs−1Tϑs−ϑs−1.In the sampling instantt, all the parameter estimations before t have been obtained, and thus (15) is simplified as(16)Jϑt=yt−φTtϑt2+μϑt−ϑ^t−1Tϑt−ϑ^t−1.Taking the derivative ofJϑt with respect to ϑt yields(17)ϑ^t=φtφTt+μI−1φtyt+μϑ^t−1.Next, we use the recursive method to obtain the relationships betweenϑ^t and ϑ^t−1.(17) is transformed into(18)ϑ^t=φtφTt+μI−1φtyt+μϑ^t−1+φtφTtϑ^t−1−φtφTtϑ^t−1=φtφTt+μI−1μϑ^t−1+φtφTtϑ^t−1+φtyt−φtφTtϑ^t−1=ϑ^t−1+φtφTt+μI−1φt×yt−φTtϑ^t−1.Then, the FRLS algorithm can be summarized as follows:(19)ϑ^t=ϑ^t−1+QtφtEt,Et=yt−φTtϑ^t−1,Qt=φtφTt+μI−1.Remark 5.
Compared with the O-FLS algorithm, the FRLS algorithm performs a low-orderm−order matrix inversion rather than a high-order Lm−order matrix inversion. Therefore, the FRLS algorithm has less computational efforts than the O-FLS algorithm (Algorithm1).
Then, the steps of the FRLS algorithm are listed as follows.
Algorithm 1: FRLS algorithm.
(i)
Initialiseϑ^0=1/p0, p0=106,1 is a vector whose(ii)
entries all equal to 1, and assign a positive constantμ(iii)
repeat(iv)
fort=1,2,…, do(v)
Collect the input-output dataut,yt(vi)
Formφt(vii)
ComputeEt(viii)
ComputeQt(ix)
Updateϑ^t(x)
end(xi)
until convergence
In the FRLS algorithm, there exists a dense matrix inversion, which leads to heavy computational efforts. To further reduce the computational efforts, the following lemma is introduced.Lemma 1.
For the matricesA∈ℝn×n, B∈ℝn×r, and C∈ℝr×n, if the matrix A is nonsingular, the following equality holds:(20)A+BC−1=A−1−A−1BI+CA−1B−1CA−1.Proof.
For the matrixA+BC, we have(21)A+BCA−1−A−1BI+CA−1B−1CA−1=I−BI+CA−1B−1CA−1+BCA−1−BCA−1BI+CA−1B−1CA−1=I−B+BCA−1BI+CA−1B−1CA−1+BCA−1=I−BI+CA−1BI+CA−1B−1CA−1+BCA−1=I.
In addition, we can obtain(22)A−1−A−1BI+CA−1B−1CA−1A+BC=I+A−1BC−A−1BI+CA−1B−1C−A−1BI+CA−1B−1CA−1BC=I+A−1BC−A−1BI+CA−1B−1C+CA−1BC=I+A−1BC−A−1BI+CA−1B−1I+CA−1BC=I.
Then, the proof is completed.
According to Lemma1, the matrix Qt is simplified as(23)Qt=φtφTt+μI−1=1μI−1/μ2φtφTt1+1/μφTtφt=1μI−φtφTtμ2+μφTtφt.Remark 6.
Based on equation (15), in each sampling instant, a dense matrix inversion is transformed into vector multiplication. Therefore, the computational efforts are reduced.


## 3.3. Convergence Properties of the Two Kinds of FLS Algorithms

The convergence properties of the O-FLS and FRLS algorithms are given in this section which can help the researchers follow these two algorithms.


### 3.3.1. Convergence Property of the O-FLS Algorithm

Theorem 1.
For the switching model proposed in (1), the parameter estimations Θ^L updated by the O-FLS algorithm are expressed by (5). Then, Θ^L are biased.Proof.
Rewrite the O-FLS algorithm as follows:(24)Θ^L=Ω+ΦLΦTL−1ΦLYL.
SubstitutingYL=ΦTLΘL+VL into the above equation yields(25)Θ^L=Ω+ΦLΦTL−1ΦLΦTLΘL+VL,where VL is Gaussian white and independent on ΦL, and the above equation can be written by(26)Θ^L=Ω+ΦLΦTL−1ΦLΦTLΘL.
SinceΦL∈ℝLm×L, the matrix ΦLΦTL is singular, and the matrix Ω cannot be a zero matrix. Therefore, the O-FLS algorithm is a biased algorithm.Remark 7.
A smallμ can get more accurate parameter estimations. However, a small μ may lead to slow convergence rates between the two neighboring sub-models. Therefore, we should assign different values for μ. For example, in the fixed interval, a small μ is better, while near the switching points, a larger one is better.


### 3.3.2. Convergence Property of the FRLS Algorithm

Theorem 2.
For the switching model proposed in (1), the parameter estimations ϑ^t updated by the FRLS algorithm are expressed by (10)–(12). Then, the sequence ϑ^t is convergent.Proof.
The FRLS algorithm is written by(27)ϑ^t=ϑ^t−1+φtφTt+μI−1φtyt−φTtϑ^t−1.
Assume that the data from1⟶L1,L1≫m belong to model 1, and subtracting the true value ϑ1 on both sides of the above equation yields(28)e^t=e^t−1−φtφTt+μI−1φtφTe^t−1=I−φtφTt+μI−1φtφTte^t−1.
For the reason that(29)I−φtφTt+μI−1φtφTt<1,we have(30)e^t<e^t−1.
Therefore, the FRLS algorithm is convergent.Remark 8.
The FRLS algorithm has the assumption that the identities of the data are unchanging in a fixed interval. If the identities are changing continually, the FRLS algorithm is divergent.


## 3.3.1. Convergence Property of the O-FLS Algorithm

Theorem 1.
For the switching model proposed in (1), the parameter estimations Θ^L updated by the O-FLS algorithm are expressed by (5). Then, Θ^L are biased.Proof.
Rewrite the O-FLS algorithm as follows:(24)Θ^L=Ω+ΦLΦTL−1ΦLYL.
SubstitutingYL=ΦTLΘL+VL into the above equation yields(25)Θ^L=Ω+ΦLΦTL−1ΦLΦTLΘL+VL,where VL is Gaussian white and independent on ΦL, and the above equation can be written by(26)Θ^L=Ω+ΦLΦTL−1ΦLΦTLΘL.
SinceΦL∈ℝLm×L, the matrix ΦLΦTL is singular, and the matrix Ω cannot be a zero matrix. Therefore, the O-FLS algorithm is a biased algorithm.Remark 7.
A smallμ can get more accurate parameter estimations. However, a small μ may lead to slow convergence rates between the two neighboring sub-models. Therefore, we should assign different values for μ. For example, in the fixed interval, a small μ is better, while near the switching points, a larger one is better.


## 3.3.2. Convergence Property of the FRLS Algorithm

Theorem 2.
For the switching model proposed in (1), the parameter estimations ϑ^t updated by the FRLS algorithm are expressed by (10)–(12). Then, the sequence ϑ^t is convergent.Proof.
The FRLS algorithm is written by(27)ϑ^t=ϑ^t−1+φtφTt+μI−1φtyt−φTtϑ^t−1.
Assume that the data from1⟶L1,L1≫m belong to model 1, and subtracting the true value ϑ1 on both sides of the above equation yields(28)e^t=e^t−1−φtφTt+μI−1φtφTe^t−1=I−φtφTt+μI−1φtφTte^t−1.
For the reason that(29)I−φtφTt+μI−1φtφTt<1,we have(30)e^t<e^t−1.
Therefore, the FRLS algorithm is convergent.Remark 8.
The FRLS algorithm has the assumption that the identities of the data are unchanging in a fixed interval. If the identities are changing continually, the FRLS algorithm is divergent.


## 4. Examples

### 4.1. Example 1

Consider the following switching model:(31)Sub−model1:yt=0.5ut−1+0.67ut−2−0.34ut−3+0.23ut−4+0.76ut−5+vt,Sub−model2:yt=1.5ut−1−0.5ut−2+1.24ut−3−0.23ut−4−0.36ut−5+vt,ut∼N0,1,vt∼N0,0.12.Let(32)ϑ=b1,b2,b3,b4,b5T,ϑ1=b1,b2,b3,b4,b5T=0.5,0.67,−0.34,0.23,0.76T,ϑ2=b1,b2,b3,b4,b5T=1.5,−0.5,1.24,−0.23,−0.36T.In simulation, we collect 500 sets of input and output data, where the data from1:250 belong to model 1, and those from 251:500 belong to model 2.Use the FRLS algorithm for this switching model. The parameter estimations are shown in Figures1 and 2. The predicted outputs and the true outputs, and their errors are shown in Figure 3. In addition, apply the EM and SOM algorithms for the switching model, where the initial identities for each sub-model are ωj0t=1/2,j=1,2 and t=1,2,…,500. The estimation errors and elapsed times of the three algorithms are shown Table 1.Figure 1
The parameter estimations and true parametersb1 and b2.Figure 2
The parameter estimations and true parametersb3−b5.Figure 3
The output estimations and their estimation errors.Table 1
The elapsed times and estimation errors of these three algorithms.
AlgorithmsFRLSEMSOMElapsed times (second)1.7042.2572.038Estimation errors1.201%1.145%1.273%From this simulation, we can get the following findings:(1)
The parameter estimations using the FRLS algorithm can asymptotically converge to the true values (see Figures1 and 2).(2)
The predicted outputs using the FRLS algorithm can catch the true outputs (see Figure3).(3)
The number of the data in a fixed interval must be larger than the number of the unknown parameters.(4)
All the FRLS, EM, and SOM algorithms are effective for the switching model, but the FRLS algorithm has the smallest elapsed times, that is, the FRLS algorithm has the least computational efforts among these three algorithms, as shown in Table1.


### 4.2. Example 2: A Switching Open Channel System

In this section, we consider an open channel system, which is shown in Figure4. The radius of the channel is R, the length of the channel is x, ut is the discharge at the upstream end, yt is the discharge at the downstream end, and the slope is β. To ensure the discharge yt to flow in a fixed speed, we should control ut. The relationship between ut and yt can be expressed by a linear model. In simulation, two slopesβ1=10 and β1=15degrees are assigned to the open channel system. These two slopes lead to two different dynamics which should be described by two models: [14]:(33)Sub−model1:yt=0.4097yt−1+0.5579yt−2+0.0183ut−1+0.0202ut−2−0.0045ut−3+vt,t=1,2,…,1000,Sub−model2:yt=0.8047yt−1+0.1573yt−2+0.0330ut−1+0.0231ut−2+0.0763ut−3+vt,t=1001,1002,…,2000.Figure 4
The open channel system.We collect 2000 sets of input-output data using Matlab software, where the sequenceut is generated by(34)u=idinputL′,RBS′,0,1,−1,1.The data fromt=1:1000 belong to model 1, and those from 1001:2000 belong to model 2.Apply the FRLS algorithm for the considered switching model. The parameter estimations and their estimation errorsδ=ϑ^it−ϑ/ϑ,i=1,2, are shown in Figure 5 and Tables 2 and 3.Figure 5
The parameter estimation errors (FRLS).Table 2
The parameter estimations of sub-model 1.
tϑ1,1ϑ1,2ϑ1,3ϑ1,4ϑ1,5δ1%1000.172340.237630.014340.021630.0085957.580893000.344940.474650.016880.020670.0022015.257825000.403020.552580.017680.020420.000161.407287000.406570.552710.017700.020380.000081.100918000.408180.551130.017700.020360.000061.2017010000.410060.549300.017700.020320.000041.40738True values0.409700.557900.018300.02020−0.0045Table 3
The parameter estimations of sub-model 2.
tϑ2,1ϑ2,2ϑ2,3ϑ2,4ϑ2,5δ2%11000.385760.070800.031940.036430.0325952.1809913000.809480.147920.033120.023420.078191.2977015000.806280.147560.033020.023510.075561.2011317000.809480.147920.033120.023420.078191.2977018000.809600.147780.033130.023420.078231.3197810000.810090.147280.033130.023410.078221.39991True values0.804700.157300.033000.023100.07630Furthermore, we use the traditional EM and SOM algorithms for the switching open channel systemωj0t=1/2,j=1,2andt=1,2,…,2000. The parameter estimations and their estimation errors are shown in Figures 6 and 7. The elapsed times of these three algorithms are shown Table 4.Figure 6
The parameter estimation errors (EM).Figure 7
The parameter estimation errors (SOM).Table 4
The elapsed times of these three algorithms.
AlgorithmsFRLSEMSOMElapsed times (second)1.9522.592.33This example shows that (1) all the FRLS, EM, and SOM algorithms are convergent, as shown in Figures5–7; (2) the FRLS algorithm has the smallest elapsed times among these three algorithms, and this is shown in Table 4, that is, the FRLS algorithm has the least computational efforts among these three algorithms.


## 4.1. Example 1

Consider the following switching model:(31)Sub−model1:yt=0.5ut−1+0.67ut−2−0.34ut−3+0.23ut−4+0.76ut−5+vt,Sub−model2:yt=1.5ut−1−0.5ut−2+1.24ut−3−0.23ut−4−0.36ut−5+vt,ut∼N0,1,vt∼N0,0.12.Let(32)ϑ=b1,b2,b3,b4,b5T,ϑ1=b1,b2,b3,b4,b5T=0.5,0.67,−0.34,0.23,0.76T,ϑ2=b1,b2,b3,b4,b5T=1.5,−0.5,1.24,−0.23,−0.36T.In simulation, we collect 500 sets of input and output data, where the data from1:250 belong to model 1, and those from 251:500 belong to model 2.Use the FRLS algorithm for this switching model. The parameter estimations are shown in Figures1 and 2. The predicted outputs and the true outputs, and their errors are shown in Figure 3. In addition, apply the EM and SOM algorithms for the switching model, where the initial identities for each sub-model are ωj0t=1/2,j=1,2 and t=1,2,…,500. The estimation errors and elapsed times of the three algorithms are shown Table 1.Figure 1
The parameter estimations and true parametersb1 and b2.Figure 2
The parameter estimations and true parametersb3−b5.Figure 3
The output estimations and their estimation errors.Table 1
The elapsed times and estimation errors of these three algorithms.
AlgorithmsFRLSEMSOMElapsed times (second)1.7042.2572.038Estimation errors1.201%1.145%1.273%From this simulation, we can get the following findings:(1)
The parameter estimations using the FRLS algorithm can asymptotically converge to the true values (see Figures1 and 2).(2)
The predicted outputs using the FRLS algorithm can catch the true outputs (see Figure3).(3)
The number of the data in a fixed interval must be larger than the number of the unknown parameters.(4)
All the FRLS, EM, and SOM algorithms are effective for the switching model, but the FRLS algorithm has the smallest elapsed times, that is, the FRLS algorithm has the least computational efforts among these three algorithms, as shown in Table1.


## 4.2. Example 2: A Switching Open Channel System

In this section, we consider an open channel system, which is shown in Figure4. The radius of the channel is R, the length of the channel is x, ut is the discharge at the upstream end, yt is the discharge at the downstream end, and the slope is β. To ensure the discharge yt to flow in a fixed speed, we should control ut. The relationship between ut and yt can be expressed by a linear model. In simulation, two slopesβ1=10 and β1=15degrees are assigned to the open channel system. These two slopes lead to two different dynamics which should be described by two models: [14]:(33)Sub−model1:yt=0.4097yt−1+0.5579yt−2+0.0183ut−1+0.0202ut−2−0.0045ut−3+vt,t=1,2,…,1000,Sub−model2:yt=0.8047yt−1+0.1573yt−2+0.0330ut−1+0.0231ut−2+0.0763ut−3+vt,t=1001,1002,…,2000.Figure 4
The open channel system.We collect 2000 sets of input-output data using Matlab software, where the sequenceut is generated by(34)u=idinputL′,RBS′,0,1,−1,1.The data fromt=1:1000 belong to model 1, and those from 1001:2000 belong to model 2.Apply the FRLS algorithm for the considered switching model. The parameter estimations and their estimation errorsδ=ϑ^it−ϑ/ϑ,i=1,2, are shown in Figure 5 and Tables 2 and 3.Figure 5
The parameter estimation errors (FRLS).Table 2
The parameter estimations of sub-model 1.
tϑ1,1ϑ1,2ϑ1,3ϑ1,4ϑ1,5δ1%1000.172340.237630.014340.021630.0085957.580893000.344940.474650.016880.020670.0022015.257825000.403020.552580.017680.020420.000161.407287000.406570.552710.017700.020380.000081.100918000.408180.551130.017700.020360.000061.2017010000.410060.549300.017700.020320.000041.40738True values0.409700.557900.018300.02020−0.0045Table 3
The parameter estimations of sub-model 2.
tϑ2,1ϑ2,2ϑ2,3ϑ2,4ϑ2,5δ2%11000.385760.070800.031940.036430.0325952.1809913000.809480.147920.033120.023420.078191.2977015000.806280.147560.033020.023510.075561.2011317000.809480.147920.033120.023420.078191.2977018000.809600.147780.033130.023420.078231.3197810000.810090.147280.033130.023410.078221.39991True values0.804700.157300.033000.023100.07630Furthermore, we use the traditional EM and SOM algorithms for the switching open channel systemωj0t=1/2,j=1,2andt=1,2,…,2000. The parameter estimations and their estimation errors are shown in Figures 6 and 7. The elapsed times of these three algorithms are shown Table 4.Figure 6
The parameter estimation errors (EM).Figure 7
The parameter estimation errors (SOM).Table 4
The elapsed times of these three algorithms.
AlgorithmsFRLSEMSOMElapsed times (second)1.9522.592.33This example shows that (1) all the FRLS, EM, and SOM algorithms are convergent, as shown in Figures5–7; (2) the FRLS algorithm has the smallest elapsed times among these three algorithms, and this is shown in Table 4, that is, the FRLS algorithm has the least computational efforts among these three algorithms.


## 5. Conclusions

An online FLS algorithm, termed as flexible recursive least squares (FRLS) algorithm, is proposed for switching models in this study. Its cost function is composed of the errors between the two neighboring parameter estimations and the errors between the true outputs and the predicted outputs. With the help of the two neighboring parameter estimation errors, the operating points of the switching models can be determined, and the parameters of each sub-model can also been obtained. Compared with the SOM and EM algorithms, the FRLS algorithm can estimate the parameter estimations without prior knowledge of the model identities. In addition, the FRLS algorithm is an online algorithm, which has less computational efforts and can update the parameters with newly arrived data.Although the FRLS algorithm has several advantages over the traditional identification algorithms, several challenging issues about the FRLS algorithm need to be considered in future. For example, if the sub-models switch continually, how to apply the FRLS algorithm to the switching model? How to choose a suitableμ to make the FRLS algorithm converge quickly to the true values? These topics remain as open problems.



---

*Source: 2605570-2022-10-26.xml*