This page demonstrates the use of JavaScript and DHTML to generate a linear regression and graph of a data set, especially for monitoring stability of drug products. If you are interested in a general linear regression, see this page. Enter Time and Assay values in the table on the right. Enter a USL (upper specification limit), a target, and an LSL (lower specification limit) on the left, and a desired expiry date in the middle. 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 time and assay 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. The vertical grey lines indicate the stability testing start date (time zero) on the left, and the desired expiry date on the right. The horizontal grey lines indicate, from top to bottom, the USL, the target and the LSL. Generally, you want the lower green line to be above the LSL at the expiry date.

A prediction can be made about the value of the assay by entering a value for the time into the Expiry box and clicking on Replot! The predicted mean value for the assay, along with upper and lower confidence values for the assay 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: January 19, 2004. Revision No. 4. Wednesday, December 29, 2004