This page demonstrates the use of JavaScript and DHTML to generate a linear regression and graph of a data set. If you are specifically interested in analyzing drug stability data, use this page. Enter x and y values in the table on the right, and then press the Replot! button. If some error in the data causes a problem with JavaScript, correct the data and use the Refresh feature of your browser.

The dotted red line represents the best fit of the data to a straight line via a least-squares linear regression. The slope, intercept and r-squared (the square of the correlation coefficient) are given below the graph. The r-squared is an indication of how well correlated the x and y values are. A perfect correlation would give an r-squared of 1.

The dotted green lines show a 90% double-sided confidence interval about the mean. You can be 90% confident that the true mean lies between the green lines. Viewed as single-sided confidence intervals, you can be 95% confident that either the true mean is below the upper green line, or that the true mean is above the lower green line.

A prediction can be made about the value of y by entering a value for x into the box on the lower left and clicking on Replot! The predicted mean value for y, along with upper and lower confidence values for y are calculated based on a 90% double-sided or 95% single-sided confidence interval.

If you need to print the graph, make sure your browser is set to print out webpage 'backgrounds'.

Other pages by the author. Email.
Debut: December 26, 2003. Revision No. 4. Wednesday, December 29, 2004