------------------------------------------------------------------------------- help forregplot7-------------------------------------------------------------------------------

Plots of regress or similar fit

regplot7[,graph_optionsseparate(varname)]

regplot7varname[,graph_optionsseparate(varname)]

Description

regplot7plots fitted or predicted values from an immediately previousregressor similar command. By default the data for the response are also plotted.

RemarksWith the first syntax, no varname is specified.

regplot7shows the response and predicted values on the y axis and the covariate named first in theregressor similar command on the x axis. Thus with this syntax the plot shown is sensitive to the order in which covariates are specified in the estimation command.With the second syntax, a varname is supplied, which may name any numeric variable. This is used as the variable on the x axis. This permits changing graphs without reissuing the estimation command.

Thus in practice

regplot7is most useful when the fitted values are a smooth function of the variable shown on the x axis, or a set of such functions given also one or more dummy variables as covariates. However, other applications also arise, such as plotting observed and predicted values from a time series model versus time.In more technical detail:

regplot7plots1. both a single dependent or response variable as specified in

e(depvar)and whatever single variable is calculated by the default ofpredicton the y axis, which makes sense whenever those variables are on the same scale;2. either the

varnamespecified or what names the first column ofe(b)on the x axis, which makes sense whenevergraphcan understand that as specifying the x axis.If your estimation results do not meet these specifications, you are likely to get either bizarre results or an error message. Note in particular that

varnamemust be specified afternl.Time series operators are allowed.

The plot is restricted to the estimation sample.

regplot7is a renamed clone ofregplot1.2.0 which is for Stata 7. Stata 8 users should useregplot2.0.0 or later.

Options

graph_optionsare options ofgraph, twoway.The defaults include

connect()of.for data andsfor each subset of predicted values.To suppress plotting of response data, specify

ias the firstsymbolto be shown.

separate(varname)specifies that predictions are to be shown separately for different categories ofvarname. This will be most appropriate when the categories ofvarnameare associated with one or more dummy or indicator variables.Note that

by(varname)may be employed as usual withregplot7and it also may be combined withseparate().

Examples. use auto

continuous variables only:

. regress mpg weight

. regplot7

. gen weightsq = weight^2

. regress mpg weight weightsq

. regplot7

(N.B. weight shown on x axis in both cases)

categorical variable also:

. regress mpg weight foreign

. regplot7, sep(foreign) tr(1)

. regress mpg weight weightsq foreign

. regplot7, sep(foreign) tr(1)

. regplot7, by(foreign)

. regplot7, by(foreign) sep(foreign) tr(1) total

. gen fw = foreign * weight

. regress mpg weight foreign fw

. regplot7, sep(foreign) tr(1)

commands other than

regress:. logit foreign weight

. regplot7

. glm mpg weight foreign, link(log)

. regplot7, sep(foreign) tr(1)

fit an AR(1) plus trend model to time series:

. regress ERvol L.ERvol date

. regplot7 date

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

AcknowledgementsKen Higbee and Kit Baum provided very helpful comments.

Also seeOn-line: help for regress, graph, regdiag, anovaplot (if installed), sparl (if installed) Manual:

[U] 21 Programming Stata