Announcement

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

  • Uni variate regression table

    Hello is there a command to create a univariate logistic regression table?
    something like the table 1 command?

    My advisor wants a simple Risk factor table using before adjustment

    I want to be able to just have each individual variable odds ratio in one table, or do I have to do a uni variate logistic regression with each variable, one by one and then create my own table? hoping there is some short cut .

    Would also be curious if this is available for mutlivariate.


    Thanks!

  • #2
    You can write code to do this.

    Code:
    *LOAD EXAMPLE DATA SET
    webuse lbw, clear
    *HOLD NAMES OF REGRESSORS IN A LOCAL
    local regressors "age smoke 2.race 3.race"
    *RESERVE NAME FOR MATRIX TO HOLD RESULTS
    tempname resmat
    *LOOP: DV= "low"
    foreach regressor of local regressors{
          logit low `regressor'
          mat R= (r(table)[1..3, 1])'
          matrix `resmat'=nullmat(`resmat')\R[1, 1..3]
    }
    mat l `resmat'
    Use a program to export the results held in the matrix to your text editor. For multivariate regressions, use the program directly. See, for example, esttab by Ben Jann.

    Code:
    ssc install esttab
    help esttab
    esttab mat(`resmat') using myfile.rtf, nomtitles
    Res.:

    Code:
    . mat l `resmat'
    
    __000000[4,3]
                         b          se           z
       low:age  -.05115294   .03151378  -1.6231928
     low:smoke   .70405921   .31964241   2.2026464
    low:2.race   .56357619   .43255606   1.3028975
    low:3.race    .4321825   .32339593   1.3363882
    
    
    . esttab mat(`resmat'), nomtitle
    
    ---------------------------------------------------
                            b           se            z
    ---------------------------------------------------
    low                                                
    age             -.0511529     .0315138    -1.623193
    smoke            .7040592     .3196424     2.202646
    2.race           .5635762     .4325561     1.302897
    3.race           .4321825     .3233959     1.336388
    ---------------------------------------------------
    .

    Comment

    Working...
    X