Using XGobi for visualising the geometry of regression with two
explanatory variables.
The function reggeom has exactly the same arguments as
xgobi(..), and it simply calls xgobi, but it has
different default values for the arguments than the defaults of
xgobi itself.
the default dataset is a matrix with three columns.
The rows represent the dependent and the two independent variables,
as well as fitted values and residuals in the regression on one
or both regressors, and other auxiliary variables.
Since the matrix has three columns, each variable is
represented as a vector in 3-dimensional space.
collab
column labels for matrx, by default "U", "V", and
"W", not very meaningful since the columns represent
oblique directions in n-dimensional space.
rowlab
character vector of labels for the variables;
by default, "x1" and "x2" for the independent and "y" for the
dependent variable, "o" for the origin, and other letters for the
auxiliary variables.
colors
as in xgobi all points are of the same color.
glyphs
as in xgobi all points are drawn with the same glyph.
erase
as in xgobi no points will be erased.
lines
the default lines argument displays some of the data in
matrx as straight lines. The user may want to substitute
different lines in order to emphasize or de-emphasize certain
relationships, as in the example given below.
linecolors
The default line colors are:
purple
for the dependent variable,
yellow
for the two independent variables,
green
for fitted values and residuals in the full regression,
red
for fitted values and residuals in the regression
on the first independent variable only, and
light blue
,
dark blue
, and
white
for auxiliary lines.
resources
by default, points and axes are not shown; only lines
are.
title
by default, "Regression Geometry"
vgroups
by default, all three variables are in the same group.
std
by default, the view is centered on the mean of the data.
nlinkable, subset, display
the same as in xgobi.
Details
If called without arguments, reggeom loads a dataset which
represents the geometry of regression with two explanatory variables.
The idea is to place the dataset into the rotation view in order to
get an intuition of the geometry involved. reggeom should only
then be called with arguments if specific built-in defaults must be
overriden.
The explanatory variables are x1=(5,0,0) and x2=(-1,4,0),
and the target (dependent) variable is y=(3,3,4).
However all coordinates are multiplied by 1156,
with the effect that all the points passed as arguments to
xgobi have integer coordinates.
Value
As in the call of xgobi,
the UNIX status upon completion, i.e. 0 if ok.
reggeom can be considered a 3-dimensional visualization
of the figures in Davidson, R. and MacKinnon, J. G. (1993)
Estimation and Inference in Economics, Oxford University
Press, p. 22.
The chapter “Additional Regressors” in Hans Ehrbar's on-line
econometrics class notes
http://www.econ.utah.edu/ehrbar/ecmet.pdf
uses reggeom for teaching and has several exercise
questions about it.
See Also
xgobi
Examples
reggeom()
## The arguments given in this example are modifications of the default,
## some lines dropped, some added, some line colors changed,
## in order to emphasize the geometry of backfitting.
reggeom(
lines= cbind(c(1,6,8,1,11,7,1,1,6,6,15,17,8,5,9, 5,6,14,15,16,14,15,5),
c(6,8,2,11,7,3,4,5,4,15,17,5,5,9,7,11,14,15,16,17,4,4,4)),
linecolors=c("red", rep("yellow",5), "orchid", "green",
"slateblue", rep("skyblue",3), rep("white",3), "skyblue",
rep("red",4), rep("slateblue", 2), "green"),
title="Regression Geometry - Backfitting")