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.

    Return to Menu Page

    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.

    Enter a name for your X or predictor or independent variable:
    (Short names are best and names may not contain blanks; e.g., Height)

    Enter the data values for X separated by blanks or commas in one long row. The maximum number of data values is 25, but fewer are usually better to avoid too much clutter.

    X or Predictor or IV:
    (e.g., 68 63 71 69 65 73 71 69 67 64
    Note: you may cut and paste to enter the data.)

    Enter a name for your Y or criterion or dependent variable:
    (e.g., Weight)

    Enter the data values for Y separated by blanks or commas in one long row.

    Y or Criterion or DV:
    (e.g., 145 110 185 163 120 172 160 150 140 145
    Note: you may cut and paste to enter the data.)

    Open Graph Window

    Return to Menu Page

    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.

  •