Local level (random walk) model
Definition
The local level block describes a random walk component. When the innovation variance is set to 0, it also describes a constant term (known when the initialization is specified, estimated otherwise)
\[l_{t+1} = l_t + \mu_t\] \[\mu_t \sim N(0, \sigma^2 \sigma^2_l)\]It conforms to the general SSF by setting $ T_t = 1 $, $ V_t = \sigma^2\sigma^2_l $.
Depending on the estimation algorithm used, it may be preferrable to slightly modify the model and set $\sigma^2=1$
jd3_ssf_locallevel
R users can use this function to define a local level model that belongs to the JD+ class JD3_SsfItem
output
Object of the JD+ class JD3_SsfItem
:
usage
jd3_ssf_locallevel(name, variance, fixed, initial)
Argument | Definition | Default | Remarks |
---|---|---|---|
name | string with the name of the component | ex. "trend", do not forget the commmas | |
variance | double for the value of $\sigma^2_l$ | 1 | variance of the innovation is actually $\sigma^2\sigma^2_l$ |
fixed | logical that triggers estimation of $\sigma^2_l$ (FALSE) or fixes it (TRUE) to a pre-specified value set by the parameter variance | FALSE | |
initial | double setting the value of $l_0$ | NaN | The default NaN triggers the [diffuse initialization](../algorithms/dk.html) |
Examples of use
jd3_ssf_locallevel("trend")
jd3_ssf_locallevel("trend", variance=1, fixed=FALSE, initial=NaN) // default
jd3_ssf_locallevel("trend", variance=1, fixed=TRUE) // fix variance to 1
jd3_ssf_locallevel("trend", variance=1, fixed=TRUE, initial=0) // fix variance to 1 and initial state to 0
Application 1
In this example we design a model based on a local level specification with default settings (i.e. random walk)
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 and name it as “trend”. In the absence of further arguments, this function
triggers the default specification, which is a random walk without drift:
add(yourModel, jd3_ssf_locallevel("trend"))
Measurement equation design:
Let’s define the following measurement equation (see Measurements)
\[eq1 : y_{t} = l_t + \epsilon_{t}\]where \(\epsilon_{t}\) is I.I.D. with \(var(\epsilon_{t}) =\sigma^2 \sigma^2_{\epsilon}\)
- Let’s assign the name “eq1” to our measurement equation, where the time series called “yourData” (\(y_{t}\)) is
assumed to depend on the factor “trend” (\(l_t\)). By default, the trend enters with coefficient equal to 1.
The I.I.D. measurement error component \(\epsilon\) has a variance equal to zero by
default (i.e. \(var(\epsilon_{t})=\sigma^2 \sigma^2_{\epsilon}\) where \(\sigma^2_{\epsilon} =0\) by default):
eq1 <-jd3_ssf_equation("yourData") add(eq1, "trend")
- Since \(var(\epsilon_{t}) =\sigma^2 \sigma^2_{\epsilon}\) , the measurement error component is
exactly identified by fixing \(\sigma^2_{\epsilon}=1\). However, we have said that the default
specification fixes \(\sigma^2_{\epsilon}=0\) . In order
to impose the restriction \(\sigma^2_{\epsilon}=1\), we use the following notation:
eq1 <-jd3_ssf_equation("yourData",variance=1, fixed = TRUE) ) add(eq1, "trend") add(eq1, "constant")
- By default, the coefficient associated to the factor (trend) is equal to one. In order to relax this assumption
and estimate a different model:
\(eq1 : y_{t} =\alpha \tau_{t} + \epsilon_{t}\),
we use the following arguments:
eq1 <-jd3_ssf_equation("yourData",variance=1, fixed = TRUE) ) add(eq1, "trend", 0.5, FALSE) add(eq1, "constant")
where \(\alpha\) is a free parameter that is set to \(\alpha =0.5\) only for the purposes of initialization.
Application 2 (multivariate)
In this example we design a model with two observables and two factors. The first one is a local level specification with default settings (i.e. random walk) and the second factor is a new local level that degenerates to a constant term.
Thus, we have two different measurements \(y_{1,t}, y_{2,t}\) for the level \(l_t\). The two measurement equations follow:
\(eq1 : y_{1,t} =c_{1} + \alpha_{1} l_{t} + \epsilon_{1,t}\),
\(eq2 : y_{2,t} = \alpha_{2} l_{t} + \epsilon_{2,t}\),
This multivariate model would be specified as follows in R:
// create model
newModel<-jd3_ssf_model()
// specify latent variables
add(newModel, jd3_ssf_locallevel("tau"))
add(newModel, jd3_ssf_locallevel("c1", variance = 0, fixed = TRUE))
// two measurement equations
eq1 <-jd3_ssf_equation("y1",variance=1, fixed = TRUE) )
add(eq1, "tau", 0.5, FALSE)
add(eq1, "c1")
eq2 <-jd3_ssf_equation("y2",variance=1, fixed = FALSE) // by default it would be (variance=0, fixed = TRUE)
add(eq1, "tau", 0.5, FALSE)
In this example, the second equation helps to identify \(c_{1}\). The reason is that the initial value of \(l_{t}\) and \(c_{1}\) in the first equation cannot be separately identified.