Announcement

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

  • Creating an S-curve graph based on regression results.

    Hi All,

    I am trying to figure out how to graph an S-curve relationship between the DV (lnbannersales_store) and one of the IVs (countries_regions) in Stata. This is what my regression model looks like:

    xtscc lnbannersales_store sfd lncheckouts countries_regions sqcountries_regions cubecountries_regions foreignmarketgrowth intspeed lnforeignsales globecultdist lnpoldist,fe

    I would also like to show how the S-curve relationship changes once the relationship between tDV (lnbannersales_store) and one of the IVs (countries_regions) is moderated by sfd (sfd_countriesregions sfd_sqcontriesrregions sfd_cubecountriesregions).

    xtscc lnbannersales_store sfd lncheckouts countries_regions sqcountries_regions cubecountries_regions foreignmarketgrowth intspeed lnforeignsales globecultdist lnpoldist sfd_countriesregions sfd_sqcontriesrregions sfd_cubecountriesregions,fe


    Any ideas how I could create the graphs above would be greatly appreciated.


    Thank you in advance!

    Boryana

  • #2
    The S-curve relationship should be apparent from looking at your coefficients and their significance. You can always do a twoway plot as a first step, for example:

    Code:
    . webuse nhanes2
    
    . desc hdresult
    
                  storage   display    value
    variable name   type    format     label      variable label
    ----------------------------------------------------------------------------------------
    hdresult        int     %9.0g                 high density lipids (mg/dL)
    
    . gen age3= age^3
    
    . regress hdresult c.age##c.age age3
    
          Source |       SS           df       MS      Number of obs   =     8,720
    -------------+----------------------------------   F(3, 8716)      =      7.47
           Model |  4577.28505         3  1525.76168   Prob > F        =    0.0001
        Residual |  1781305.25     8,716  204.371873   R-squared       =    0.0026
    -------------+----------------------------------   Adj R-squared   =    0.0022
           Total |  1785882.53     8,719  204.826532   Root MSE        =    14.296
    
    ------------------------------------------------------------------------------
        hdresult |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |  -1.126969   .2978212    -3.78   0.000    -1.710769   -.5431695
                 |
     c.age#c.age |   .0265066   .0067507     3.93   0.000     .0132736    .0397395
                 |
            age3 |  -.0001893   .0000481    -3.94   0.000    -.0002835   -.0000951
           _cons |    63.6871   4.053082    15.71   0.000      55.7421     71.6321
    ------------------------------------------------------------------------------
    
    . twoway lowess hdresult age
    Click image for larger version

Name:	s-curve.png
Views:	1
Size:	32.8 KB
ID:	1413868




    You can also plot predicted outcome against the regressor of interest.

    Code:
    predict yhat, xb
    twoway lowess yhat age
    Last edited by Andrew Musau; 09 Oct 2017, 14:11.

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X