Partial regression plots for subsamples
avplot3 varname ,separate(varname) [ graph_options ]
Description
avplot3 generates "partial regression plots" from an analysis of covariance model, where a category variable has been included in dummy-variable form among the regressors along with a constant term (that is, a dummy for all but one categories appears) and the full set of dummies have been interacted with a continuous variable. The "partial predictions" of such a model are then defined, for each category, as the category-specific constant term plus the category-specific slope multiplied by the continuous variable. Any number of additional covariates, continuous or discrete, may appear in the regression model, but do not affect the partial predictions.
Remarks
One variable must be specified: the continuous variable which has been fully interacted in the regression model. If there are G categories of the discrete variable, the continuous variable must be included as G interaction terms, each named categoryvarname x varname. See the example below.
The separate option must specify the integer variable (categoryvarname) that defines the G categories. The model must contain (G-1) dummy variables for all but one category, and a constant term. It is immaterial which category is excluded.
Options
graph_options are options of graph, twoway. One may use, for instance, the saving option to create a .gph file from the displayed graph.
The defaults include connect(l) for each subset of predicted values.
separate(varname) specifies the integer variable which defines categories.
Examples
. use auto
. drop if rep78==.
. recode rep78 1/2=2
. tab rep78,gen(repair)
. rename rep78 repair
. forv i=1/4 { g repair`i'xmpg = mpg*repair`i' }
. reg price length foreign repair2-repair4 repair1xmpg repair2xmpg repair3xmpg repair4xmpg
. avplot3 mpg, sep(repair)
Author
Christopher F Baum, Boston College, USA baum@bc.edu Acknowledgements
Nick Cox and his routines regplot and keyplot were indispensable in constru > cting this program. Development of the routine was inspired by conversations with > Rebekah Coley and Jodi Morris.
Also see
On-line: help for regress, graph, regdiag, regplot (if installed), sparl (if installed) Manual: [U] 21 Programming Stata