------------------------------------------------------------------------------- help forofrtplot7-------------------------------------------------------------------------------

Observed, fitted and residuals plotted versus time variable

ofrtplot7[varname] [,supertfrac(#)graph_optionsnlabel(#)]

Description

ofrtplot7plots observed, fitted and residuals from the last model against a covariate. It is designed for time series models and by default the covariate is whatever has beentssetas the time variable. However, other variables may be specified, whether or not data have beentsset.Observed values are for the response or dependent variable from the last model, fitted values are whatever

predictproduces by default and residuals are whateverpredict, resproduces. The plot is restricted to the estimation sample.By default, the plot has two panels. In the top panel, observed and fitted are plotted against the covariate. In the bottom panel, residuals are plotted against the covariate, by default as spikes from zero.

This is the original version of

ofrtplotfor Stata 7, renamedofrtplot7. Users of Stata 8 upwards should upgrade toofrtplot.

RemarksWhenever

the time variable has a

%tor%dformat, andneither

xlabelnorxlabel()is specified, andvalues span more than one year

ofrtplot7attempts to select for the time (x) axis nice labels based on the years included in the time series. For daily, weekly, monthly, quarterly or half-yearly data, it attempts to show the first time period within each of various years which are nice numbers. For yearly data, it attempts to show years which are nice numbers. Nice numbers here are preferably multiples of 10, 5 or 2. The main algorithm used is based on code by Hardin (1995).

Options

superspecifies that plots are to be superimposed, not separate.

tfrac(#)specifies the fraction of the graph image taken up by the top panel. The default is 0.625. If the fraction specified is 1, the bottom panel is suppressed, while if it is 0, the top panel is suppressed.

graph_optionsare options ofgraph, twoway, except forby()andrescale. The defaults includegap(5)and (ifvarnameis specified)sort.If

symbol()is specified, the first two symbol specifications refer to observed and fitted and the second two symbol specifications refer to residuals and zeros. The default issy(iiii).If

connect()is specified, the first two connect specifications refer to observed and fitted and the second two connect specifications refer to residuals and zeros. The default isc(ll[-]||).By default, with no

superoption, the plot shows two separate panels, andrlabel,rlabel(),rline,rline(),rtick,rtick(),rscale(),r1title()andr2title()refer to the corresponding y axis options of the bottom panel. That is,rlabelis theylabeloption for the y or residual axis,r1title()is thel1title()option for that axis, and so forth. Thus these options may be thought of as specifying options referring to theresidual axis.Correspondingly,

ylabel,ylabel(),yline,yline(),ytick,ytick(),yscale(),l1title()andl2title()refer to the y axis options of the top panel.With the

superoption, only one panel is produced, and these options all have their usual meanings.Note, however, that

saving()andtitle()refer to the combined graph image, whatever other options are specified.

nlabel(#)suggests the number of nice labels to be shown on the time axis. The suggestion may or may not be taken literally. This option is independent ofxlabelorxlabel().

Examples. tsset time

. regress

whatevertime. ofrtplot7

. ofrtplot7, tfrac(0.7)

. gen gpm = 1 / mpg

. regress gpm weight

. ofrtplot7 weight, c(.l||) sy(oiii)

AuthorNicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

AcknowledgementsDenis de Crombrugghe suggested this program. Kit Baum made several useful suggestions.

ReferencesHardin, J.W. 1995. Calculate nice numbers for labeling or drawing grid lines.

Stata Technical Bulletin25, 2-3. (Also inSTB ReprintsVolume 5, 19-20.)

Also seeOn-line: help for graph, predict, tsset