Announcement

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

  • Esttab : combining regressors

    I am trying to create an esttab output similar to this:
    Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	38.6 KB
ID:	1526204





    my code is as follows:
    Code:
    eststo kindergarten: reg test_score_k small_class_k reg_aide_k, r
    eststo first: reg test_score_1 small_class_1 reg_aide_1, r
    eststo second: reg test_score_2 small_class_2 reg_aide_2, r
    eststo third: reg test_score_3 small_class_3 reg_aide_3, r
    
    #delimit ;
    esttab using table_11_1.rtf, title(STAR:Differences Estimates of Effect
    on Standardized Test Scores of Class Size Treatment Group) mtitles("K" "1" "2" "3")
    addnotes(Dependent variable is students combined math and reading of
    the Standford AChievement Test) se(2) onecell equations(1);

    How do I combine the regressors in the esttab table where there are only 2 regessors for all the regression outputs? The 2 regessors I want are small_class and reg_aide.

    My current output is like this:

    Click image for larger version

Name:	image_16279.jpg
Views:	1
Size:	32.2 KB
ID:	1526206
    Last edited by Jay Shalian; 24 Nov 2019, 14:09.

  • #2
    esttab is from SSC/ Stata Journal. Your problem lies in the wide layout of your data. In general, see

    Code:
    help reshape
    You can do something like below:

    Code:
    rename (*_k) (*_0)
    rename (*_#) (*#) 
    gen observation=_n
    reshape long test_score small_class reg_aide, i(observation) j(grade)
    label define grade 0 "Kindergarten" 1 "First" 2 "Second" 3 "Third"
    label values grade grade
    eststo kindergarten: reg test_score small_class reg_aide if grade==0, r
    eststo first: reg test_score small_class reg_aide if grade==1, r
    eststo second: reg test_score small_class reg_aide if grade==2, r
    eststo third: reg test_score small_class reg_aide if grade==3, r
    esttab ...

    Comment


    • #3
      Andrew,

      Yes! Thank you that was exactly what I was looking for. Another way I just came up with was to simply rename all the regressors to the same thing. The resulting esttab would be formatted like your solution.

      Comment

      Working...
      X