Function groups -
teachware quantlet twlinreg gives visual insight into how
least squares simple linear regression works, and the
relationship between the regression of Y on X, X on Y,
and total regression.
Härdle, W., Klinke, S. and Marron, J.S. (1999) Connected
teaching of statistics
|x ||matrix (n x 2) with user defined data
The data are bivariate Gaussian,
and a menu allows control of the number of data points,
and the correlation.Intuitive understanding of least squares
fitting is conveyed through interactive manipulation of a
candidate fit line. A menu gives control over this process,
through incremental adjustments that are selected by check boxes,
followed by a push of the "OK" button. The main graphics
window shows the data scatterplot, together with the least
squares fit line. A text component shows the equation of the
current line (which changes as the line is manipulated), together
with the Residual Sum of Squares which gives a numerical summary
of the goodness of fit. Very effective visual indication
of what RSS means comes from the lower graphics part of this
window, which represents the residuals as vertical lines.
When the fit is poor (and hence the RSS is large), the residual
plot shows why, and give a clear indication of how the
line should be moved to improve the quality of the fit to the data.
The parameter x is optional. If it is not given, the user
is asked to define the desired correlation interactively.
; load teachware library
; predefine matrix
x = normal(100,2)
; call twlinreg teachware quantlet
a three window port display with the scatterplot of the matrix x
in the upper port and the values of the RSS and the regression
equation in the middle (text) port. The lower port is reserved for
display of the current residuals.
S. Klinke, W. Haerdle, 19990103
(C) MD*TECH Method and Data Technologies, 05.02.2006