Announcement

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

  • esttab/estout: Use mlabels, span to group second type of information

    I would now like to create a regression tables that provides two rows of information spanning different columns. I have read the estout help files and searched in the Stata forum, so I know I can not use mgroups ( , pattern) two times. Based on entries in the Stata forum and the estout help files, I suspect that I need to use mlabels with the option span. However, I am unfamiliar with Latex and have not been able to compile the pdf successfully to check if the pandoc conversion is the culprit.

    Code:
    eststo:reg rep78 weight length
    eststo:reg rep78 weight
    eststo:reg rep78 length
    eststo:reg rep78 weight length
    eststo:reg rep78 weight
    eststo:reg rep78 length
    
    global fmtoptions label b(%9.2f) se(%9.2f) stats(r2 N, fmt(%9.2fc %9.0fc) labels("R-squared" "N")) star(+ 0.1 * .05 ** 0.01) onecell nogaps
    
    esttab using example.tex, replace mgroups("Female evaluators" "Male evaluators" "All evaluators", pattern(1 0 1 0 1 0)) mlabels("OLS" "OLS" "OLS" "Logit" "Logit" "Logit" "Logit", span prefix(\multicolumn{@span}{c}{) suffix(})) $fmtoptions
    
    shell pandoc example.tex -o example.docx
    My current result is this:
    Female evaluators Male evaluators All evaluators
    (1) (2) (3) (4) (5) (6)
    OLS OLS OLS Logit Logit Logit
    Weight (lbs.) -0.00 (0.00) -0.00^** (0.00) -0.00 (0.00) -0.00^** (0.00)
    Length (in.) 0.01 (0.02) -0.02^** (0.00) 0.01 (0.02) -0.02^** (0.00)
    Constant 4.07^* (1.68) 4.92^** (0.44) 6.36^** (0.94) 4.07^* (1.68) 4.92^** (0.44) 6.36^** (0.94)
    R-squared 0.16 0.16 0.13 0.16 0.16 0.13
    N 69 69 69 69 69 69
    Standard errors in parentheses
    ^+ , ^* , ^**

    My expected result:
    I would like something closer to this, where OLS and Logit are only repeated once across columns 1-3 and 4-6 respectively.
    OLS Logit
    Female evaluators Male evaluators All evaluators
    (1) (2) (3) (4) (5) (6)
    Weight (lbs.) -0.00 (0.00) -0.00^** (0.00) -0.00 (0.00) -0.00^** (0.00)
    Length (in.) 0.01 (0.02) -0.02^** (0.00) 0.01 (0.02) -0.02^** (0.00)
    Constant 4.07^* (1.68) 4.92^** (0.44) 6.36^** (0.94) 4.07^* (1.68) 4.92^** (0.44) 6.36^** (0.94)
    R-squared 0.16 0.16 0.13 0.16 0.16 0.13
    N 69 69 69 69 69 69
    Standard errors in parentheses
    ^+ , ^* , ^**

    I know I need to merge the columns manually in Word after my conversion.
    Last edited by Felix Kaysers; 14 May 2025, 15:19. Reason: formatting & clarification
    Cheers,
    Felix
    Stata Version: MP 18.0
    OS: Windows 11
Working...
X