Questions tagged [dlm]
dlm refers to the R package for Bayesian and likelihood analysis of dynamic linear models.
86
questions
0
votes
0
answers
18
views
Bivariate State Space Model Using R Package DLM. Modelling correlation
I am trying to estimate a bivariate dynamic linear model. The data are public sector wages and private sector wages in the UK which we can assume are highly correlated. That is, a seemingly unrelated ...
0
votes
0
answers
20
views
overall (allfit) and incremental cumulative association (cumfit) - R Package 'dlnm'
I am conducting research on the impact of between radiation dose and incidence of cancer in radiation epidemiology. To further explore this topic, I would like to utilize distributed lag non-linear ...
0
votes
0
answers
29
views
Building a Multivariate Dynamic Linear Model with Linear Trend and Seasonal Component
Edit. I have made some progress myself, though I have not completely solved the issue. In short, I can fit what I think is a proper description of the model I want, and I can filter it, but I get an ...
1
vote
0
answers
52
views
State Space with Space Lags in R (dlm, MARSS or anything else)
** Edited to reflect on some first comments **
I am trying to estimate a state space model which does a kind of disaggregation. In particular, I am interested in estimating high-frequency unobserved ...
0
votes
0
answers
26
views
Need to replicate random walk with intial value and discount factor
Iam trying to optimize something that has been modeled using Dynamic linear model. The thought process is to forecast the model parameters and also the independents, then check the change in dependent ...
0
votes
0
answers
98
views
Is this the right way to set up a kalman filter in dlm based on random walk?
I have just started learning the filter for forecasting (please be gentle...), as well as the dlm package and its applications. I have the following code stolen from link but instead of ARMA I used a ...
1
vote
1
answer
169
views
Understanding questions regarding the Kalman filter
I have a few questions about the Kalman filter in R (dlm package):
Given the function dlmFilter, there is the output time ...
3
votes
1
answer
342
views
How to visualize results of the distributed lag model using mgcv package
I'm recently reading the book entitled "Generalized Additive Models --- An Introduction with R 2nd edition". When reading chapter 7.4.2--- a distributed lag model for pollution related death,...
1
vote
0
answers
49
views
dlmForecast error : "dlmForecast only works with constant models"
I have a dataset with intervention dummy variable to be incorporated inside the measurement equation (let's call Lambda)
I picture my measurement and state are as below :
measurement : Lambda + Et
...
2
votes
0
answers
93
views
State space model to invert moving average of AR1 process whose mean temporarily jumps up once
This is a follow up query of this question.
Here is the problem statement:
I have an AR1 process say x[t] whose mean jumps up in a given time period.
ie. $x[t]-\mu[t] = \phi (x[t-1] -\mu[t-1]) + \...
0
votes
1
answer
264
views
Using a state space model to invert a moving average
Here is the problem :-
We have an AR(1) process, $x[t]$,
ie,
$(x[t] - \mu) = \phi(x[t-1]-\mu) + \epsilon_x[t] $
where $Var(\epsilon_x[t]) = \sigma_x^2$ and $Mean(\epsilon_x[t])=0$
ie. $x[t] = (\mu - \...
1
vote
0
answers
125
views
How to interpret the coefficients in a time varying linear regression model?
How do I interpret the coefficients in a time varying linear regression model (in particular theta2).
Formula from the book “Dynamic Linear Models with R”
As I understand, at time t theta2 is the ...
1
vote
1
answer
194
views
MLE estimation of mean-adjusted state-space model
I am trying to estimate coefficients of a state-space model described in Diebold et.al (2006) with data and scripts here:
$$y_t = Zf_t + \epsilon_t$$
$$f_t-\mu_t = T(f_{t-1}-\mu)+\eta_t$$
The main ...
0
votes
1
answer
372
views
multivariate seasonal time series in dlm in r
I am trying to build a dynamic linear model in R for my bivariate seasonal (monthly ) time series.
I found the following resources which help me to model bivariate cases but there is no seasonality ...
1
vote
1
answer
790
views
DLM package in R to estimate a state space model with drifts
I am trying to use the DLM package in R to estimate a state space model where the measurement and transition equations are as follows.
The measurement equations are:
$$
\begin{align}
\left(
\begin{...
1
vote
0
answers
323
views
Comparison of fit from OLS, GLS, GLM, ARIMA and DLM
I've been comparing the fit of OLS, GLS, GLM, ARIMA and DLM modelling approaches to my 20 observation time series data set. I had originally done so using RMSE, but wondered whether you could use AIC ...
1
vote
1
answer
154
views
Use of Dyanmic Linear Models in Interrupted Time Series
I've been undertaking research in which I use an Interrupted Time Series [ITS] approach to attempt to quantify the effect of a policy intervention.
An ITS approach segments the data into two periods, ...
1
vote
2
answers
80
views
dlmSmooth increases fluctuations
I am currently working with State Space models for the first time and am trying to estimate an error correction model with an unobserved I(2) process, $\mu_t$. I have specified a model in R using the ...
1
vote
1
answer
136
views
Help with state space model
I am trying to estimate the following state space model:
\begin{equation}
y_t = y^{gap}_{t} + y^*_t
\end{equation}
\begin{equation}
y^{gap}_{t} = \alpha_{1}y^{gap}_{t-1}+\alpha_{3}y^{gap}_{t-2} +\...
2
votes
0
answers
371
views
Dynamic Linear Model (DLM) vs Weighted Linear Regression
In Applied Bayesian Forecasting and Time Series Analysis (1994, page 14), they state:
The passage of time erodes the value of information - sales figures from six months ago are potentially less ...
2
votes
0
answers
96
views
FFBS algorithm for estimating mean log-return parameter in stochastic volatility jump model
I am currently attempting to replicate this model: https://arxiv.org/pdf/1809.01501.pdf in r.
My (first) problem is regarding how to sample from conditional posterior for mu, $(μ_{(j)}|Y_n, J_{(j−1)}...
0
votes
1
answer
493
views
Two time-varying coefficients in Kalman filter with DLM package [closed]
I am trying to estimate a model that has two time varying coefficients in R using the "DLM" package.
My measurement equation would be = Yt = F1tx1t + F2tx2t + v
The state equations are:
F1t = F1t-...
1
vote
1
answer
331
views
Can someone explain me how cumulative association in distributed lag models works?
I'm trying to fit some distributed lag models with dlnm package in R. When I specify cumul=TRUE, I obtain extra parameters ...
2
votes
1
answer
323
views
Parameter estimation in Dynamic Linear Models
I am currently developing a DLM of the following form
$$\underset{k \times 1} {y_t} = \underset{k \times n}A \underset{n \times 1}{\theta_t} + \epsilon_t$$
$$\theta_t = \mu + \underset{n \times n}B\...
1
vote
0
answers
242
views
Multilevel dynamic linear models in R
I am interested in fitting a multilevel bayesian structural time series with a hierarchical structure of the dynamic regression coefficients. The reason I want to do this is is that I have a number of ...
0
votes
1
answer
198
views
Custom Space State model using DLM in R
DLM package in R can model linear space state models of the form:
I have a different category of equation which is also a linear polynomial equation of order 1 with constant coefficients. I would ...
1
vote
0
answers
127
views
Hierarchical time series using DLM
I am developing a forecasting solution using R's dlm package and it is proving to be very useful for most of our requirements.
However, I am also keen on sharing information among different time ...
1
vote
0
answers
115
views
Time varying representation of Okun's law
I've estimated a dynamic linear model to capture time varying parameters in an Okun's law type of model:
I set the starting values for the state vector all equal to zero and estimate the system ...
1
vote
1
answer
306
views
What do the outputs of the function dlmSmooth from R's dlm package mean?
In the vignette for the R package dlm: link on page 12, the author runs the function dlmSmooth to smooth the data and the function returns an object which is ...
1
vote
0
answers
161
views
Unable to recover time varying AR1 parameter from State Space model
I am trying to do a Time varying parameters regression. The equation is as follows:
$y_t = a + b_t * x_{1t} + \epsilon_t$
Here a is fixed while $b_t$ is AR1.
My state space equations are :
There ...
1
vote
1
answer
716
views
Estimating State Space Model Parameters
I'm having a bit of difficulty estimating parameters in DLM in R and I was wondering if I could get a bit of help with it. I have a system of equations given as:
$p_{t} = m_{t} + s_{t}$
$m_{t} = m_{...
1
vote
0
answers
203
views
Parameter estimation using dlmModReg
I am trying to use dlmModReg to estimate the regression coefficient lambda (fixed) of the explanatory variable x (27 zeroes followed by one) as applied to the Nile data. My code is this -
...
10
votes
3
answers
13k
views
Simple explanation of dynamic linear models
I'm looking for a really simple explanation of what a dynamic linear model is as I need to explain this to a non-technical audience. I have looked around for examples but they are very maths heavy.
I ...
7
votes
1
answer
3k
views
Difference between Cholesky decomposition and log-cholesky Decomposition
Is there any difference between a Cholesky decomposition and a log-cholesky decomposition? If yes, what is the difference?
In the paper "An R package for dynamic linear models" by Giovanni Petris ( ...
0
votes
1
answer
1k
views
Convert a state-space model with exogenous input to one without
I have a state space model of the form
\begin{align}
x_{t+1} &= Ax_t + Bu_t + w_t\\
y_t &= Cx_t + Du_t + v_t
\end{align}
where $u$ is the exogenous input. Also, $ w_t \sim N(0, Q)$ and $v_t \...
0
votes
0
answers
573
views
ARIMA model for GDP
I am working through example 3.2.6 in 'Dynamic linear models with R' by Petris. I have download the quarterly deseasonalised USA GDP data located here: http://definetti.uark.edu/dlm/ (it's the data ...
1
vote
0
answers
129
views
Dynamic Linear Models - prior specification
I am using the DLM package to make forecasts for some of my time series.
I wonder how the priors should be elicited. For a Local State space model, one needs to specify the level of data prior to t=1....
3
votes
1
answer
1k
views
DLM representation of ARIMA models
I am working through example 3.2.6 in 'Dynamic linear models with R' by Petris. I have download the USA GDP data located here: http://definetti.uark.edu/dlm/
The example starts by estimating the ...
0
votes
1
answer
399
views
ARIMA in state space and Kalman filter for predicted values [closed]
Given the coefficients of an arima Model
arimaM <- arima(y, order = c(1,0,2), transform.pars = FALSE, fixed = c(0.5,2,1.5,NA))
how can I compute the one step ...
2
votes
0
answers
332
views
Missing data in Gibbs sampling for dynamic linear models
Suppose I have the following DLM:
$x_t = \Phi x_{t-1} + w_t$
$y_t = A x_t + v_t$
$x_0 \sim N(\mu_0,\Sigma_0)$
$w_t \sim N(0,Q)$
$v_t \sim N(0,R)$
Let $\Theta = \{\mu_0,\Sigma_0,\Phi,Q,A,R\}$. I ...
0
votes
1
answer
280
views
Creating DLM object in R : Non symmetric W (error matrix in state equation)
I am using DLM package in R for estimating state space model While creating DLM object in R I am getting the following error
"Error in all.equal(x\$W, t(x\$W)) && all (eigen(x\$W)$values >= 0)...
3
votes
1
answer
363
views
DLM implementation of the mean reverting model
I am trying to use DLM package in R to estimate a state space repersentation of the term structure model, where observation and state equation are as follows
$y(t )= F* x_t +e_t$
$x_t- \mu = G* (x_{...
1
vote
1
answer
3k
views
Normalized data on a rolling window [closed]
I have a whole set of data on [0,T] with an observation variable y(t), and a feature x(t), ...
0
votes
0
answers
112
views
Verifying that dlm is working correctly
I am new to the dlm package and I am writing a simulation to verify that dlm is working correctly.
Here is how I proceed:
I create an AR1 series with parameters $\phi$ and $\sigma^2$. Then I try to ...
0
votes
1
answer
1k
views
multi-factor time-varying CAPM using kalman filter
I am trying to implement a time-varying CAPM model using the kalman filter.
I have already found numerous examples in R and python using the DLM and the pykalman packages but the problem is that they ...
2
votes
0
answers
96
views
Correct way of building a confidence interval
My AR(1) model is $y_t = \phi y_{t-1} + \epsilon_t \quad where \quad \epsilon_t \sim \mathcal{N}(0,1) $
Here $\sigma^2 = Var(\epsilon_t) = 1$
Basically in this code I generate random values for phi ...
0
votes
1
answer
605
views
Difference between Dynamic Factor Model (DFM) and Dynamic Linear Model (DLM)
one simple question: what is the difference between a Dynamic Factor Model (DFM) and a Dynamic Linear Model (DLM) ?
1
vote
0
answers
1k
views
How does the dlmMLE function work?
How does the dlmMLE in package dlm in R work?
Are the maximum likelihood estimates coming from the Kalman filter or by numerical optimization. If it is using numerical optimization,what is the ...
1
vote
1
answer
179
views
Model approach for extending Dynamic Linear Models - Nested Regression Relationships
I have three multivariate random variables $X_t$, $Y_t$, and $Z_t$.
I have been very happily modeling the relationship between $Y_t$ and $X_t$ through a dynamic linear model
$$Y_t = X_t\beta_t + ...
0
votes
0
answers
450
views
Different AIC values using lm, dlm and dlmodeler
I would like to compare a model with time varying slope coefficient to a model with constant slope coefficient. In order to do this, I use the R package "dlm" to set up the models and calculate the ...