-------------------------------------------------------------------------------
help for anovaplot
-------------------------------------------------------------------------------

Plots of ANOVA fit, including interaction plots

anovaplot [, scatter(scatter_options) connected_options plot(plot) ] ]

anovaplot varlist [, scatter(scatter_options) connected_options plot(plot) ] ]

Description

anovaplot plots fitted or predicted values from an immediately previous one-, two- or three-way anova. By default the data for the response are also plotted. In particular, anovaplot can show interaction plots.

Remarks

With the first syntax, no varlist is specified. anovaplot shows the response and predicted values on the y axis; the predictor named first in the anova command on the x axis; any predictor named second in the anova command by separate groups within a twoway plot; and any predictor named third in the anova command by separate images using a by() option. Thus with this syntax the appearance of the plot, although not the values shown, is sensitive to the order in which predictors are specified in the anova command.

With the second syntax, a varlist is supplied, which must be a permutation of the predictors previously used. The order of the predictors in the varlist is used to determine the form of the graph, as above. This permits changing graphs without reissuing the anova command.

Note especially that the graph format produced by anovaplot is appropriate for models with at most one continuous predictor, which should always be the predictor named first. With that caveat, anovaplot offers a way of showing parallel and diverging regression lines for models with one continuous predictor.

Options

scatter() specifies options of scatter which should be specified to control plotting of fitted values.

To suppress plotting of response data, specify scatter(ms(i)).

To separate tied values of response, specify scatter(jitter(1)).

connected_options are options of twoway connected which should be specified to control plotting of fitted values.

plot(plot) provides a way to add other plots to the generated graph; see plot_option.

Examples

. webuse systolic

One-way anova: systolic as response on y axis, drug as factor on x axis:

. anova systolic drug . anovaplot

Two-way anova, no interaction term: systolic as response on y axis, disease and drug as factors, with disease on x axis, and levels of drug defining separate profiles:

. anova systolic disease drug . anovaplot

Better to reverse order of predictors:

. anovaplot drug disease

Example of interaction term:

. anova systolic drug disease drug * disease . anovaplot

As above, but no plotting of data:

. anovaplot, scatter(ms(i))

Examples with one continuous predictor:

. sysuse auto . decode foreign, gen(Foreign) . gen F = substr(Foreign,1,1)

The continuous predictor is named just after the response:

. anova price weight foreign, cont(weight)

(N.B. parallel regression lines)

. anovaplot, scatter(ms(i) mla(F) mlabpos(0))

. anova price weight foreign weight*foreign, cont(weight)

(N.B. diverging regression lines)

. anovaplot, scatter(ms(i) mla(F) mlabpos(0))

Author

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

Acknowledgements

Ken Higbee provided very helpful comments.

Also see