# Mdp1 _sciences_
## 2 Methods and Data
### Forecasting Methods  
The prediction methods previously mentioned use the standard formulation of Kalman Filters (KF), which implies that wind speed observations are assumed to have Gaussian noise. KF is a recursive estimation algorithm capable of predicting future states of a system based on a previous state. The standard KF formulation is as follows [41]:  
\[\mathbf{x}(k+1) = \mathbf{Ax}(k)+\mathbf{B}\mathbf{u}(k)+\mathbf{w}(k) \tag{16}\] \[\mathbf{y}(k) = \mathbf{Cx}(k)+\mathbf{v}(k),\]  
where \(\mathbf{x}\in\Re^{n}\), \(\mathbf{u}\in\Re^{m}\), and \(\mathbf{y}\in\Re^{p}\) are the state vector, the input vector, and the vector of measured output signals, respectively; \(\mathbf{w}\) is the vector of the state noise; \(\mathbf{v}\) denotes the measurement noise. Note that the letters \(\mathbf{x}\) and \(\mathbf{y}\) used for the state and the output vectors are not to be confused with the variables \(x\) and \(y\) (identifying wind speed or power changes for the first and second forecast interval, respectively) of the previous section. Noise vectors are independent Gaussian processes with the following properties:  
\[E\bigg{[}\bigg{(} \begin{array}{c}\mathbf{w}(k)\\ \mathbf{v}(k)\end{array} \bigg{)}\bigg{]} = \mathbf{0} \tag{17}\] \[E\bigg{[}\bigg{(} \begin{array}{c}\mathbf{w}(k)\\ \mathbf{v}(k)\end{array} \bigg{)}\big{(} \begin{array}{c}\mathbf{w}^{\prime }(l)\\ \mathbf{w}^{\prime}(l)\end{array} \mathbf{v}^{\prime}(l)\big{)}\bigg{]} = \bigg{(} \begin{array}{c}\mathbf{Q}_{w}&\mathbf{Q}_{wv}\\ \mathbf{Q}^{\prime\prime}_{wv}&\mathbf{Q}_{v}\end{array} \bigg{)}\delta_{kl}.\]  
Figure 2: Geometric interpretation of the condition for the detection of incompliance events (\(y<-a\)). (**a**) Detection region \(\mathbb{D}_{\text{TP}}\) and lost area in the coordinate space spanned by the true wind speed changes (horizontal axis) and the forecast error (vertical axis). (**b**) Non-correlated joint probability distributions. (b.1) Similar variability of changes and forecast errors. (b.2) Forecasts errors about half the size of the variations. (**c**) Negatively correlated forecast errors and wind speed changes. The problem to be solved consists in estimating the system's state from the previously observed values:  
\[\left[ \begin{array}{ccccc}y(k-k_{0})&y(k-k_{0}+1)&\ldots&y(k-1)&y(k)\\ u(k-k_{0})&u(k-k_{0}+1)&\ldots&u(k-1)&u(k)\end{array} \right].\]  
It is convenient to define _a priori_ state estimation \(\hat{\uppi}^{-}\in\Re^{n}\) at step \(k\), given knowledge prior to step \(k\) of the observed values of \(\mathbf{y}\) and \(\mathbf{u}\), and a posteriori state estimate at step \(k\), \(\hat{\uppi}\in\Re^{n}\) given the measurement of \(\mathbf{y}(k)\). A priori and a posteriori errors are defined as follows:  
\[\mathbf{e}^{-}(k) = \mathbf{x}(k)-\hat{\uppi}(k)^{-} \tag{18}\] \[\mathbf{e}(k) = \mathbf{x}(k)-\hat{\uppi}(k). \tag{19}\]  
A priori estimate error covariance and a posteriori estimate error covariance are calculated as follows:  
\[\mathbf{P}^{-}(k) = E\Big{[}\mathbf{e}(k)^{-}\mathbf{e}^{T}(k)^{-}\Big{]}, \tag{20}\] \[\mathbf{P}(k) = E\Big{[}\mathbf{e}(k)\mathbf{e}^{T}(k)\Big{]}. \tag{21}\]  
A formulation for the posteriori state estimation can then be written as:  
\[\hat{\uppi}(k)=\hat{\uppi}(k)^{-}+\mathbf{K}(k)\big{(}\mathbf{y}(k)-\mathbf{ C}\hat{\uppi}(k)^{-}\big{)}, \tag{22}\]  
which resembles a state observer. The gain \(\mathbf{K}(k)\) is also called blending factor, and its purpose is to minimize the a posteriori error covariance, Equation (21). This optimization procedure, the details of which are not presented here for brevity, can be conducted by substituting Equation (22) into the definition of the error, Equation (19), performing the corresponding expectation operations, taking the derivative of the trace of the result with respect to \(\mathbf{K}\), setting the result equal to zero and finally solving the equation for \(\mathbf{K}\).