Announcement

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

  • #16
    Originally posted by Raymond Zhang View Post
    Another simplier method:
    Code:
    sysuse auto,clear
    
    mfp: regress mpg weight displacement if foreign==0
    fracplot displacement
    
    mfp: regress mpg weight displacement if foreign==1
    fracpred dfit, for(displacement)
    fracpred ds, for(displacement) s
    
    gen low=dfit-1.96*ds
    gen high=dfit+1.96*ds
    
    addplot: rarea low hi displacement ,color(gs14%80) sort || ///
    line dfit displacement ,color(red)|| ///
    scatter mpg displacement if foreign==1,sort
    Thanks @ Raymond Zhang
    I was wondering if you could inform me whether it is possible to replace the scatter plot in the last part of your command (scatter mpg displacement if foreign==1,sort) with a Component-plus-residual plot. The reason for this is I have multiple independent variables in MFP and the scatter plot does not take into account the effect of the other independent variables in the model.
    This is what I did base on your commands:

    mfp: regress mpg weight displacement if foreign==0
    fracplot displacement
    mfp, center(no): regress mpg weight displacement if foreign==1
    fracpred dfit, for(displacement)
    fracpred ds, for(displacement) s
    gen low=dfit-1.96*ds
    gen high=dfit+1.96*ds
    addplot: rarea low hi displacement ,color(gs14%80) sort || line dfit displacement ,color(red) || cprplot displacement if foreign==1,sort
    The STATA's output is an error indicating that "cprplot is not a twoway plot type".
    Also, although I did not centerized the independent variables in the regression model, the Y axis shows value in the compontnt-plus residual value.'
    Please let me know what you think. Thank you
    Last edited by Arash Sereshki; 03 Mar 2021, 17:01.

    Comment


    • #17
      Hi everyone,

      I have generated three time-series graphs, using the following code:

      tsline p10 if timesteps<21
      graph save p10, replace

      tsline p50 if timesteps<21
      graph save p50, replace

      tsline p90 if timesteps<21
      graph save p90, replace

      graph combine p10.gph p50.gph p90.gph, note("10th percentile" "50th percentile" "90th percentile")



      However, I want to overlay instead of combining them (and also change the colour). I tried some of the code above but had no success, could anyone please help me?

      Thank you,

      Comment

      Working...
      X