Announcement

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

  • Representing a multiple linear regression model graphically

    Hi everyone,

    I have fit a multiple linear regression model with a combination of binary and continuous predictors and was wondering if there was a nice way to represent coefficients and perhaps std errors or confidence intervals from the model graphically in Stata. Any suggestions would be greatly appreciated!

    Thanks

  • #2
    Others will -- or should -- rightly tell you about margins and its kin, but I want to toot a toy trumpet in favour of added variable plots. Official Stata has long had avplots as an add-on and I wrote favplots (SSC) as a rejig with presentation closer to my personal foibles.

    In essence, added variable plots are a stab at showing the separate effect of each variable, given the effects of the others, subject to all sorts of small and large print about that (including, usually, that the data do NOT come from a controlled experiment!).

    See https://www.statalist.org/forums/for...updated-on-ssc for the latest announcement, except don't see it because it doesn't tell you anything much beyond the fact that this program has been mentioned on Statalist intermittently since 2011.

    Back in 2011 -- when Statalist was an email-based listserver -- we could not show graphs properly, so let's make up for that. You will see that sometimes I don't even like my own defaults, or my standard scheme's defaults, but I wasn't trying to change everything in avplots, and the point of a scheme is to start you off in a pleasant direction; it doesn't guarantee that you will get the best graph even by your tastes. .

    This example just revisits one from the help for avplots.

    Code:
     sysuse auto
     regress price weight foreign##c.mpg
     set scheme s1color 
     avplots, name(G1, replace)
     
     * ssc install favplots 
     favplots, name(G2, replace) yla(, ang(h)) ms(Oh)
    Code:
    
    


    So this is the official version from avplots and below is the version from favplots. You will see that the differences lie in axis titles, including presentation of results.

    Click image for larger version

Name:	avplots.png
Views:	1
Size:	57.8 KB
ID:	1576469


    Click image for larger version

Name:	favplots.png
Views:	1
Size:	73.5 KB
ID:	1576470

    Comment


    • #3
      Very neat! Is there a way to plot the residuals for a subset of the predictors in a regression model using favplots? It is looking a bit busy with the number of predictors in my model. Thanks!

      Comment


      • #4
        The help for favplots mentions the command favplot which produces an individual plot for one predictor. So, you just need to run that for each predictor you want and combine the results.

        Comment


        • #5
          Got it, thanks again!

          Comment

          Working...
          X