# Initial conditions of differentiated Kalman filter for MLE

I want some help about the initial conditions for the derivative of a Kalman filter. (Differentiating the filtering equations necessary for the calculation of the gradient of the log-likelihood function based on Kalman filtering: $$\frac {\partial \hat{x}_{0|0}}{\partial \theta_l}\text{ and }\frac {\partial P_{0|0}}{\partial \theta_l},\quad l =1,...,p,$$ and $p$ is the number of parameters.) In the Kalman filter it is familiar that $\hat{x}_{0|0}$ and $P_{0|0}$ contain a scalar values, for example the initial conditions of Kalman filter for the estimation of a nonlinear state space model with 3 variables are $\hat{x}_{0|0}=[1, 0, 1]^T$ and $$P_{0|0}= \begin{pmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\\ \end{pmatrix}.$$ Are the initial conditions caculated by simply performing the derivative of $\hat{x}_{0|0}$ and $P_{0|0}$ with respect to $\theta_l$, which leads us to that all components of both $\displaystyle\frac {\partial \hat{x}_{0|0}}{\partial \theta_l}$ and $\displaystyle\frac {\partial P_{0|0}}{\partial \theta_l}$ are zeros?

Or should I initialize $\displaystyle\frac {\partial \hat{x}_{0|0}}{\partial \theta_l}$ and $\displaystyle\frac {\partial P_{0|0}}{\partial \theta_l}$ like in Kalman filter by a vector $\displaystyle\frac {\partial \hat{x}_{0|0} }{\partial \theta_l}=[.,.,.]^T$ and a matrix $$\frac {\partial P_{0|0}}{\partial \theta_l}= \begin{pmatrix} . & . & .\\ . & . & .\\ . & . & .\\ \end{pmatrix}\ ?$$

• The exact initial derivatives of the state vector) and the covariance (matrix) should be provided to get e.g., the exact derivative of likelihood. For instance in the stationary case the stationary distribution of the state leads to $x_{1|0}$ and $P_{1|0}$ that depend on the parameters.
– Yves
Commented Jan 17, 2023 at 7:55

We initialize with the derivative of $\frac {\partial \hat{x}_{0|0}}{\partial \theta_l}$ and $\frac {\partial P_{0|0}}{\partial \theta_l}$ wrt. the parameter. So, indeed, if the initial state distribution does not depend on the parameters, we initialize with zeros.
• Could you clarify the wording a bit: you probably meant "with the derivative of $\hat{x}_{0 \mid 0}$ and $P_{0\mid 0}$ wrt.the parameter" ("the derivative of $\frac{\partial \cdot }{\partial \theta}$ wrt the parameter" as written in the answer would be the second derivative of $\cdot$ wrt the parameter...) Commented Jan 13, 2018 at 18:17