Announcement

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

  • Trying to run an ADF test - How can I create a weekly tsset date variable from a daily date format.

    Hi,
    currently my data set is in weekly intervals written in a daily date format. When I declare my data to be time-series data and select 'weekly' as the time unit and display format I am getting the message "variable date has been formatted tdnn/dd/CCYY (a daily period), and you asked for a weekly period. Are you sure that is what you want? It has been done; date is now formatted tw". My data set now has gaps, so I filled the gaps. However when I try to run the ADF test I get the error "no observations".
    Any help would be much appreciated, thank you.

  • #2
    Wrong way round. You should specify daily and the option delta(7) to tsset.

    Stata weeks are almost never matched by data from outside StataCorp. Much more discussion if you want at


    SJ-12-4 dm0065_1 . . . . . Stata tip 111: More on working with weeks, erratum
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
    Q4/12 SJ 12(4):765 (no commands)
    lists previously omitted key reference

    SJ-12-3 dm0065 . . . . . . . . . . Stata tip 111: More on working with weeks
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
    Q3/12 SJ 12(3):565--569 (no commands)
    discusses how to convert data presented in yearly and weekly
    form to daily dates and how to aggregate such data to months
    or longer intervals

    SJ-10-4 dm0052 . . . . . . . . . . . . . . . . Stata tip 68: Week assumptions
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
    Q4/10 SJ 10(4):682--685 (no commands)
    tip on Stata's solution for weeks and on how to set up
    your own alternatives given different definitions of the
    week

    Comment


    • #3
      Hi, thank you for your response. However, I am still confused as to what is the wrong way round and what I should be specifying?

      Comment


      • #4
        It is the wrong way round to try to tell Stata that daily dates are weekly dates because (0) they aren't (1) it expects such to have a %tw format (2) Stata's weeks are not suitable for most purposes (that may come as a real surprise, but did you try reading any of the references?).

        You need to reverse the mistaken assignment of %tw because it will produce nonsense in your case and indeed all others.

        Here's today's date formatted as a Stata week.

        Code:
        . di %tw mdy(5, 2, 2018)
        2369w39
        That's the 39th week of 2369.

        I am confident that doing that with your data is meaningless. What's more the weeks are still 7 apart, which is why your testing failed. Stata tried its best to do what you asked, but it's the wrong way round.

        As said, you should also specify daily and the option delta(7) to tsset

        Comment

        Working...
        X