Announcement

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

  • Store estimates of a loop using a reghdfe regression

    Hello everyone,

    I am trying to store estimates of a (reghdfe) regression in a loop. The regressions of the loop are all running fine, but only the last estimate is stored. What am I doing wrong?


    Code:
    sysuse auto, clear
    
    foreach y of varlist price mpg turn {
        reghdfe `y' length trunk, absorb(gear_ratio) vce(cluster displacement) 
    eststo m`i'
    }
    est dir
    Thank you for your help,

    Nicolas Charette

  • #2
    Hello Nicolas,

    Here is your error, since you can't delete your post and you found the answer:

    Code:
    sysuse auto, clear
    
    foreach y of varlist price mpg turn {
        reghdfe `y' length trunk, absorb(gear_ratio) vce(cluster displacement)
    eststo m`y'
    }
    est dir
    You used an i instead of a y...

    Comment


    • #3
      Hello Nicolas -

      In the Statalist FAQ linked to from the top of the page, we see the following explanation of why you cannot delete your post.

      16.2 What can you edit

      Starting a thread does not convey ownership of that thread. Re-opening a thread by yourself or others is always allowed, and encouraged when any one has something relevant to add, say by reporting another solution, an update of a program, or a very similar question. Lapse of time is often not important: for example, it's fine to announce an update of a program in the same thread a few years after the original post. A new post always bumps a thread temporarily to the top of the list, so that additions can be noticed and read in context.

      You cannot delete a post, but the forum allows for a one hour edit window. This allows fixes of many kinds, such as typo corrections, extra detail, or improved wording. Please don't mangle your own posts, even if you solved your problem yourself or realised that the question was silly. Explain the solution, even if it was trivial. Often someone else will have the same problem.
      So by posting a solution, rather than deleting your post, you will perhaps help other Statalist members. Remember, there are a lot of (relatively) silent members, some of whom, as I did when I was new to Stata, use posted questions to test their knowledge and expand their understanding of Stata. On their behalf, thank you.

      Comment


      • #4
        Thank you William! All my questions are answered.

        Comment

        Working...
        X