Simple Regression
Sample Java Applets from Seeing Statistics
by Gary McClelland
The best-fitting regression line minimizes the sum of the squared errors where an
error is defined as the distance between an observed value and its corresponding point
on the regression line. Use your mouse to drag (or just click in a new location) the slope
of the line. The meter on the left monitors your progress in minimizing the sum of squared
errors. The proportion of squared error removed is indicated in green in the meter; it
corresponds to the squared correlation, or,
equivalently, the proportional reduction in error. The intercept and slope of the current line are
displayed above the graph. If you want help in finding the best line, simply click on the
"Find Best Model" button. To remove (or redisplay) the error lines and their squares, click
on the "Hide/Show Errors" button.
Browser Notes:
- On Solaris/Unix: Does not work in Netscape 4.x but does work fine in Netscape 3.02.
- Works fine on both Windows95 and MacOS using either Netscape 4.x or IE4
Notes:
The initial error is determined by the horizontal line placed at the mean value of Y.
The line pivots about the point determined by the mean of X and the mean of Y.
The accuracy is limited by the pixel resolution. This applet is designed for
educational purposes only and should not be used for important statistical calculations.
Try Your Own Data
Note: The graph window currently does NOT open properly in IE4 on Windows95.
You may have your own data that you would like to try in the dynamic graph on this page.
Fill in
the boxes below and then click on "Open Graph Window." The examples for each entry show
how to recreate the graph above.
Open Graph Window
Note:
The correlation applet on this page is part of the electronic textbook Seeing Statistics.
This applet may not be copied, retransmitted, or used except on this page
without the express written permission of the author.
© 1998, Gary H. McClelland.
|