Announcement

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

  • Exporting mlogit regressions horizontally to latex

    Hello,

    I would like to ask how to export mlogit regressions horizontally to latex.
    The variable 'exam_cat' has 3 categories and I use the first category as the baseline. When I use the codes below to export, I get a very long table for each regression.
    I want to export the results horizontally (instead of vertically) for each regression so that I would have 2 columns for each regression and 8 columns in total.
    This is better to compare the mlogit results for a given variable in each regression specification.
    Also, it exports the base category as default with 0.00 (0.00), is there a way to ignore that and just export the others?

    Code:
    mlogit exam_cat $student if matched==1, r
    estimate store reg1 
    
    mlogit exam_cat $student $school if matched==1, r 
    estimate store reg2
    
    mlogit exam_cat $inter if matched==1, r 
    estimate store reg3
    
    mlogit exam_cat $inter $elem if matched==1, r 
    estimate store reg4
    
    esttab reg1 reg2 reg3 reg4 using "logit.tex", /// 
    $spec varlabels(var1 "")
    Thank you very much!!

  • #2
    I think what you are looking for are options unstack and drop(). In option drop() you specify the base equation, with a colon. So if the outcome levels are 1, 2, 3, and the base outcome is 1, then you would specify drop(1: ).

    Comment


    • #3
      Hi Jeff, thank you ! it still gives me a long table rather than stacking the columns together for each regression specification. Could you help on this please?

      Comment


      • #4

        In the future, if you provide data with your code, we would be able to show and verify our suggestions work.

        Others on Statalist are more proficient with esttab, but here is what I was able to reconstruct based on your code and description.
        Code:
        clear all
        sysuse auto
        
        global student trunk
        global school turn
        global inter mpg
        global elem displ
        
        gen matched = 1
        
        replace rep = 5 if rep < 3
        
        mlogit rep78 $student if matched==1, r
        estimate store reg1
        
        mlogit rep78 $student $school if matched==1, r
        estimate store reg2
        
        mlogit rep78 $inter if matched==1, r
        estimate store reg3
        
        mlogit rep78 $inter $elem if matched==1, r
        estimate store reg4
        
        esttab reg1 reg2 reg3 reg4 using "logit.tex", ///
        varlabels(var1 "") replace unstack drop(3:)
        Here is a screen-shot of the Preview of the table on my Mac.
        Click image for larger version

Name:	Screenshot 2024-09-13 at 1.42.21 PM.png
Views:	1
Size:	116.2 KB
ID:	1763727

        Comment


        • #5
          I'm sorry, next time I'll provide data. Thank you so much!!

          Comment

          Working...
          X