Announcement

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

  • Graph adjustment

    Good afternoon everyone,

    I am currently having an issue with the graph adjustment in Stata.
    I am trying to replicate the provided graph as follow:
    Click image for larger version

Name:	2.png
Views:	1
Size:	26.1 KB
ID:	1664724


    And my graph from Stata is displayed as below:
    Click image for larger version

Name:	1.png
Views:	1
Size:	94.8 KB
ID:	1664726


    As you can see, the values of my vertical axis are the same as the model, but their position and scale is not the same.
    How can I adjust them? The command that I used as follow:
    Command: twoway (line residual Year) (line fitted_log_P Year, yaxis(2)) (line log_P Year, yaxis(2)), ylabel(-0.3(0.1)0.3) ylabel(-0.4(0.4)1.6, axis(2)) xlabel(1955(5)2005) xmtick(##5)
    I am looking for your help. Best wishes!
    Attached Files

  • #2
    Post the data. See FAQ Advice #12 for details on how to.

    Comment


    • #3
      I agree with Andrew Musau that a data example would help.

      Meanwhile, an easy general comment is that these graphs displease somebody whichever way you do it.

      If you plot residuals on the same scale as observed and fitted, that can be confusing -- with problems variously

      a. the residual series being too flat to see any pattern

      b. the residuals being so far from observed and fitted that too much white space appears

      c. the residuals overlapping with observed and fitted, so three lines to disentangle.

      If you plot residuals on one hand and observed and fitted on the other against different left- and right-hand scales

      d. separate scales are more work for everyone to set up and decode

      e. even linear scalings such as plotting residuals dilated and translated can be hard to read -- or at worst give rise to suspicion of sharp practice

      f. in principle, all the information is there, but a Gestalt awareness of observed, fitted and residual can be elusive

      Back in 2004, I published an ofrtplot that seems now on no-one's radar. The ugly name is "observed, fitted and residual versus t(ime) plot" where time is the usual suspect, but not the only one.

      Here are the links

      Code:
      . search ofrtplot, sj
      
      Search of official help files, FAQs, Examples, and Stata Journals
      
      SJ-10-1 gr0009_1  . . . .  Software update for model diagnostic graph commands
              . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
              (help anovaplot, indexplot, modeldiag, ofrtplot, ovfplot,
              qfrplot, racplot, rdplot, regplot, rhetplot, rvfplot2,
              rvlrplot, rvpplot2 if installed)
              Q1/10   SJ 10(1):164
              provides new command rbinplot for plotting means or medians
              of residuals by bins; provides new options for smoothing
              using restricted cubic splines; updates anova examples
      
      SJ-4-4  gr0009  . . . . . . . . . . Speaking Stata: Graphing model diagnostics
              . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
              (help anovaplot, indexplot, modeldiag, ofrtplot, ovfplot,
              qfrplot, racplot, rdplot, regplot, rhetplot, rvfplot2,
              rvlrplot, rvpplot2 if installed)
              Q4/04   SJ 4(4):449--475
              plotting diagnostic information calculated from residuals
              and fitted values from regression models with continuous
              responses

      Here's a toy example: The graph shown is from the second command. The code is public if anyone wants something a bit or a lot different.


      Code:
      webuse grunfeld, clear
      
      gen ln_invest = ln(invest)
      regress ln_invest L.ln_invest year if company == 1 
      
      set scheme s1color 
      ofrtplot 
      ofrtplot, rplot(recast(line) yli(0, lc(gs8)))

      Click image for larger version

Name:	ofrtplot.png
Views:	1
Size:	31.2 KB
ID:	1664848

      Comment

      Working...
      X