Announcement

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

  • rangestat error

    Dear Stata users

    My data is in panel format, daily frequency (id, date). I need to run a regression for each firm (id) each day (date) and obtain regression coefficient, constant and residuals.

    I have tried the following code:

    Code:
    rangestat (reg) BuyInst sent_vol_nonzero_lag, interval (date 0 0) by(id)
    Stata returned the following error: no result for all obs: reg BuyInstVolN sent_vol_nonzero_lag

    What's wrong with the code? Any help is much appreciated.

    Thank you.



  • #2
    rangestat is from SSC, as you are asked to explain.

    From what you say you are trying to fit each regression to one data point (each firm and each day). rangestat cannot help you any more than regress could. The difference is that no error messages are given. rangestat isn't surprised that any window contains insufficient data to do the required operations and therefore not surprised even if they all contain insufficient data.

    You don't give a data example but yours is on all fours with examples like

    Code:
    . webuse grunfeld
    
    . regress mvalue invest if company == 1 & year == 1940
    insufficient observations
    r(2001);

    Comment


    • #3
      Nick

      Thank you. I think what I need is a regression by id, month.

      This one seem to be working:

      Code:
      rangestat (reg) BuyInst sentiment_volume_1d_n_lag1, interval(month . 0) by(id)
      The output gives coefficients, standard errors but no residuals. Is there any chance rangestat can produce it?

      Comment


      • #4
        It's much more likely that you want

        Code:
        interval(month 0 0)
        If you think about what rangestat gives you, it is immediate that

        Code:
        gen residual = BuyInst - b_cons - b_sentiment_volume_1d_n_lag1*sentiment_volume_1d_n_lag1

        Comment


        • #5
          Nick

          Thank you. I am not sure I can calculate residuals in a way you have suggested. When I run regression each month id (based on daily data) I get the following output:

          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	29.5 KB
ID:	1467582

          When I apply the above equation to compute residuals I get residuals compared to daily BuyInst...

          Comment

          Working...
          X