------------------------------------------------------------------------------- help foranovaplot-------------------------------------------------------------------------------

Plots of ANOVA fit, including interaction plots

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

anovaplotvarlist[,scatter(scatter_options)connected_optionsplot(plot)] ]

Description

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

RemarksWith the first syntax, no

varlistis specified.anovaplotshows the response and predicted values on theyaxis; the predictor named first in theanovacommand on thexaxis; any predictor named second in theanovacommand by separate groups within a twoway plot; and any predictor named third in theanovacommand by separate images using aby()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 theanovacommand.With the second syntax, a

varlistis 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 theanovacommand.Note especially that the graph format produced by

anovaplotis appropriate for models with at most one continuous predictor, which should always be the predictor named first. With that caveat,anovaplotoffers 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_optionsare 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 systolicOne-way anova:

systolicas response onyaxis,drugas factor onxaxis:

. anova systolic drug. anovaplotTwo-way anova, no interaction term:

systolicas response onyaxis,diseaseanddrugas factors, withdiseaseonxaxis, and levels ofdrugdefining separate profiles:

. anova systolic disease drug. anovaplotBetter to reverse order of predictors:

. anovaplot drug diseaseExample of interaction term:

. anova systolic drug disease drug * disease. anovaplotAs 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))

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

AcknowledgementsKen Higbee provided very helpful comments.

Also see