Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • time series problems

    Hi, I have a weekly time series (the timevar is the date of monday of every week 2005-2013 ie 4april2005, 11april2005 etc ). I've declared it a timeseries which seems to be ok
    (. tsset
    time variable: Date, 04apr2005 to 30dec2013, but with gaps
    delta: 1 day)
    but when I try and use time series commands it won't let me - I can't use the lag or difference function in regression or do dfuller for example. It just says 'no observations'.

    I tried converting it to the stata weekly date but there are a few years where the final 2 mondays in december get put as the same stata week, which then means it won't work as a time series either.

    Is there some other way of sorting this out?

    Thanks in advance.

  • #2
    Yes, the lead, lag, and difference operators aren't working as you intend because they are looking for observations that are a day apart, not a week apart. And the Stata weekly dates have the complication that you note in December. You're going to have to make a quasi-date. Assuming this is a pure time series (not a panel), all you have to do is:

    Code:
    isid Date, sort
    gen weeknum = _n
    tsset weeknum

    Comment


    • #3
      Many thanks for that. I had considered that option, the thing that slightly put me off is that I am making splines based on the date and have been graphing them to show the seasonal and secular trends etc. If I am using a quasi date then I don't get the proper date on graphs. It's entirely possible that there is a simple solution to this of course, that in my stata ignorance I'm not aware of!

      Comment


      • #4
        If the data are every Monday, you don't need either to use Stata's weeks (which are too strange to fit externally defined data) or to invent something ad hoc.

        Look at the delta() option of tsset. So, your data should be declared as daily data that happen to be 7 days apart.

        Comment


        • #5
          Well, without seeing precisely what you're trying to do, it's hard to advise. But just because you use weeknum in your analyses doesn't mean you can't graph your results against Date.

          Comment

          Working...
          X