$$ \tilde{\boldsymbol{X}}_{t}=\tilde{\boldsymbol{\Lambda}}\tilde{\boldsymbol{S}}_{t}+\boldsymbol{\nu}_{t},\qquad\boldsymbol{\nu}_{t}\sim N(\mathbf{0},\mathbf{R}), $$

$$ \tilde{\boldsymbol{S}}_{t}=\tilde{\mathbf{G}}\tilde{\boldsymbol{S}}_{t-1}+\tilde{\mathbf{H}}\boldsymbol{\varepsilon}_{t},\qquad\boldsymbol{\varepsilon}_{t}\sim N(\mathbf{0},\mathbf{Q}(\boldsymbol{\theta})), $$

Firstly, Kalman filter for state space model is implemented as follows before carrying out simulation smoother.

$$ \begin{array}{r l r}{\eta_{t}}&{=}&{\tilde{\boldsymbol{X}}_{t}-\tilde{\boldsymbol{\Lambda}}\tilde{\boldsymbol{S}}_{t|t},\qquad\mathbf{F}_{t}=\tilde{\boldsymbol{\Lambda}}\tilde{\mathbf{P}}_{t|t}\tilde{\boldsymbol{\Lambda}}^{\prime}+\mathbf{R},\qquad\mathbf{K}_{t}=\tilde{\mathbf{G}}\tilde{\mathbf{P}}_{t|t}\tilde{\boldsymbol{\Lambda}}^{\prime}\mathbf{F}_{t}^{-1},}\end{array} $$

$$ \mathbf{L}_{t}=\tilde{\mathbf{G}}-\mathbf{K}_{t}\tilde{\mathbf{\Lambda}},\qquad\tilde{S}_{t+1|t+1}=\tilde{\mathbf{G}}\tilde{S}_{t|t}+\mathbf{K}_{t}\boldsymbol{\eta}_{t},\qquad\tilde{\mathbf{P}}_{t+1|t+1}=\tilde{\mathbf{G}}\tilde{\mathbf{P}}_{t|t}\mathbf{L}_{t}^{\prime}+\tilde{\mathbf{H}}\mathbf{Q}(\boldsymbol{\theta})\tilde{\mathbf{H}}^{\prime} $$

where $ \eta_{t} $ is forecasting errors, $ K_{t} $ is Kalman gain, $ \tilde{P}_{t} $ is variance covariance matrix of state variables $ \tilde{S}_{t} $ . Filtering of $ \tilde{S}_{t|t} $ , $ \tilde{P}_{t|t} $ iterates forward for period $ t = 1, 2, \cdots, T $ . And for initial value $ \tilde{S}_{1|1} $ , $ \tilde{P}_{1|1} $ , we set $ \tilde{X}_{1} = \tilde{\Lambda}\tilde{S}_{1} $ , and $ \tilde{P}_{1|1} = \tilde{\mathbf{G}}\tilde{\mathbf{P}}_{1|1}\tilde{\mathbf{G}}' + \tilde{\mathbf{H}}\mathbf{Q}(\boldsymbol{\theta})\tilde{\mathbf{H}}' $ , where subscript $ t|t $ of $ \tilde{S}_{t|t} $ denotes conditional expected value of $ \tilde{S}_{t} $ up to information on $ X_{1}, \cdots, X_{t} $ , thus, $ E(\tilde{S}_{t}|X_{1}, X_{2}, \cdots, X_{t}) $ .

Next, we generate values of $ r_{t-1} $ , $ N_{t-1} $ by implementing simulation smoother. This algorithm is iterated backward from period: $ t = T, \cdots, 2, 1 $ using values obtained from Kalman filter, as following equations (A.3), (A.4).

$$ \boldsymbol{r}_{t-1}=\tilde{\boldsymbol{\Lambda}}^{\prime}\mathbf{F}_{t}^{-1}\boldsymbol{\eta}_{t}-\mathbf{W}_{t}^{\prime}\mathbf{C}_{t}^{-1}\boldsymbol{d}_{t}+\mathbf{L}_{t}^{\prime}\boldsymbol{r}_{t}, $$

$$ \mathbf{N}_{t-1}=\tilde{\boldsymbol{\Lambda}}^{\prime}\mathbf{F}_{t}^{-1}\tilde{\boldsymbol{\Lambda}}+\mathbf{W}_{t}^{\prime}\mathbf{C}_{t}^{-1}\mathbf{W}_{t}+\mathbf{L}_{t}^{\prime}\mathbf{N}_{t}\mathbf{L}_{t}, $$

where $ W_{t} $ and $ C_{t} $ are obtained from equations.

$$ \mathbf{W}_{t}=\mathbf{Q}(\boldsymbol{\theta})\tilde{\mathbf{H}}^{\prime}\mathbf{N}_{t}\mathbf{L}_{t}, $$

$$ \mathbf{C}_{t}=\mathbf{Q}(\boldsymbol{\theta})-\mathbf{Q}(\boldsymbol{\theta})\tilde{\mathbf{H}}^{\prime}\mathbf{N}_{t}\tilde{\mathbf{H}}\mathbf{Q}(\boldsymbol{\theta}), $$

and random variable $ d_{t} $ is generated from $ N(0, \mathbf{C}_{t}) $ . Initial value $ r_{T} $ and $ N_{T} $ are set at $ r_{T} = 0 $ , and $ N_{T} = O $ .

And also smoothing of structural shocks $ \hat{\varepsilon}_{t|T} $ , are implemented backward iteration using the following equations. Subscript t|T of $ \hat{\varepsilon}_{t|T} $ denotes expected value conditional on total sample period such as $ E(\varepsilon_{t}|X_{1},X_{2},\cdots,X_{T}) $ .