# An Improved Adaptive Iterative Extended Kalman Filter Based on Variational Bayesian
## 2 Computational Procedure
### Prior Distributions  
Provide a detailed description of the updating process for prior distributions. In the Kalman filtering paradigm, the likelihood probability density function (PDF) \(p(\tilde{Z}_{t}\mid\tilde{X}_{t})\) and the one-step anticipated PDF \(p(\tilde{X}_{t}\mid\tilde{Z}_{1:t-1})\) are Gaussian distributions:  
\[p(\tilde{X}_{t}\mid\tilde{Z}_{1:t-1})=N\Big{(}\tilde{X}_{t};\tilde{X}_{t|t-1}, P_{t|t-1}\Big{)} \tag{5}\]  
\[p(\tilde{Z}_{t}\mid\tilde{X}_{t})=N\big{(}\tilde{Z}_{t};h(\tilde{X}_{t}),R_{t} \big{)} \tag{6}\]  
where the Gaussian distribution \(\tilde{\mathrm{N}}(A;\alpha,\sigma)\) has the following mean and variance: \(\alpha,\sigma\), and its PDF is:  
\[\tilde{\mathrm{N}}(A;\alpha,\sigma)=\frac{1}{\sqrt{|2\pi\sigma|}}e^{-\frac{1}{ 2}(A-\alpha)^{T}\sigma^{-1}(A-\alpha)} \tag{7}\]  
The anticipated state vector \(\tilde{X}_{t|t-1}\) and the related one-step predicted covariance matrix \(P_{t|t-1}\) can be represented as follows:\[\hat{X}_{t|t-1}=F\hat{X}_{t-1|t-1}+\mu_{t} \tag{8}\]  
\[P_{t|t-1}=FP_{t-1|t-1}F^{T}+Q_{t-1} \tag{9}\]  
where \(\hat{X}_{t-1|t-1}\) and \(P_{t-1|t-1}\) denote the state estimate and estimation error covariance matrix at time \(t-1\), respectively. Where \(\hat{X}_{t-1|t-1}\) and \(P_{t-1|t-1}\) represent the state estimation and the covariance matrix of the estimate error at time \(t-1\), respectively. The coefficient \(P_{t|t-1}\) in Equation (9) is imprecise, and the actual process noise covariance matrix \(Q_{t}\) is not known. The inverse Wishart (IW) distribution is considered the conjugate prior distribution for a Gaussian distribution with a specified mean covariance matrix in Bayesian statistics. Variational Bayesian (VB) approaches offer a closed-form analytical solution to this intricate problem. Let us consider the Wishart distribution \(W\big{(}\varphi^{-1};\beta,\theta-1\big{)}\), where \(\varphi^{-1}\) is the inverse matrix of a positive definite matrix \(\varphi\). The matrix \(\varphi\) is distributed according to the inverse Wishart (IW) distribution [37]. \[IW(\varphi;\beta,\theta)=\frac{|\theta|^{\beta/2}|\varphi|^{-(\beta+d+1)/2} \mathrm{e}^{-\mathrm{tr}\big{(}\theta_{B}^{-1}\big{)}/2}}{2^{d\beta/2}\Gamma_ {d}(\beta/2)} \tag{10}\]  
where \(\beta>d+1\) represents the degree of freedom, \(\theta\) represents a \(d\times d\) positive definite matrix, d represents the dimension of \(\theta,\Gamma_{d}(\cdot)\) represents the multivariate gamma distribution, and trace \((\cdot)\) represents the trace function. The expected value of the matrix \(\varphi\sim IW(\varphi;\beta,\theta)\), if it follows the IW distribution, is \(E(\varphi)=\frac{\theta}{\beta-d-1}\). Due to the fact that \(P_{t|t-1}\) and \(R_{t}\) are the normal PDF covariance matrices, \(p\big{(}P_{t|t-1}\mid\tilde{Z}_{1:t-1}\big{)}\) and \(p\big{(}R_{t}\mid\tilde{Z}_{1:t-1}\big{)}\) can be written as IW distributions:  
\[p\big{(}P_{t|t-1}\mid\tilde{Z}_{1:t-1}\big{)}=IW\big{(}P_{t|t-1};\hat{t}_{t|t -1},\hat{T}_{t|t-1}\big{)} \tag{11}\]  
\[p\big{(}R_{t}\mid\tilde{Z}_{1:t-1}\big{)}=IW\big{(}R_{t|t-1};\hat{u}_{t|t-1}, \hat{U}_{t|t-1}\big{)} \tag{12}\]  
where \(\hat{u}_{t|t-1}\) and \(\hat{U}_{t|t-1}\) denote the degrees of freedom and scale matrices of \(p\big{(}R_{t}\mid\tilde{Z}_{1:t-1}\big{)}\), respectively, \(\hat{t}_{t|t-1}\) and \(\hat{T}_{t|t-1}\) denote the degrees of freedom and scale matrices of \(p\Big{(}P_{t|t-1}\mid\tilde{Z}_{1:t-1}\big{)}\). Then, it is necessary to determine the values of \(\hat{t}_{t|t-1}\), \(\hat{T}_{t|t-1}\), \(\hat{u}_{t|t-1}\) and \(\hat{U}_{t|t-1}\). The nominal error covariance matrix \(P_{t|t-1}\) can be set equal to the mean of matrix \(\bar{P}_{t|t-1}\). Using \(E(\varphi)=\frac{\theta}{\beta-d-1}\), we arrive at the following:  
\[\frac{\hat{T}_{t|t-1}}{\hat{T}_{t|t-1}-n-1}=\bar{P}_{t|t-1}=FP_{t-1|t-1}F^{T} +\bar{Q}_{t-1} \tag{13}\]  
where \(n\) stands for the dimension of the state \(T_{t|t-1}\), and \(\bar{Q}_{t-1}\) stands for the nominal process noise covariance.