Announcement

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

  • Error in using statsby command for running loop to get regression coefficients


    We have used following command to run 15K regressions:- statsby _b _se e(rmse) by(gvkey, year) saving(my_regs): reg depvar indpvar The output was generated but we found errors when we individually verfied the coefficients randomly. I am not sure whether my problem is the one already discussed by Clyde Schechter and Nick Cox where they recommended to convert the data in long format.

  • #2
    Zaheer:
    nobody can give you helpful replies without seeing what you typed and what Stata gave you back (as per FAQ). Thanks.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Thanks Carlo. The command was:-

      "statsby _b _se e(rmse) by(gvkey, year) saving(my_regs): reg excess_return smb hml mom"

      The output was in shape of 15K betas and other requested outputs. It was however different from the betas that we obtained by randomly running the regression for the individual stocks.

      I hope I could make myself clear here. Otherwise I can select some of the observations and attach here. Many thanks

      Comment


      • #4
        Sorry, but you have not given us anything we can comment on.

        Presumably your real command was punctuated differently; otherwise it would not have worked.

        Code:
        statsby _b _se e(rmse), by(gvkey year) saving(my_regs): reg excess_return smb hml mom
        More crucially, this is of the form "I did analyses two different ways and the answers are different" and that needs concrete examples to elicit further comment.

        Comment


        • #5
          One approach to this problem might be to apply the command to a subset of your data - one or two gvkey values, a few years - and see if the problem happens in the smaller setting. And perhaps in a small setting you might be able to figure out what is happening. Also, you can include the noisily option so you can confirm the stored results and avoid the problem Nick suggests - that your manual checking was the source of the problem. You said you randomly ran the regression for individual stocks; we assume you mean for individual stocks in individual years.

          Comment

          Working...
          X