Announcement

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

  • Statsby doesn't report results for each line?

    I have market data from 2007 to 2016 and I'm running a regression by Ticker using the following command: statsby, saving(regtest2) by(Ticker): reg rtrn mkt smb hml rf if training==1. The problem is the file that I get with the results only gives me one line per each Ticker where there is the constant, beta1, beta2, beta3 and beta4 (which I assume is the average of all lines?). I would like to get results for every single line meaning for each day starting from 2007 to 2016. I tried the following command without any success: statsby, saving(regtest2) by(Ticker Date): reg rtrn mkt smb hml rf if training==1

    Thanks for helping in advance!

  • #2
    Maher:
    I do hope that what follows can give you some clues:
    Code:
    . use "https://www.stata-press.com/data/r17/nlswork.dta"
    (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
    
    . statsby, by( year age): reg ln_wage tenure
    (running regress on estimation sample)
    
          Command: regress ln_wage tenure
               By: year age
    
    Statsby groups
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
    (24 missing values generated)
    .x................................................    50
    ..........................xx......................   100
    ....x..........................x............xx....   150
    .........x............xx............x.............   200
    
    . list in 1/20
    
         +-----------------------------------+
         | year   age   _b_tenure    _b_cons |
         |-----------------------------------|
      1. |   68    14     4.53546   .3177595 |
      2. |   68    15           .          . |
      3. |   68    16    2.016721   .6480181 |
      4. |   68    17    .2792446   .8678428 |
      5. |   68    18    .3790007   1.198386 |
         |-----------------------------------|
      6. |   68    19    .1088333   1.315427 |
      7. |   68    20    .0642107   1.368799 |
      8. |   68    21    .0037639   1.495861 |
      9. |   68    22    .0234223   1.533701 |
     10. |   68    23    .0601063   1.525884 |
         |-----------------------------------|
     11. |   68    24    .0110897   1.526417 |
     12. |   68    25   -.0016319   1.532955 |
     13. |   68    26     -.51025   1.979264 |
     14. |   69    16   -.9236087   1.599697 |
     15. |   69    17   -.2464722   1.313209 |
         |-----------------------------------|
     16. |   69    18    .0763398   1.278549 |
     17. |   69    19    .0106208   1.419504 |
     18. |   69    20    .0796572   1.419729 |
     19. |   69    21    .0571575    1.49037 |
     20. |   69    22     .143016   1.463004 |
         +-----------------------------------+
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you for your response Carlo. When I run the same command I get xs showing up everywhere and I'm not really sure why. I've got to investigate it further. Thanks again!

      Comment

      Working...
      X