Isabel Scheckenbach
2012-May-22 09:10 UTC
[R] ¨Time series and variables with different lengths
Hey, we are currently analyzing the liquidty in the Danish mortgage bond market. For this project we have several irregular time series variables as Bond prices, interest rates etc. We declared all the variables as irregular time series, and created the first differences of them to make them stationary. Now we are trying to run a linear regression on the price of the bon including dummy variables. The dummy variables are already included in the data table. Do we have to declare them in R in addition as dummy variables or is the command as.factor sufficient? Moreover we always get the error message that the variable lengths differ, since after taking the first differences the main variables have on observation less than the dummy variables.. How can I solve for this? Thanks a lot, [[alternative HTML version deleted]]
R. Michael Weylandt
2012-May-22 23:16 UTC
[R] ¨Time series and variables with different lengths
i) Yes, R does factors "smartly" so don't worry about that. ii) Well, you'll need to toss off one observation of the variable you don't difference -- the choice on which end you want to do this should probably reflect how the time is encoded: (i.e., if you have data for May 22, does that reflect what's known at the beginning of the day on May 22 or at the end of the data) but it's really a problem specific question. Best, Michael On Tue, May 22, 2012 at 5:10 AM, Isabel Scheckenbach <isabel.scheckenbach at yahoo.de> wrote:> Hey, > we are currently analyzing the liquidty in the Danish mortgage bond market. > For this project we have several irregular time series variables as Bond prices, interest rates etc. We declared all the variables as irregular time series, and created the first differences of them to make them stationary. > Now we are trying to run a linear regression on the price of the bon including dummy variables. The dummy variables are already included in the data table. Do we have to declare them in R in addition as dummy variables or is the command as.factor sufficient? > Moreover we always get the error message that the variable lengths differ, since after taking the first differences the main variables have on observation less than the dummy variables.. How can I solve for this? > Thanks a lot, > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.