Announcement

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

  • How to plot univariable coefficients below multivariable coefficients via -coefplot-

    Dear Statalisters,

    I would like to plot univariable coefficients right below multivariable coefficients - for an easy assessment of confouding factors. I have been using -coefplot-.

    This is what I have been doing:

    Code:
    * --------- begin example ----------------*
    clear
    set obs 100
    gene y = rnormal(100,20)
    
    forvalues i = 1/6 {
    gene cov`i' = runiform()
    }
    
    regress y cov1-cov6
    estimates store multi
    
    forvalues i = 1/6 {
    regress y cov`i'
    estimates store uni`i'
    }
    
    coefplot multi uni1 uni2 uni3 uni4 uni5 uni6 , drop(_cons)
    * --------- end example ----------------*
    This is almost what I need. However, I would like to have two colors only (navy = multivariable, cranberry = univariable). Although I don't mind manually editing, the problem is that the spacing between estimates seem to increase from top to bottom.

    Do you have any suggestions how to overcome that problem?

    All the best,

    Tiago




  • #2

    Code:
    eststo multivariable: regress y cov1-cov6
    eststo uni1: regress y cov1
    eststo uni2: regress y cov2
    eststo uni3: regress y cov3
    eststo uni4: regress y cov4
    eststo uni5: regress y cov5
    eststo uni6: regress y cov6
    
    coefplot (uni1 \ uni2 \ uni3 \ uni4 \ uni5 \ uni6, label(univariable)) (multivariable), drop(_cons)
    Last edited by Tiago Pereira; 01 Apr 2018, 18:39.

    Comment

    Working...
    X