Announcement

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

  • Itsa

    Dear
    I am new using time series analises in stata, so need some help.
    I am try to use the ITSA command. first I used
    tsset index dm
    panel variable: index (unbalanced)
    time variable: dm, 2010m1 to 2017m12, but with gaps
    delta: 1 month

    when I use this "itsa rate, single trperiod(2015m1) lag(1) posttrend figure" I have this error message: "trperiod() invalid -- invalid numlist"
    when I try this "itsa rate, single trperiod(20151) lag(1) posttrend figure" I have this error message "Treatment periods not found in time variable: check trperiod()"
    How can I solve this issue?
    Thanks

  • #2
    If you look at the help for -itsa- you will see that that the -trperiod()- option requires a numlist, i.e. a list of numbers.

    2015m1 is not a number: it's a string. And 20151 is a number, but it is not the correct Stata numerical representation of January 2015, nor of any other month that you will find in any real-life data because 20151 is the Stata representation of April 3639!

    So what you want is -trperiod(`=tm(2015m1)')-

    Let's unpack that:

    tm() is a Stata function that converts string representations of months to their corresponding correct Stata numerical representation. (tm(2015m1) = 660)

    But you can't just write -trperiod(tm(2015m1))- because even though tm(2015m1) evaluates to the correct number, from the perspective of the syntax parser it is an expression, not a number. So we have to force Stata to first evaluate tm(2015m1) and then stick the resulting number (660) into -trperiod()-, And that is precisely what the `=...' notation does.

    Comment


    • #3
      thank you!
      it worked!

      Comment

      Working...
      X