Displaying 20 results from an estimated 600 matches similar to: "using dlmModPoly in library dlm"
2014 Jan 08
0
Strange behaviour of `dlm` package
Dear R-help!
I have encountered strange behaviour (that is, far-off filtering, smoothing
and forecast distributions under certain conditions) in the `dlm` package by
Giovanni Petris.
Here is an example:
I use the annual hotel bookings time series data, which I model using a
second order polinomial DLM.
First I perform the analysis with the data in logarithmic form and
everything seems to be
2009 Mar 11
1
Forecasting with dlm
Hi All,
I have a problem trying to forecast using the dlm package, can anyone offer
any advise?
I setup my problem as follows, (following the manual as much as possible)
data for example to run code
CostUSD <- c(27.24031,32.97051, 38.72474, 22.78394, 28.58938, 49.85973,
42.93949, 35.92468)
library(dlm)
buildFun <- function(x) {
dlmModPoly(1, dV = exp(x[1]), dW = exp(x[2]))
}
fit <-
2009 May 10
1
Help with kalman-filterd betas using the dlm package
Hi all R gurus out there,
Im a kind of newbie to kalman-filters after some research I have found that
the dlm package is the easiest to start with. So be patient if some of my
questions are too basic.
I would like to set up a beta estimation between an asset and a market index
using a kalman-filter. Much littarture says it gives superior estimates
compared to OLS estimates. So I would like to
2011 Nov 18
0
Kalman Filter with dlm
I have built a Kalman Filter model for flu forecasting as shown below.
Y - Target Variable X1 - Predictor1 X2 - Predictor2
While forecasting into the future, I will NOT have data for all three
variables. So, I am predicting X1 and X2 using two Kalman filters. The code
is below
x1.model <- dlmModSeas(52) + dlmModPoly(1, dV=5, dW=10)
x2.model <- dlmModSeas(52) + dlmModPoly(1, dV=10,
2013 Feb 20
1
Tracking time-varying objects with the DLM package (dynamic linear models in R)
Hello all,
I am working with the dlm package, specifcially doing a dlm multivariate Y
linear regression using
dlmModReg and dlmFilter and dlmSmooth...
I have altereted the inputs into dlmModReg to make them time-varying using
JFF, JW etc.
How do I track the results of the time varying system matrices?
For example what I am really interested in is JW - my system variance matrix
for each time
2012 Jan 23
0
problems with dlmBSample of the dlm package
Dear R users,
I am trying to use the dlm package, and in particular the dlmBSample function.
For some reason that I am not able to understand, this function does not work properly and the plot of the result does not make sense, while dlmFilter works perfectly.
I think that my_mod is correct, because the output of my_dlmFilter$mod is fine. Where is my mistake or my misunderstanding?
This is the
2011 Jun 03
0
Package dlm generates unstable results?
Hi, All,
This is the first time I seriously use this package. However, I am confused that the result is quite unstable. Maybe I wrote something wrong in the code? So could anybody give me some hint? Many thanks.
My test model is really simple.
Y_t = X_t * a_t + noise(V),(no Intercept here)
a_t = a_{t-1} + noise(W)
I first run the following code: (I shall provide data at the end of the
2011 Jun 30
0
Specifying State Space model to decompose structural shocks
Dear all:
Greetings!
I am trying to replicate a simple state space model in R, using the
package 'dlm'. This model has two observation equations and three
state equations. Each observation equation represents structural
shocks based on SVAR for country i, where i=1 to 2. The structural
shocks (S1 and S2) are to be decomposed into common (sv1) and
country-specific (sv2, sv3) shocks. We
2007 Nov 28
0
Package dlm version 0.8-1
I uploaded a new version of package dlm to CRAN.
dlm provides functions for maximum likelihood, Kalman filtering and
smoothing, and Bayesian analysis of Gaussian linear state space
models, also known as Dynamic Linear Models.
The most important visible changes from the previous version are the
following.
1) Missing values are now allowed in the observations.
2) Extractor and replacement
2007 Nov 28
0
Package dlm version 0.8-1
I uploaded a new version of package dlm to CRAN.
dlm provides functions for maximum likelihood, Kalman filtering and
smoothing, and Bayesian analysis of Gaussian linear state space
models, also known as Dynamic Linear Models.
The most important visible changes from the previous version are the
following.
1) Missing values are now allowed in the observations.
2) Extractor and replacement
2011 Jun 03
0
How to reconcile Kalman filter result (by package dlm) with linear regression?
Hello All,
I am working with dlm for the purpose of estimating and forecasting with a Kalman filter model. I have succesfully set up the model and started generating results. Of course, I need to somehow be sure that the results make sense. Without any apparent target to compare with, my natural selection is the results by odinary least square. The idea being that if I choose a diffuse prior,
2011 Jul 29
0
dlmSum(...) and non-constant state space models
Hello,
I would be very grateful if somebody more knowledgeable then me could assist
me in the following.
I have two (three actually but for simplicity I will say two) models which I
would like to fit jointly as a state space object. Here are the equations:
(1)
w = a1 + b1*(p) + e1
a1 = a1[t-1] + g1
g1 = g1[t-1] + e2
b1 = b1[t-1] + e3
(2)
d = a2 + b2*(w) + e3
a2 = a2[t-1] + e4
b2 = b2[t-1] + e5
2009 Feb 15
0
Kalman Filter - dlm package
Dear all,
I am currently trying to use the "dlm" package for Kalman filtering.
My model is very simple:
Y_t = F'_t Theta_t + v_t
Theta_t = G_t Theta_t-1 + w_t
v_t ~ N(0,V_t) = N(0,V)
w_t ~ N(0,W_t) = N(0,W)
Y_ t is a univariate time series (1x1)
F_t is a vector of factor returns (Kx1)
Theta_t is the state vector (Kx1)
G_t is the identity matrix
My first
2012 May 09
1
Sweave, beamer and alert within code chunks
Hi all,
Using Beamer, in order to highlight a piece of R code I do something
like this - note the "\structure" and "\alert" commands:
\begin{semiverbatim}
> mleOut <- \structure{dlmMLE}(Nile,
+ parm = c(0.2, 120), # initial values for optimizer
+ lower = c(1e-7, 0)) \alert<2>{# V must be positive}
> mleOut$convergence
2011 Jun 07
2
Setting up a State Space Model in dlm
This question pertains to setting up a model in the package "dlm"
(dynamic linear models,
http://cran.r-project.org/web/packages/dlm/index.html
I have read both the vignette and?"An R Package for Dynamic Linear
Models" (http://www.jstatsoft.org/v36/i12/paper), both of which are
very helpful. There is also some discussion at
2010 Sep 28
0
Time invariant coefficients in a time varying coefficients model using dlm package
Dear R-users,
I am trying to estimate a state space model of the form
(1) b_t = G * b_t-1 + w_t w_t ~ N(0,W)
(2) y_t= A' * x_t + H' * b_t + v_t v_t ~ N(0,V)
(Hamilton 1984: 372)
In particular my estimation in state space form looks like
(3) a3_t = 1 * a3_t-1 + w_t w_t ~ N(0,W)
(4) g_t = (a1, a2) * (1, P_t)' + u_t * a3_t + v_t v_t ~ N(0,V)
where g_t is the
2018 Mar 26
0
"dlm" Package: Calculating State Confidence Intervals
To Whom It May Concern,
I estimated a model with 6 states (3 time-varying Regression parameters and 3 quarterly seasonality trends). The model is saved in the object titled "mod."
Following the example in the documentation and using the commands below, I am attempting to use the function "dlmSvd2var" to implement SVD and calculate the 90% confidence errors for each
2018 Mar 28
0
"dlm" Package: Calculating State Confidence Intervals
To Whom It May Concern,
I estimated a model with 6 states (3 time-varying Regression parameters and 3 quarterly seasonality trends). The model is saved in the object titled "mod."
Following the example in the documentation and using the commands below, I am attempting to use the function "dlmSvd2var" to implement SVD and calculate the 90% confidence errors for each
2012 May 25
1
question about TryCatch and lapply
Folks:
I've replaced an outer for-loop with lapply and it works great. But, I
can't seem to do the following type of exception handling:
tryCatch(dlmMLE(x)$value==Inf,error = function(e) NULL)
which basically says if the likelihood is Inf, throw an error. But what I
want it to do is just go to the next index in the list. When I was using a
for-loop I used:
2005 Jun 15
1
Kalman Filtering?
1. The function "KalmanLike" seems to change its inputs AND
PREVIOUSLY MADE copies of the inputs. Consider the following (using R
2.1.0 patched under Windows XP):
> Fig2.1 <- StructTS(x=Nile, type="level")
> unlist(Fig2.1$model0[2:3])
a P
1120 286379470
> tst2 <- tst <- Fig2.1$model0
> tst23 <- tst[2:3]
> tst23u <-