Regression & Correlation Scatterplot


Instructions on how to use the Applet

The graph above was generated with the following:
<applet code=scatterRegressFile.class NAME="scatterRegressFile" width=400 height=300>
<PARAM NAME="showLine" VALUE="true">
<PARAM NAME="showFormula" VALUE="true">
<PARAM NAME="mousePointer" VALUE="true">
<PARAM NAME="xMin" VALUE="50">
<PARAM NAME="xMax" VALUE="80">
<PARAM NAME="yMin" VALUE="60">
<PARAM NAME="yMax" VALUE="250">
<PARAM NAME="title" VALUE="Height and Weight">
<PARAM NAME="n" VALUE="9">
<PARAM NAME="data" VALUE="sampledata.txt">
</applet>

Required <PARAM>'s

n

You must specify how many data pairs are in the text file that contains your data. An example:

<PARAM NAME="n" VALUE="9">

data

You must specify the name of the text file that contains your data pairs. Example:

<PARAM NAME="data" VALUE="sampledata.txt">

The data file should be in the same directory as your html file. Each line has two numbers that are separated by a space. The first number on the line should have your explanitory (x) variable, and the second number is the response (y) variable. The file must be an ordinary text file. If you want the applet to ignore a line (so you can add your own comments) place a # sign as the first character of the line. The data file for the sample plot above looks like:

# This line is igored because it starts with a # character
# This data is fake height and weight pairs
60 84
62 95
64 140
66 155
68 119
70 175
72 145
74 197
76 150

Optional <PARAM>'s

If you don't want a feature, simply omit the parameter.

showLine

To have the regression line plotted with your data:

<PARAM NAME="showLine" VALUE="true">

showFormula

To have the regression line information displayed:

<PARAM NAME="showFormula" VALUE="true">

title

To have the title on the top:

<PARAM NAME="title" VALUE="My cool Data">

To specify the range of the x and y axes

If any of these four parameters are missing, the applet will use the data itself to determine the range of the graph. The disadvantage is that the numbers on the axes might be strange decimals that do not look very neat. To specify your own range:

<PARAM NAME="xMin" VALUE="50">
<PARAM NAME="xMax" VALUE="80">
<PARAM NAME="yMin" VALUE="60">
<PARAM NAME="yMax" VALUE="250">

To have the mouse identify the co-ords on the graph:

<PARAM NAME="mousePointer" VALUE="true">

Java Source

Java Applet written by Fr. Chris Thiel, OFMCap 1999.10.26. Click here for source. Click here to download the class file. Place this in the same directory as your .html file and your data file.

If you have difficulty try downloading one of these archives:

scatreg.zip
scatreg.sea
scatreg.sea.hqx