Displaying 20 results from an estimated 200 matches similar to: "dlm package: how to specify state space model?"
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
2008 May 07
1
dlm with constant terms
Hi,
I am trying to figure how to use dlm with constant terms
(possibly time-dependent) added to both equations
y_t = c_t + F_t\theta_t + v_t
\theta_t = d_t + G_t\theta_{t-1} + w_t,
in the way that S-PLUS Finmetrics does?
Is there any straightforward way to transform the above to
the default setup?
Thanks,
Tsvetan
--------------------------------------------------------
NOTICE: If received in
2005 Dec 14
1
Kalman Filter Forecast using 'SSPIR'
Dear R Users,
I am new to state-space modeling. I am using SSPIR
package for Kalman Filter. I have a data set containing one dependent
variable and 7 independent variables with 250 data points. I want to use
Kalman Filter for forecast the future values of the dependent variable
using a multiple regression framework. I have used ssm function to
produce the state space (SS)
2013 Jan 03
2
simulation
Dear R users,
suppose we have a random walk such as:
v_t+1 = v_t + e_t+1
where e_t is a normal IID noise pocess with mean = m and standard deviation = sd and v_t is the fundamental value of a stock.
Now suppose I want a trading strategy to be:
x_t+1 = c(v_t – p_t)
where c is a costant.
I know, from the paper where this equations come from (Farmer and Joshi, The price dynamics of common
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
2007 Nov 24
0
Help on State-space modeling
Hi all,
I'm working on a term structure estimation using state-space modeling for
1, 2 and 3 factor models.
When I started to read the functions on R, I got to the function ss on the
library sspir. From what I
understood this function is similar to SsfFit from S-PLUS. But for my models
purpose there is something
left to be desired. Its formulation follow these equations:
*Y_t = F_t^T *
2006 Apr 29
1
SSPIR problem
I am having a problem with the package SSPIR. The code below
illustrates it. I keep getting the message: "Error in y - f :
non-conformable arrays."
I tried to tweak the code below in many different ways, for example,
substituting rbind for cbind, and sometimes I get a different error
message, but I could not find a variation of this code that would
work.
Any help will be greatly
2006 Dec 20
2
Kalman Filter in Control situation.
I am looking for a Kalman filter that can handle a control input. I thought
that l.SS was suitable however, I can't get it to work, and wonder if I am
not using the right function. What I want is a Kalman filter that accepts
exogenous inputs where the input is found using the algebraic Ricatti
equation solution to a penalty function. If K is the gain matrix then the
exogenous input
2007 Feb 21
1
loops in R help me please
I am trying to make the following Kalman filter equations work and therefore produce their graphs.
v_t=y_t - a_t
a_t+1=a_t+K_t*v_t
F_t=P_t+sigma.squared.epsilon
P_t+1=P_t*(1-K_t)+sigma.squared.eta
K_t=P_t/F_t
Given:
a_1=0,P_1=10^7,sigma.squared.epsilon=15099,
sigma.squared.eta=1469.1
I have attached my code,which of course doesnt work.It produces NAs for the Fs,Ks and the a.
Can somebody tell me
2010 Jun 26
4
optim() not finding optimal values
I am trying to use optim() to minimize a sum-of-squared deviations function based upon four parameters. The basic function is defined as ...
SPsse <- function(par,B,CPE,SSE.only=TRUE) {
n <- length(B) # get number of years of data
B0 <- par["B0"] # isolate B0 parameter
K <- par["K"]
2009 Apr 26
1
simulate arima model
I am new in R.
I can simulate Arma, using Arima.sim
However, I want to simulate an Arima Model. Say (1-B)Zt=5+(1-B)at. I do not
know how to deal with 5 in this model.
Can any one could help me?
Thank you very much!
Regards,
--
View this message in context: http://www.nabble.com/simulate-arima-model-tp23239027p23239027.html
Sent from the R help mailing list archive at Nabble.com.
2012 Apr 30
2
The constant part of the log-likelihood in StructTS
Dear all,
I'd like to discuss about a possible bug in function StructTS of stats
package. It seems that the function returns wrong value of the
log-likelihood, as the added constant to the relevant part of the
log-likelihood is misspecified. Here is an simple example:
> data(Nile)
> fit <- StructTS(Nile, type = "level")
> fit$loglik
[1] -367.5194
When computing the
2003 Nov 26
3
Correlation test in time series
I would like to know if there is a way to test no correlaction
in time series ?
cov(r_t, r_t-1)=0
And r_t are homoscedastik and independent.
Thanks
[[alternative HTML version deleted]]
2013 Mar 21
1
missing space in R version specifier makes PACKAGES file unreadable by install.packages()
Hi,
After updating to R-3.0 beta r62328, I get the following:
> install.packages("Biobase", type="source", repos="http://george2/BBS/2.12/bioc")
Error in do.call(op, list(v_c, v_t[[op]])) :
could not find function "R (>=2.15.1)"
The problem can be fixed by adding a space after >= in the offending
package's DESCRIPTION file and re-generating
2007 Aug 07
1
Functions for autoregressive Regressionmodels (Mix between times series and Regression Models) ?
Hello everybody,
I've a question about "autoregressive Regressionmodels".
Let Y[1],.....,Y[n], be a time series.
Given the model:
Y[t] = phi[1]*Y[t-1] + phi[2]*Y[t-1] + ... + phi[p]*Y[t-p] + x_t^T*beta + u_t,
where x_t=(x[1t],x[2t],....x[mt]) and beta=(beta[1],...,beta[m]) and u_t~(0,1)
I want to estimate the coefficients phi and beta.
Are in R any functions or packages for
2012 Oct 23
1
scatterplot with wrong line offset
Hi All,
I'm trying to do a Scatterplot (package: car), and add a line (just for
reference).
There is my code:
#------------------------------------Code---------------------------------------------------
library("car")
library("calibrate")
G_T<-c("car","bike","boat")
ave<-c(80,10,45)
perf<-c(100,80,75)
df2<-data.frame(G_T,ave,perf)
2010 Aug 23
1
Fitting a GARCH model in R
Hi,
I want to fit a mean and variance model jointly.
For example I might want to fit an AR(2)-GARCH(1,1) model i.e.
r_t = constant_term1 + b*r_t-1 + c*r_t-2 + a_t
where a_t = sigma_t*epsilon_t
where sigma^2_t = constant_term2 + p*sigma^2_t-1 + q*a^2_t-1
i.e. R estimates a constant_term1, b, c, constant_term2, p, q
TIA
Aditya
2012 May 25
3
Breaking up a vector
Hi all,
My problem is as follows:
I want to run a loop which calculates two values and stores them in vectors
r and rv, respectively.
They're calculated from some vector x with length a multiple of 7.
x <- c(1:2058)
I need to difference the values but it would be incorrect to difference it
all in x, it has to be broken up first. I've tried the following:
r <- c(1:294)*0
rv
2003 May 07
0
assessing goodness of variance prediction
Dear R-Helpers,
I am looking for ways to assess quality of a predictor of variance of a
random variable. Here a two related, but yet distinct, setups.
1. I observe y_t, t=1,...,T which is normally distributed with unknown
variance v_t (note that the variance is time-dependent). I have two
"predictors" for v_t, dubbed v1_t and v2_t, and I want to tell which
predictor is better. Here
2003 Dec 02
2
model of fish over exploitation
Dear all,
I have a serious problem to solve my model. I study over exploitation of
fish in the bay of biscay (france). I know only the level of catch and
the fishing effort (see data below) by year.
My model is composed by the following equations:
* the growth function
Gt(St) = r*St*(1-St/sbar)
with Gt the growth of each period t
r intrinsec growth of the stock
sbar carriyng capacity of the