Announcement

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

  • Graphing Regression Coefficient

    Hi,

    I am trying to create a graph where:
    1) Regression coefficients are plotted from two different linear regressions
    2) The regression coefficients should be group together based on the outcome and this process will be repeated for 25 other variables
    3) All this information should be plotted on one graph. The second image I have attached is an example of the graph I'd like to create, except, each variable should have two lines (one from each regression I run).

    I tried using the coefplot command but thus far I have not succeeded. Here is the code I ran:

    Code:
    quietly regress eotx viralcompare  
        estimates store eotx //store the estimates of the entire regression and name it
    quietly regress eotx nonviralcompare
        estimates store eotx2 //store the estimates of the entire regression and name it
    quietly regress gmcsf viralcompare  
        estimates store gmcsf //store the estimates of the entire regression and name it
    quietly regress gmcsf nonviralcompare
        estimates store gmcsf2 //store the estimates of the entire regression and name it
        
    *****Code for the resulting graphs*****
    coefplot eotx eotx2 gmcsf gmcsf2, ///code to generate the coefficient plot
        keep(viralcompare nonviralcompare) ///recall coefficients saved previously but only use coefficients of interest
        xline(0) legend(off) // line through 0 on the x-axis and hide legend
    From the regression I ran, I'd like to save the regression coefficients for "viralcompare" & "nonviralcompare" for 26 different variables and then plot them all on one graph according to the outcome. The code I displayed results in the first graph I have uploaded. Instead of grouping them via the outcome, the estimates are being grouped according to the two different regression coefficients.

    Should I use a different command to create the graphs I want or can I create what I want with coefplot?

    Apologies if my description wasn't detailed enough. Thanks for any responses in advance.

    Reference for the second graph:
    McKay HS et al. (2016). Data on serologic inflammatory biomarkers assessed using multiple assays and host characteristics in the Multicenter AIDS Cohort Study (MACS). Data Brief. 9: 262-270. doi: 10.1016/j.dib.2016.08.019
    Attached Files
    Last edited by Muhaimen Siddiqui; 27 Mar 2017, 15:46.
Working...
X