Local linear trend model

Definition

The local linear trend block describes the following trend component:

\[l_{t+1} = l_t + n_t + \xi_t\] \[n_{t+1} = n_t + \mu_t\] \[\xi_t \sim N(0, \sigma^2\sigma^2_l)\] \[\mu_t \sim N(0, \sigma^2\sigma^2_n)\]

It conforms to the general SSF by setting the state vector

\[\alpha_t=\begin{pmatrix} l_t \\ n_t \end{pmatrix}\]

and the transition matrices

\[T_t = \begin{pmatrix} 1 && 1 \\ 0 && 1 \end{pmatrix}\] \[V_t = \begin{pmatrix} \sigma^2\sigma^2_l && 0 \\ 0 && \sigma^2\sigma^2_n \end{pmatrix}\]

Depending on the estimation algorithm used, it may be preferrable to slightly modify the model and set $\sigma^2=1$

jd3_ssf_locallineartrend


R users can use this function to define local linear trend model that belongs to the JD+ class JD3_SsfItem

output

Object of the JD+ class JD3_SsfItem:

usage

jd3_ssf_locallineartrend(name, levelVariance, slopevariance, fixedLevelVariance, fixedSlopeVariance )

Argument Definition Default Remarks
name string with the name of the component ex. "trend", do not forget the commmas
levelVariance double for the value of $\sigma^2_l$ 1 variance of the level innovation is actually $\sigma^2\sigma^2_l$
slopeVariance double for the value of $\sigma^2_n$ 0.01 variance of the slope innovation is actually $\sigma^2\sigma^2_n$
fixedLevelVariance logical that triggers estimation of $\sigma^2_l$ (FALSE) or fixes it (TRUE) to a pre-specified value set by the parameter levelVariance FALSE
fixedSlopeVariance logical that triggers estimation of $\sigma^2_n$ (FALSE) or fixes it (TRUE) to a pre-specified value set by the parameter slopeVariance FALSE

Examples of use

jd3_ssf_locallineartrend("trend")
jd3_ssf_locallineartrend("trend", levelVariance=1, slopeVariance=0.001,fixedLevelVariance=FALSE, fixedSlopeVariance=FALSE) // default
jd3_ssf_locallineartrend("trend", levelVariance=1, slopeVariance=0.001,fixedLevelVariance=TRUE, fixedSlopeVariance=FALSE) // default

Application

In this example we design a model based on a random walk with drift specification.

Create Model:

  • The very first thing one needs to do is to create the model object, which will be called “yourModel”:
    yourModel<-jd3_ssf_model()
    

Specify latent variables (transition equations):

  • Second, we add our random walk with drift and name it as “trend”. We fix the slope variance to zero in order to ensure that this component becomes a constant. In the absence of further arguments the variance of the level is not specified among the arguments and it is therefore the only parameter to estimate (by default, fixedLevelVariance=FALSE):
    add(yourModel, jd3_ssf_locallineartrend("trend", slopeVariance=0, fixedSlopeVariance=TRUE) )
    

Measurement equation design:

Let’s define the following measurement equation (see Measurements)

\[eq1 : y_{t} = l_t + \epsilon_{1,t}\] \[eq2 : y_{t+h|t} = l_t + h c + \epsilon_{2,t}\]

The first equation represents an observed variable $y_{t}$ that measures (with an error $\epsilon_{1,t}$) the latent factor $l_t $, which is assumed to follow a random walk with drift. The second variable represents a h-steps ahead forecast for $y_{t}$, which is given by the h-steps ahead forecast of the trend $l_t + h c $. Note that $l_t$ and $n_{t}=c$ are the two elements of the state vector in the local linear trend model defined above. The subindex $t$ in $n_{t}$ in not necessary because we have set the slopeVariance to zero and therefore this term is constant over time (i.e. it represents the constant drift component).

  • Let’s assign the names “eq1” and “eq2” to our measurement equations, where the time series are called “y” ($ y_{t} $) and “yh” ($ y_{t+h|t} $) The I.I.D. measurement error component \(var(\epsilon_{1,t})=\sigma^2 \sigma^2_{\epsilon_1}\) will be identified using the normalization assumption that \(\sigma^2_{\epsilon_{1}}=1\). In turn, \(var(\epsilon_{2,t})\) is left unrestricted.
    eq1 <-jd3_ssf_equation("y", variance=1, fixed=TRUE)                            
    add(eq1, "trend")                                         
    eq2 <-jd3_ssf_equation("yh", variance=1, fixed=FALSE)                            
    add(eq2, "trend", jd3_ssf_loadings(c(1,2),c(1,h)) )