[R] What is the best way to lag a time series?

2010-12-25 Thread Christian Schoder
Dear R-users, I've been using R for a while and I am very satisfied! Unfortunately, I still have not figured out an efficient and general way to construct and use lags of time series, especially when I need to work with different packages. Let me give an example. I have two time series x and y a

[R] dlm package: how to specify state space model?

2010-10-05 Thread Christian Schoder
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

[R] plm: lag() and diff() do not (always) recognize a gap in the time dimension

2010-10-01 Thread Christian Schoder
Hello! I came accross a strange behavior of the plm package. When using an unbalanced panel with years lag() and diff() do not recognize a break in the time dimension. It does, however, if there is only one more year after the break. This is strange, right? Consider the following example: > lib

[R] print only 2 digits of number

2010-09-29 Thread Christian Schoder
hi R-users! does anyone know how I can access/print only the first two digits of a number? if i have the number 23732, i would like to get 23. if i have 355 i would like to get 35. if i have 4 i would like to get 40. thanks for your help! christian _

[R] Time invariant coefficients in a time varying coefficients model using dlm package

2010-09-28 Thread Christian Schoder
Dear R-users, I am trying to estimate a state space model of the form (1) b_t = G * b_t-1 + w_tw_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

[R] Drop firms in unbalanced panel if not more than 5 observations in consecutive years for all variables

2010-07-22 Thread Christian Schoder
Dear R-user, a few weeks ago I consulted the list-serve with a similar question. However, my task changed a little but sufficiently to get lost again. So I would appreciate any help on the following issue. I use the plm package and work with firm-level data in a panel. I would like to eliminate a

[R] Drop observations in unbalanced panel data set according to missing values

2010-05-28 Thread Christian Schoder
5 d 5 5 6 d 6 6 7 d 7 7 Thank you very much! Christian Schoder __ 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 com