Dear Christian, It is not totally clear to me which variables in your model you can observe and which are unobservable, so I will assume that g_t is observable and u_t, un_t and r_t are not.
You can take the state vector b_t = (one_t, u_t, r_t, un_t)', where one_t = 1 (more on that below). Then you need F = (x[1], x[2], x[3], x[2]) and G = diag(1, 1, 1, x[4]) Since you did not specify the dynamics of u_t and r_t, I am assuming they follow a random walk. If they are observable, then you can just add one row to the F matrix for each one of them. Since you want one_t to be 1 at any time, you should specify in the prior mean m0[1] = 1 and C0[1,1] = epsilon (in theory this should be zero, but in order for dlm to work you need a nonsingular C0: taking a tiny epsilon, 1e-7 say, usually does the job). Similarly, you don't want one_t to change from one time to the next, so you need to specify W[1,1] = 0. Other entries in W can be estimated by maximum likelihood. If you take any of u_t and r_t to be observable, you will also need to set the corresponding value in the V matrix to a tiny epsilon, for the same reason that V must be nonsingular. Or, even better, you can take the observation variance for u_t and/or r_t to be a parameter and you will end up with a random walk plus noise model (local level model) for u_t (and/or r_t). HTH, Giovanni Petris On Tue, 2010-10-05 at 22:30 -0400, Christian Schoder wrote: > Dear r-users! > > I have another question regarding the dlm package and I would be very > happy if someone could give me a hint! > > I am using the dlm package to get estimates for an endogenous rate of > capacity utilization over time. The general form of a state space model > is > > (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) > > The investment function I would like to use for estimating my endogenous > capacity utilization rate looks like > > (3) g_t = x[1] + x[2]*(u_t-un_t) + x[3]*r + v_t > > where g_t is the investment rate, r_t is the profit rate, u_t is the > actual utilization rate and un_t is the 'normal' utilization rate which > I take as endogenous (=time varying). x[i] are parameters. I'm > particularly interested in this endogenous normal utilization rate. How > can I specify a state space model which allows me to estimate it and is > consistent with the structure of the state space models in the dlm > package? > > In the form found in Hamilton my system would look like > > (4) un_t = x[4] * un_t-1 + w_t w_t ~ N(0,W) > > (5) g_t = (x[1],x[2],x[3]) * (1,u_t,r_t)' + x[2] * un_t + v_t v_t ~ > N(0,V) > > which theoretically can be estimated even with the restriction that the > parameters of u_t and un_t have opposite signs, but are otherwise equal. > But how can I do this with the plm package which requires a model of the > following form: > > (6) b_t = G * b_t-1 + w_t w_t ~ N(0,W) > > (7) y_t = F * b_t + v_t v_t ~ N(0,V) > > How can I write my model in the form of (6) and (7) such that my state > vector includes un_t and I can get estimates for the normal rate of > capacity utilization?? > > I would be very grateful for any help, cause I've been sitting on this > issue for a while! > > Christian > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.