Kalman Filter with heteroscedastic Q (covariance of the transition noise) I am looking at a generic derivation of the Kalman Filter (like this but you can take any). And I was wondering, checking all the derivation, why are we forced to assume that the covariance matrix Q of the transition noise $w_{t+1}$ reported below has to constant over time? Would it be correct to assume that Q changes with time t, preserving at the same time the assumption that the transition residuals $w_{t+1}$ and the measurement residuals $v_{t}$ are independent at each time t?
So given the model:
$$x_{t+1}=\phi x_{t}+w_{t+1}$$
$$y_{t}=Hx_{t}+v_{t}$$
where $v_{t}$ is a white noise. In the traditional derivation as the one linked above, $w_{t+1}$ is a white noise with constant moments over time as well (so Q is diagonal and constant over time). Why do we have to assume that $w_{t+1}$ is a white noise with constant variance for all time periods t instead of an error term following a GARCH process? Provided that anyway it has no correlation with $v_{t}$ for any t? 
it seems that what would change in the derivation of the Kalman Filter is just the last passage of the procedure where we project the time t+1 covariance of the error $P^{'t+1}=\phi P^{t+1} \phi^{T} + Q$. Indeed, if we assume that Q can change over time according to known paramters (I clarify the concept of "known parameters" as follows), we can use those parameters to calculate $Q_{t}$ for each t and write 
$$P^{'t+1}=\phi P^{t} \phi^{T} + Q_{t}$$
where $Q_{t}$ is known for each t. Assume for example that we have pre-estimated the parameters for $Q_{t}$ in a first-stage estimation and we want to use the Kalman-filter MLE to estimate the other parameters. In a QMLE setting we assume that those parameters for $Q_{t}$ are know and equal to the estimated parameters (i.e. we are not using the QMLE with Kalman Filter to estimate the GARCH parameters but the other parameters in the model!), so that we do not have to treat them as unknown parameters during the optimization (i.e. we can calculate and assign $Q_{t}$ for each t). Then, in my opinion, if $Q_{t}$ is assumed to be known for all the t, we can just derive the optimal gain and then solve the MLE optimization for the other parameters without any change to formulas.
What is wrong with this approach?
 A: It's new for me that Q is constant over time. Q should correspond to the precision of your model and can of course change if the model precision varies over time. 
For me it's even a very nice feature for the Filter tuning. 
In the Dan Simon's "Optimal State Estimation" Q is always given with a subscript k, which means for me that it's not constant.
Regarding to other sources on Kalman Filter I would advice to have a look at Kalman and Bayesian Filters in Python. This is an interactive e-book with a lot of python examples, which help to understand some difficult aspects of Kalman filtering. 
The Q matrix is nice explained in Chapter 7.3 Design of the Process Noise Matrix.
A: In my opinion, this is among the best sources for everybody interested in a generic version of the formulation of the Expectation Maximization, including the cases of:


*

*constant/time-varying parameters 

*with/without external regressors 

*with/without constraints 


Source: https://cran.r-project.org/web/packages/MARSS/vignettes/EMDerivation.pdf
which clearly allows for time-varying multiplicative matrixes of the error term.
