Announcement

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

  • Issues with tssmooth moving average operation for forecasting with panel data

    Hello All,

    I am attempting to use lagged periods of earnings to forecast future share price results using the tssmooth command. My panel data is unbalanced and my time variable has gaps. Stata runs the tssmooth operation, but no values actually populate in my data set. I am not sure what I am doing wrong and could use some help in setting up my panel data correctly. My panelvar includes stock tickers (AAPL, MSFT, etc.) and my time variable is quarterly earnings. I have normalized quarterly earnings so that all stocks earnings around a given time frame (since companies have different fiscal years for reporting earnings) are condensed into the same quarter end.

    I have attached screenshots of my xtset and xtdescribe commands as well as my current do-file. Any help getting the tssmooth command to populate would be greatly appreciated. Thank you!





    Attached Files

  • #2
    You have dates that you told Stata were quarterly.

    I doubt that in 2019 you have data for the 3rd quarter of 5444, short of time travel.

    Like me Stata raised its eyebrows, but you didn't change your mind. Looking at the first two -- and guessing that they are really daily dates -- I see that makes more sense:

    .
    Code:
     di %td yq(5444, 3)
    28feb1998
    
    . di %td yq(5452, 2)
    31mar1998
    I suspect that you may have monthly data that happen to be recorded towards the end of each month. if so, then

    Code:
    gen mdate = mofd(QuarterEnd) 
    A more likely alternative, given different definitions of fiscal years, is that you really do have approximately quarterly data but different dates for different panels. If so, then

    Code:
    gen qdate = qofd(QuarterEnd)
    The underlying fallacy here is that changing the display format does anything but change the display format. Changing the format doesn't do anything whatsoever to convert one kind of date to another. This is explained in detail in https://www.stata-journal.com/articl...article=dm0067 It also follows from documentation such as

    Code:
    help datetime
    Although I can make suggestions based on your post I do flag that we emphasise that screenshots are in general less helpful than explicit data examples. Please do note FAQ Advice #12.

    Comment


    • #3
      Thank you very much for the suggestions! The tssmooth command worked after applying qdate=qofd(QuarterEnd) to my dates.

      Comment

      Working...
      X