You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case study we are going to forecast the paths of hurricanes by applying several State Space Models (SSM). We will begin with a simple two-dimensional constant acceleration tracking model, where we only have one parameter to estimate. Subsequently, we will progressively add complexity and parameters as we develop up our model.
29
29
30
30
As a brief introduction to SSMs, the general idea is that we define our system using two equations.<br>
31
-
The state equation [1] and the observation equation [2]. $$x_{t+1} = A_{t}x_{t} + c_{t} + R_{t}\epsilon_{t} \quad [1]$$$$y_{t} = Z_{t}x_{t} + d_{t} + \eta_{t} \quad [2] $$
31
+
The state equation [1] and the observation equation [2].
The process/state covariance is given by $\epsilon_{t} \sim N(0, Q_{t})$ where $Q_{t}$ is the process/state innovations and the observation/measurement covariance is given by $\eta_{t} \sim N(0, H_{t})$ where $H_{t}$ describes the uncertainty in the measurement device or measurement procedure.
34
41
@@ -675,39 +682,81 @@ The simplest state space model for tracking an object in 2-dimensional space is
675
682
Let us begin by defining our matrices/vectors.
676
683
677
684
As a reminder the observation equation and the state equation define our linear system.
In this case we are assuming there is no state or observation intercepts ($c_{t} = 0$, $d_{t} = 0$). I will also drop the $t$ subscript over matrices that are fixed (do not change over time).
681
694
682
695
Our states are the following components derived from the Newtonian equations of motion.
Z = \begin{bmatrix}1&0&0&0&0&0 \\ 0&1&0&0&0&0 \end{bmatrix}
711
+
$$
690
712
691
713
The selection matrix is defined as the identity allowing the process/state covariance to affect all of our states.
692
-
$$R = I$$
714
+
715
+
$$
716
+
R = I
717
+
$$
718
+
693
719
Where
694
-
$$\epsilon_{t} \sim N(0, Q)$$
695
-
$$\eta_{t} \sim N(0, H)$$
720
+
721
+
$$
722
+
\epsilon_{t} \sim N(0, Q)
723
+
$$
724
+
725
+
$$
726
+
\eta_{t} \sim N(0, H)
727
+
$$
696
728
697
729
In this example we fix our observation/measurement error to a small value (0.5) reflecting our confidence in the measurements. Here we are assuming that our measuring instrument is fairly accurate and that it may be off by $\sqrt{0.5} \approx 0.7$ degrees.
Let's briefly go over how we came about our $A$ and $Q$ matrices.
705
742
706
743
The $A$ transition matrix is built such that when we expand the observation model we end up with the Newtonian equations of motion. For example, if we expand the matrix vector multiplaction for the longitude (position) term we end up with:
707
-
$$\hat{y}_{longitude_{t+1}} = longitude_{t} + longitude\_velocity_{t}\Delta t + \frac{longitude\_acceleration_{t}\Delta t^{2}}{2} $$
744
+
745
+
$$
746
+
\hat{y}_{longitude_{t+1}} = longitude_{t} + longitude\_velocity_{t}\Delta t + \frac{longitude\_acceleration_{t}\Delta t^{2}}{2}
747
+
$$
748
+
708
749
This is the Newtonian motion equation of position. Where the new position is the old position plus the change in velocity plus the change in acceleration. The rest of the equations can be derived by completing all the entries of the matrix vector multiplication of the observation equation.
709
750
710
-
The process/state covariance matrix $Q$ is just the variance (diagonals) covariance (off-diagonals) of the Newtonian equations. For example, the variance of the longitudinal position entry is: $$Var(longitude_{t}) = Var(longitude_{t} + longitude\_velocity_{t}\Delta t + \frac{longitude\_acceleration_{t}\Delta t^{2}}{2}) = Var(\frac{longitude\_acceleration_{t}\Delta t^{2}}{2}) $$$$= \frac{\Delta t^{4}}{4}Var(longitude\_acceleration_{t}) = \frac{\Delta t^{4}}{4}\sigma_{a}^{2} $$
751
+
The process/state covariance matrix $Q$ is just the variance (diagonals) covariance (off-diagonals) of the Newtonian equations. For example, the variance of the longitudinal position entry is:
Where in this case we assume the same stochastic innovations on the acceleration term in both dimensions. You can derive the rest of the entries in $Q$ by taking the variance or covariance of the Newtonian equations.
713
762
@@ -718,11 +767,33 @@ We can also derive the Newtonian equations of motion from a system of ordinary d
718
767
2. $\dot{v}(t) = a(t)$
719
768
3. $\dot{a}(t) = 0$
720
769
721
-
our state vector (in one dimension) $$x_{t} = \begin{bmatrix}p(t) \\ v(t) \\ a(t) \end{bmatrix} $$ and our ODE system becomes $$\frac{d}{dt} \begin{bmatrix}p(t) \\ v(t) \\a(t) \end{bmatrix} = \begin{bmatrix}v(t) \\ a(t) \\ 0 \end{bmatrix} $$
Now we integrate our system over $\Delta{t}$ and we have $$p(t + \Delta{t}) = p(t) + \int_{t}^{t + \Delta{t}}v(t')dt'$$ assuming that the change in time is small and that the change in velocity is negligible we can approximate the integrals using the forward Euler method and get $$p(t + \Delta{t}) \approx p(t) + v(t)\Delta{t} $$ integrating the rest of our system equations using the same methodology we find that $$ v(t + \Delta{t}) \approx v(t) + a(t)\Delta{t} $$$$ a(t + \Delta{t}) = a(t) $$
776
+
Now we integrate our system over $\Delta{t}$ and we have $$p(t + \Delta{t}) = p(t) + \int_{t}^{t + \Delta{t}}v(t')dt'$$ assuming that the change in time is small and that the change in velocity is negligible we can approximate the integrals using the forward Euler method and get
724
777
725
-
We can now express our system of equations over a time interval $\Delta{t}$ as $$ \begin{bmatrix}p(t + \Delta{t}) \\ v(t + \Delta{t}) \\ a(t + \Delta{t}) \end{bmatrix} = \begin{bmatrix}p(t) \\ v(t) \\ a(t) \end{bmatrix} + \Delta{t} \begin{bmatrix}v(t) \\ a(t) \\ 0 \end{bmatrix} $$
778
+
$$
779
+
p(t + \Delta{t}) \approx p(t) + v(t)\Delta{t}
780
+
$$
781
+
782
+
integrating the rest of our system equations using the same methodology we find that
783
+
784
+
$$
785
+
v(t + \Delta{t}) \approx v(t) + a(t)\Delta{t}
786
+
$$
787
+
788
+
$$
789
+
a(t + \Delta{t}) = a(t)
790
+
$$
791
+
792
+
We can now express our system of equations over a time interval $\Delta{t}$ as
In our dataset we have variables that aren't a part of the Newtonian system process, but may carry information that we can leverage to better track the path of the hurricane. We have two options when introducing these exogenous variables into our model. We can add them in as time invariant or time-varying variables. In our case, we are going to add exogenous variables as time invariant. Our aim then is to model our observations as:
The `max_wind` variable measures the maximum sustained surface wind at 10 meter elevations and is a uni-dimensional measure (i.e not measured in terms of longitude and latitude). Therefore, we are going to use the same data to estimate two-parameters $\beta_{wind_{longitude}}$ and $\beta_{wind_{latitude}}$. This is less than ideal but demonstrates how to add exogenous variables to a `StateSpace` model.
961
1037
962
1038
The `min_pressure` variable measures the minumum central pressure. The lower the central pressure, typically, the more intense the hurricane. This variable again is only measured in one dimension, so we will handle that the same way we are handling it for `max_wind`.
963
1039
964
1040
Finally, we will also include the interaction between the maximum sustained surface wind and the minimum central pressure.
965
1041
966
-
In order to put this in matrix form, we are going to add the newly added $\beta$ parameters to our state vector and we will add the corresponding measured `wind_speed`, `min_pressure`, and `interaction_wind_pressure` data into the design matrix. So our new state vector will be: $$x_{t} = \begin{bmatrix}longitude_{t} \\ latitude_{t} \\ longitude\_velocity_{t} \\ latitude\_velocity_{t} \\ longitude\_acceleration_{t} \\ latitude\_acceleration_{t} \\ \beta_{wind_{longitude}} \\ \beta_{wind_{latitude}} \\ \beta_{pressure_{longitude}} \\ \beta_{pressure_{latitude}} \\ \beta_{wind\_pressure_{longitude}} \\ \beta_{wind\_pressure_{latitude}} \end{bmatrix} $$
1042
+
In order to put this in matrix form, we are going to add the newly added $\beta$ parameters to our state vector and we will add the corresponding measured `wind_speed`, `min_pressure`, and `interaction_wind_pressure` data into the design matrix. So our new state vector will be:
and our design matrix will be: $$ Z' = \begin{bmatrix} Z & X_{exogenous\_data} \end{bmatrix} $$ Where $Z$ is our previously defined design matrix and $X_{exogenous}$ is the measured `wind_speed`, `minimum_pressure`, and `interaction_wind_pressure` exogenous data.
1050
+
$$
1051
+
Z' = \begin{bmatrix} Z & X_{exogenous\_data} \end{bmatrix}
1052
+
$$
1053
+
1054
+
Where $Z$ is our previously defined design matrix and $X_{exogenous}$ is the measured `wind_speed`, `minimum_pressure`, and `interaction_wind_pressure` exogenous data.
969
1055
970
1056
We also need to make adjustments to our $A$ state transition matrix and $R$ selection matrix.
The last 2 columns we added indicates what states our exogenous variables affect, and the last 2 rows indicate that the processes of our exogenous parameters are constant.
Our new models' structure is going to be similar to our last model that had exogenous variables. However, in this case our data are going to be the basis functions we created earlier. These will be inserted into our design matrix ($Z$) and the beta parameters corresponding to each spline will be added to our state vector ($x_{t}$). Again, these parameters will be constant (non-time varying). We will also have to adjust our transition matrix ($T$) and selection matrix ($R$) similar to how we did previously. We will now have:
Where $Z$ is our previously defined design matrix and $X_{exogenous}$ are the basis functions we defined earlier.
1441
1543
1442
-
our design matrix will be: $$ Z' = \begin{bmatrix} Z & X_{basis\_functions} \end{bmatrix} $$ Where $Z$ is our previously defined design matrix and $X_{exogenous}$ are the basis functions we defined earlier.
1544
+
Our transition matrix will be
1443
1545
1444
-
Our transition matrix will be $$T' = \begin{bmatrix} T & F \\ 0 & I_{n\_spline\_params} \end{bmatrix} $$
1546
+
$$
1547
+
T' = \begin{bmatrix} T & F \\ 0 & I_{n\_spline\_params} \end{bmatrix}
1548
+
$$
1445
1549
1446
1550
Where $T$ is the transition matrix defined for the Newtonian kinematics (the top-left 6x6 block in our previous model)
1447
-
and $$ F = \begin{bmatrix} 1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0 \\ 0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1&0&1 \\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0 \\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0 \\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0 \\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0 \end{bmatrix} $$
0 commit comments