{smcl} {* *! version 1.2.3 23Oct2019}{...} {viewerdialog avplots "dialog avplot"}{...} {vieweralsosee "[R] regress postestimation diagnostic plots" "mansection R regresspostestimationdiagnosticplots"}{...} {vieweralsosee "" "--"}{...} {vieweralsosee "[R] regress" "help regress"}{...} {vieweralsosee "[R] regress postestimation" "help regress postestimation"}{...} {vieweralsosee "[R] regress postestimation ts" "help regress postestimation ts"}{...} {viewerjumpto "Description" "reganat2##description"}{...} {cmd:Available from:}{right: ({net "from http://digital.cgdev.org/doc/stata":CGD's Stata Programs})} Enhanced version of: {cmd:help reganat}{right: ({browse "http://www.stata-journal.com/article.html?article=st0285":SJ13-1: st0285})} {hline} {title:Title} {p2colset 5 16 18 2}{...} {p2col :{hi:reganat2} {hline 2}}Graphical inspection of linear multivariate models{p_end} {p2colreset}{...} {title:Syntax} {p 8 14 2} {cmd:reganat2} {depvar} {varlist} {ifin} [{cmd:,} {it:options}] {synoptset 23}{...} {synopthdr} {synoptline} {it:Options in the original program, {cmd:reganat}} {synopt :{opt d:is(varlist)}}graph only the variables in {it:varlist} and omit the rest{p_end} {synopt :{opt l:abel(varname)}}use {it:varname} to label observations in the scatterplot{p_end} {synopt :{opt bis:cat}}plot a scatterplot for the bivariate linear model{p_end} {synopt :{opt bil:ine}}plot a regression line for the bivariate linear model{p_end} {synopt :{opt r:eg}}display results for estimation of the multivariate model{p_end} {synopt :{opt nol:egend}}prevent legend from being displayed{p_end} {synopt :{opt noc:ovlist}}prevent list of covariates from being displayed{p_end} {synopt :{opt f:wl}}use Frisch-Waugh-Lovell formulation in place of regression anatomy{p_end} {synopt :{opt sem:ip}}add a table with a decomposition of the model's variance{p_end} {synopt :{opt s:cheme(graphical_scheme)}}specify graphical scheme{p_end} {synoptline} {it:Options added in this program, {cmd:reganat2}} {synopt :{opt xoff:set(xoff_spec)}}Add the specified constant to x_tilde before graphing{p_end} {synopt :{opt c:entroid}}Plot horizontal and vertical lines through the centroid of the data{p_end} {synopt :{opt name(name [,replace])}}Provide a name to designate the created memory graph{p_end} {synopt :{opt saving(stub [,replace])}}Save the graphics files and name them beginning with this stub{p_end} {synopt :{opt store}}Store all the separate regressions using Stata's {help estimates store} command.{p_end} {synoptline} {p2colreset}{...} {marker description}{...} {title:Description} {pstd}{cmd:reganat} is a graphical tool for inspecting the effect of a covariate on a dependent variable in the context of multivariate ordinary least-squares (OLS) estimation. The name is an acronym for the expression "regression anatomy", a result in OLS algebra originally due to Frisch and Waugh (1933) and recently revived by Angrist and Pischke's {it:Mostly Harmless Econometrics} (2009). {pstd}In a bivariate regression model, Y = bx1 + g, the graphical inspection of the scatterplot provides useful information on the relation between the independent variable x1 and the dependent variable Y; but the inspection can be highly misleading when the underlying real model is multivariate of the type Y = X'B + e, where X' also includes x1. In general, the OLS multivariate estimator is not equivalent to an OLS estimator obtained using a separate regression on each independent variable because correlation among independent variables must be accounted for. Angrist and Pischke (2009) show that in a multiple regression model, the regression parameter for a given regressor is the bivariate slope coefficient for the corresponding regressor after partialling out all other covariates. Accordingly, {cmd:reganat} displays a table of scatterplots, with the dependent variable plotted against the independent variable free of any linear correlation with the other independent variables. This combined graph can be helpful when inspecting the data for outliers, nonlinearities, and other modeling issues. {pstd}This version adds the five additional options, {cmd:xoffset}, {cmd:centroid}, {cmd:name}, {cmd:saving} and {cmd:store}. As explained in {browse "http://www.stata-journal.com/article.html?article=st0285":SJ13-1: st0285}, the program {cmd:reganat} with the {opt f:wl} option plots a "corrected" version of the dependent variable on the ordinate (the vertical axis) and a "corrected" value of an independent variable on the abscissa (the horizontal axis), where "correction" consists of computing the residual from a regression of each of these variables on all the other independent variables in the multiple regression. Residuals from an OLS regression always have zero means. While {cmd:reganat} adds the mean of the dependent variable back to the residuals before plotting the "corrected" y variable, it leaves the "corrected" independent variable with a zero mean. Specifying the option {cmd:xoffset(mean)} adds the mean of the independent variable to its "corrected" values before it is plotted, thus making the scatter plot easier to interpret in the original units of both variables. {pstd}The {cmd:centroid} option simply adds "crosshairs" to the graph which identify the point of means. {pstd}The published version of {cmd:reganat} produced interesting graphs, but had no built-in option to name them as Stata memory graphs or to save them as Stata {cmd:gph} files. The {cmd:name()} and {cmd:saving()} options add this functionality. {pstd}The {cmd:store} option, new in version 1.24, applies Stata's {help estimates store} command to store in memory all the regressions computed by the program. The multiple regression is stored with the name {cmd:reganat2_mv} and the auxiliary regressions as {cmd:reganat2_{it:X}}, where {it:X} is the name of one of the right-hand-side variables. {title:Options} {phang}{opt dis(varlist)} restricts the output to the variables in {it:varlist} and excludes the rest. Only the specified {it:varlist} will be graphed; nonetheless, the other regressors will be used in the background calculations. {phang}{opt label(varname)} uses {it:varname} to label the observations in the scatterplot. {phang}{opt biscat} specifies that on the graph will also be displayed the scatterplot for (Y,x1), where x1 is the variable of interest. {phang}{opt biline} adds to each subgraph a regression line calculated over the univariate model in which the dependent variable is regressed only on the regressor under study. To distinguish the two regression lines that appear on the same graph, {cmd:biline} uses a dashed pattern for the one for the univariate model. {phang}{opt reg} displays the output of the regression command for the complete model. {phang}{opt nolegend} prevents the legend from being displayed. {phang}{opt nocovlist} prevents the list of covariates from being displayed. {phang}{cmd:fwl} uses the Frisch-Waugh-Lovell formulation in place of regression anatomy. With this option, the partial scatter plots produced are identical to those produced by Stata's {help avplots} command. {phang}{cmd:semip} adds a table with a decomposition of the model's variance. {phang}{opt scheme(graphical_scheme)} specifies the graphical scheme to be applied to the composite graph. The default is {cmd:scheme(sj)}. {phang}{opt xoff:set(xoff_spec)} Add the specified constant to x_tilde before graphing. Possible values are: mean, min, max, p50, or any other r(.) macro from {cmd:sum, detail}. Or the user may specify a scalar value. {phang}{opt c:entroid} Plot horizontal and vertical lines through the centroid of the data {phang}{opt saving(stub [,replace])} Save the graphics files and name them beginning with this stub{p_end} {title:Examples} {pstd}Setup{p_end} {phang2}{cmd:. sysuse auto}{p_end} {pstd}Obtain a combined graph of the effect of several regressors{p_end} {phang2}{cmd:. reganat2 price length weight headroom mpg}{p_end} {pstd}To the previous command, add the options {cmd:xoffset(mean)} and {cmd:centroid}{p_end} {phang2} {cmd:. reganat2 price length weight headroom mpg, centroid xoffset(mean)} {p_end} {pstd}Obtain a combined graph of the effect of a subset of the regressors, along with scatterplots and fitted line for the univariate models{p_end} {phang2}{cmd:. reganat2 price length weight headroom mpg, dis(weight length) biline}{p_end} {pstd}The options {cmd:xoffset(mean)} and {cmd:centroid} are also compatible with the {cmd:dis()} and {cmd:biline} options.{p_end} {phang2}{cmd:. reganat2 price length weight headroom mpg, dis(weight length) biline centroid xoffset(mean)}{p_end} {title:Acknowledgments} {pstd}Valerio Filoso wishes to express his deep gratitude to Joshua Angrist for a number of insights and comments that have greatly enhanced the scope and reliability of this command. And Mead Over in turn thanks M. Filoso for approving these additional options. {title:References} {phang}Angrist, J. D., and J.-S. Pischke. 2009. {it:Mostly Harmless Econometrics: An Empiricist's Companion}. Princeton, NJ: Princeton University Press. {phang}Frisch, R., and F. V. Waugh. 1933. Partial time regressions as compared with individual trends. {it:Econometrica} 1: 387-401. {title:Author} {pstd}Valerio Filoso{p_end} {pstd}Department of Economics{p_end} {pstd}University of Naples "Federico II"{p_end} {pstd}Naples, Italy{p_end} {pstd}filoso@unina.it{p_end} {title:Additional options added by} {pstd}Mead Over{p_end} {pstd}Center for Global Development{p_end} {pstd}Washington, DC USA{p_end} {pstd}mover@cgdev.org{p_end} {title:Also see} {p 4 14 2}Article: {it:Stata Journal}, volume 13, number 1: {browse "http://www.stata-journal.com/article.html?article=st0285":st0285}{p_end} {* version 1.2 12sep2012}{...} {* version 1.2.1 10May2013}{...} {* version 1.2.2 7Sep2017 Add note that fwl option makes graph same as avplots}{...} {* version 1.2.3 23Oct2019 Fix https link for CGD Stata Programs}{...}