Apps & R packages maintained by YJL
stab for R
This package is used to analyze stability data. We follow the ICH guideline 'Q1E Evaluation for Stability Data' (USA FDA, 2004) to design this tool. The guideline describes when extrapolation should be considered as proposing a retest period for a drug substance or a shelf life of a drug product that extends beyond the period covered by available data from the stability study under the longterm storage condition.
Installation & Upgrade
Download and install R first. stab for R is an R package. However, it cannot be installed from R repository website since v0.1.9. Users have to download and install it from here. Please read the contents following the file list panel for more details first. No need to download the file README.md since it has been displayed on the screen. The file  NEWS includes the change history. Users will require an R script file called preinst.r from Sourceforge to install stab for R.
about preinst.r  from Sourceforge
PLEASE READ CAREFULLY TO SAVE YOUR TIME AND AVOID POSSIBLE ERRORS.
This file ("preinst.r") is not a part of R packages, but an R script to automate the installation for all the required packages/libraries for package stab for R. Please download preinst.r and place/copy it to the R working directory. Use 'getwd()' to find out where the directory is. Under R console, type source("preinst.r") and click the package to install. You require the system administrator's privilege (Windows & Linux) to run this script. Answer "Yes" if asked for anything during installation.GTK+ runtime is now bundled with RGtk2 package installation for the Windows platform, as well as more GTK+ (a.k.a. GTK2) themes were added. After installation, you now can run stab for R by simply typing "library(stab)" under R Console.
Methods
This package includes two steps. In the first step, the Decision Tree for Data Evaluation follows "Appendix A" of ICH guideline "Q1E Evaluation for Stability Data" that assists users evaluating stability data and guide users to consider doing an extrapolation for a proposed retest period or shelf life.
In the second step, Statistical Approaches to Stability Data Analysis is conducted for two different situations. First one is for a single batch. This approach estimates the retest period or shelf life for a single batch of drug product. The relationship between residuals and time is assumed to be linear. Twosided 95 % confidence intervals of the regression line for residuals (% relative to the original amount) of a drug product intersect with upper and lower acceptance criteria of label claimed. Then, the shortest one is the shelf life. When there are multiple batches (e.g. 3 batched) available, analysis of covariance (ANCOVA) is first employed to test the difference in slopes and intercepts of the regression lines with different factors (packages, dosage forms, etc.). Then, based on the statistical results, there can be three possibilities. (1). MODEL#1: slope (P>=0.25) and intercept (P>=0.25): the tests for equality of slopes and equality of intercepts are all no differences. The data from all batches then should be combined. Then, a single retest period or shelf life is estimated from the combined data. (2). MODEL #2: slope (P>=0.25) and intercept (P<0.25): the test rejects the hypothesis of equality of intercepts but fails to reject the hypothesis with that all slopes are equal. The data should be combined to estimate the common slope. The retest periods or shelf lives for individual batches can be estimated. Then, the shortest estimate among batches should be chosen as the shelf life for all batches. (3). MODEL#3: [slope (P<0.25) and intercept (P>=0.25)] or [slope (P<0.25) and intercept (P<0.25)]: the result in this scenario shows that the test rejects the hypothesis of equality of all slopes. It is not appropriate to combine the data from all batches in this situation. The retest periods or shelf lives for individual batches is estimated. Then, the shortest estimate among batches should be chosen as the shelf life for all batches. Please note the "batch" should be numerical ONLY (e.g., 1, 2, 3...) as the following example; otherwise, it may cause error. Please note that it will require at least 3 data points for each batch when MODEL#2 or MODEL #3 is chosen in order to calculate 95% confidence intervals.
Dataset format (very important to read): only *.csv is supported for stab for R. Users can download the dataset template/example (either the singlebatch or multiplebatch) from running stab for R.
CrossValidation:

USFDAprovided SAS Stability codes/dataset (no longer online available from USFDA website!): Please check with this .pdf file. Please note that in SAS output, the lines for the upper and lower ranges were drawn between 90% and 110% (as default). We did not change that (should be in the file  stab.dat marked with '/* line B */');

Dataset from a textbook (2008, pp.557724): Four datasets were illustrated in the textbook. One was singlebatch, and the other 3 datasets were for MODEL #1, MODEL #2 & MODEL #3, respectively. We analyzed these 4 datasets with both stab fo R (v 0.2.7) and Minitab. The results show in the following picture.