stab for R v0.1.8
(submitted to CRAN on Dec. 30, 2013)
A Data Analysis Tool for Drug Stability
with R
 (play the flash demo)


Created by Hsin-ya Lee , and Yung-jin Lee (mobilepk@gmail.com)
Kaohsiung Veterans General Hospital (HY) &
ptpc, inc. (YJ), Kaohsiung, Taiwan 807



Introduction:
This package is used to analyze stability data.  We follow the ICH guideline 'Q1E Evaluation for Stability Data' (linked to USA FDA site) to design this tool (Here's its .pdf.). This 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 long-term storage condition.

Installation & Upgrade: stab for R is one of R packages.  Thus, users have to download and install R first, and then run it.  Under R Console, users can click "Packages" from the menu then ->"Install package(s)..." --> select a CRAN mirror site near you and you will see the list of currently available R packages.  Just select "stab" from the list and click "OK" to start installation.  Then it's done!  If you want to upgrade from
previous version of stab for R when a new version is released, please go the menu and click "Packages", and then select "Update packages...".  then select a CRAN mirror site near you and click "OK".  Done!  Pretty easy to upgrade.  If you're running Linux PC or Mac OS X, you may not see the menu but the R Console.  You can read this R Installation and Administration (pdf ) for detailed information.  You can also type help("INSTALL") or help("install.packages") in R Console for information on how to install packages from this directory.  Don't worry about this. You only need to do this once.  After these installation, you now can run stab by simply typing "library(stab) (enter)" under R Console.

Remove stab for R: Simply go to the directory of R where you installed and then go to the sub-directory of /library, delete stab.

Methods:: 
This package includes two steps.  In the first step, 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 batchThis 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.  Two-sided 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).  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).  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).  [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.



Cross Validation with FDA provided SAS Stability
programs:  Please check with this .pdf file and use bookmarks to browse this pdf file. Please note that in SAS output, the lines for the upper and lower ranges were drawn between 90% and 110% (set as default). We did not change that (should be in the file - stab.dat marked with '/* line B */'), though we used different ranges; however, they would not affect the final results. They were just like marks over there.


Note: Since v0.1.5, all plots will be saved as .pdf file (such as this one) after runs. Check your working directory for all outputs.

Sample output file


------------------ stab for R v0.1.5 -------------------

 developed by Hsin-ya Lee and Yung-jin Lee, 2007-2013.

 generated on Sun Apr 14 06:02:26 2013 


<< --- List of input data --- >>

   batch time assay
1      1    0  98.4
2      1    3  96.1
3      1    6  94.2
4      1    9  93.5
5      1   12  90.0
6      1   18  89.1
7      1   24  89.2
8      1   36  87.3
9      2    0  99.1
10     2    3  97.2
11     2    6  96.3
12     2    9  95.2
13     2   12  93.4
14     2   18  91.5
15     2   24  90.3
16     3    0 104.1
17     3    3 102.1
18     3    6  99.5
19     3    9  98.1
20     3   12  95.7
21     3   18  94.1
22     3   24  94.0
23     3   36  93.5


 Analysis settings for multiple batches:
 ---------------------------------------------
 The lower acceptance limit is set to 90 %.

<>


Analysis of Variance Table

Response: assay
           Df  Sum Sq Mean Sq F value    Pr(>F)    
batch       2 117.410  58.705 21.6350 2.128e-05 ***
time        1 230.376 230.376 84.9025 5.067e-08 ***
batch:time  2   1.978   0.989  0.3645    0.6998    
Residuals  17  46.128   2.713                      
---
Signif. codes:  0 .***・ 0.001 .**・ 0.01 .*・ 0.05 ..・ 0.1 . ・ 1


       Type     P values
1 Intercept 2.127905e-05
2     Slope 6.998373e-01
--------------------------
at a sig. level of 0.25.

--------------------------------------------------------------------------
          << ANCOVA Output: Testing for poolability of batches >>         
--------------------------------------------------------------------------
                                                                          
 The test rejects the hypothesis of equality of intercepts but fails to   
 reject that the slopes are equal (there is a significant difference in   
 intercepts but no significant difference in slopes among the batches).   
                                                                          
               << Model #2: one-sided lower LC analysis >>                  
         separate intercepts with a common slope among batches.           
------------------------------------------------------------------------

              << linear regression model: Assay (%) vs. time >>             


Call:
lm(formula = assay ~ batch + time, data = ANCOVAdata)

Coefficients:
(Intercept)       batch2       batch3         time  
    96.3686       1.5027       5.4125      -0.3069  

Analysis of Variance Table

Response: assay
          Df  Sum Sq Mean Sq F value    Pr(>F)    
batch      2 117.410  58.705  23.186 7.979e-06 ***
time       1 230.376 230.376  90.989 1.120e-08 ***
Residuals 19  48.106   2.532                      
---
Signif. codes:  0 .***・ 0.001 .**・ 0.01 .*・ 0.05 ..・ 0.1 . ・ 1

**************************************************************************
                               << Output >>                               
--------------------------------------------------------------------------
                    << Summary: linear regression model >>                

 --- Batch#: 1 ---

Y = 96.36857 +( -0.3069313 ) X


   Time  Observed assay(%)  Calculated assay(%)  Residuals
1     0               98.4             96.36857 -2.0314274
2     3               96.1             95.44778 -0.6522213
3     6               94.2             94.52698  0.3269848
4     9               93.5             93.60619  0.1061909
5    12               90.0             92.68540  2.6853970
6    18               89.1             90.84381  1.7438091
7    24               89.2             89.00222 -0.1977787
8    36               87.3             85.31905 -1.9809543


-- List of 95% CI for 84-month Time Interval:-

   time      fit    Lower starred
1     0 96.36857 94.96301        
2     1 96.06164 94.74064        
3     2 95.75471 94.51630        
4     3 95.44778 94.28957        
5     4 95.14085 94.05992        
6     5 94.83392 93.82667        
7     6 94.52698 93.58897        
8     7 94.22005 93.34576        
9     8 93.91312 93.09577        
10    9 93.60619 92.83747        
11   10 93.29926 92.56921        
12   11 92.99233 92.28933        
13   12 92.68540 91.99648        
14   13 92.37847 91.68985        
15   14 92.07153 91.36943        
16   15 91.76460 91.03598        
17   16 91.45767 90.69085        
18   17 91.15074 90.33568        
19   18 90.84381 89.97215     ***
20   19 90.53688 89.60175     ***
21   20 90.22995 89.22581     ***
22   21 89.92302 88.84537     ***
23   22 89.61608 88.46130     ***
24   23 89.30915 88.07429     ***
25   24 89.00222 87.68485     ***
26   25 88.69529 87.29344     ***
27   26 88.38836 86.90037     ***
28   27 88.08143 86.50592     ***
29   28 87.77450 86.11032     ***
30   29 87.46756 85.71373     ***
31   30 87.16063 85.31630     ***
32   31 86.85370 84.91814     ***
33   32 86.54677 84.51936     ***
34   33 86.23984 84.12004     ***
35   34 85.93291 83.72023     ***
36   35 85.62598 83.32001     ***
37   36 85.31905 82.91943     ***
38   37 85.01211 82.51851     ***
39   38 84.70518 82.11730     ***
40   39 84.39825 81.71583     ***
41   40 84.09132 81.31412     ***
42   41 83.78439 80.91220     ***
43   42 83.47746 80.51010     ***
44   43 83.17053 80.10781     ***
45   44 82.86360 79.70537     ***
46   45 82.55666 79.30279     ***
47   46 82.24973 78.90008     ***
48   47 81.94280 78.49724     ***
49   48 81.63587 78.09429     ***
50   49 81.32894 77.69125     ***
51   50 81.02201 77.28810     ***
52   51 80.71508 76.88487     ***
53   52 80.40814 76.48156     ***
54   53 80.10121 76.07818     ***
55   54 79.79428 75.67472     ***
56   55 79.48735 75.27121     ***
57   56 79.18042 74.86763     ***
58   57 78.87349 74.46399     ***
59   58 78.56656 74.06030     ***
60   59 78.25963 73.65656     ***
61   60 77.95269 73.25278     ***
62   61 77.64576 72.84895     ***
63   62 77.33883 72.44508     ***
64   63 77.03190 72.04117     ***
65   64 76.72497 71.63723     ***
66   65 76.41804 71.23325     ***
67   66 76.11111 70.82924     ***
68   67 75.80418 70.42520     ***
69   68 75.49724 70.02112     ***
70   69 75.19031 69.61703     ***
71   70 74.88338 69.21290     ***
72   71 74.57645 68.80875     ***
73   72 74.26952 68.40458     ***
74   73 73.96259 68.00038     ***
75   74 73.65566 67.59616     ***
76   75 73.34873 67.19193     ***
77   76 73.04179 66.78767     ***
78   77 72.73486 66.38339     ***
79   78 72.42793 65.97910     ***
80   79 72.12100 65.57479     ***
81   80 71.81407 65.17047     ***
82   81 71.50714 64.76612     ***
83   82 71.20021 64.36177     ***
84   83 70.89327 63.95740     ***
85   84 70.58634 63.55301     ***


 --- Batch#: 2 ---

Y = 97.87129 +( -0.3069313 ) X


   Time  Observed assay(%)  Calculated assay(%)   Residuals
1     0               99.1             97.87129 -1.22870662
2     3               97.2             96.95050 -0.24950053
3     6               96.3             96.02971 -0.27029443
4     9               95.2             95.10891 -0.09108833
5    12               93.4             94.18812  0.78811777
6    18               91.5             92.34653  0.84652997
7    24               90.3             90.50494  0.20494217


-- List of 95% CI for 84-month Time Interval:-

   time      fit    Lower starred
1     0 97.87129 95.90047        
2     1 97.56436 95.72657        
3     2 97.25743 95.55069        
4     3 96.95050 95.37234        
5     4 96.64357 95.19086        
6     5 96.33664 95.00536        
7     6 96.02971 94.81465        
8     7 95.72277 94.61708        
9     8 95.41584 94.41040        
10    9 95.10891 94.19162        
11   10 94.80198 93.95696        
12   11 94.49505 93.70204        
13   12 94.18812 93.42274        
14   13 93.88119 93.11641        
15   14 93.57426 92.78298        
16   15 93.26732 92.42501        
17   16 92.96039 92.04661        
18   17 92.65346 91.65213        
19   18 92.34653 91.24540        
20   19 92.03960 90.82946        
21   20 91.73267 90.40657        
22   21 91.42574 89.97840     ***
23   22 91.11880 89.54617     ***
24   23 90.81187 89.11078     ***
25   24 90.50494 88.67289     ***
26   25 90.19801 88.23301     ***
27   26 89.89108 87.79150     ***
28   27 89.58415 87.34867     ***
29   28 89.27722 86.90475     ***
30   29 88.97029 86.45990     ***
31   30 88.66335 86.01428     ***
32   31 88.35642 85.56800     ***
33   32 88.04949 85.12116     ***
34   33 87.74256 84.67382     ***
35   34 87.43563 84.22607     ***
36   35 87.12870 83.77794     ***
37   36 86.82177 83.32949     ***
38   37 86.51484 82.88075     ***
39   38 86.20790 82.43175     ***
40   39 85.90097 81.98253     ***
41   40 85.59404 81.53311     ***
42   41 85.28711 81.08350     ***
43   42 84.98018 80.63372     ***
44   43 84.67325 80.18380     ***
45   44 84.36632 79.73374     ***
46   45 84.05938 79.28356     ***
47   46 83.75245 78.83327     ***
48   47 83.44552 78.38288     ***
49   48 83.13859 77.93239     ***
50   49 82.83166 77.48181     ***
51   50 82.52473 77.03115     ***
52   51 82.21780 76.58042     ***
53   52 81.91087 76.12962     ***
54   53 81.60393 75.67876     ***
55   54 81.29700 75.22784     ***
56   55 80.99007 74.77687     ***
57   56 80.68314 74.32584     ***
58   57 80.37621 73.87477     ***
59   58 80.06928 73.42365     ***
60   59 79.76235 72.97249     ***
61   60 79.45542 72.52129     ***
62   61 79.14848 72.07005     ***
63   62 78.84155 71.61878     ***
64   63 78.53462 71.16748     ***
65   64 78.22769 70.71615     ***
66   65 77.92076 70.26479     ***
67   66 77.61383 69.81340     ***
68   67 77.30690 69.36198     ***
69   68 76.99996 68.91054     ***
70   69 76.69303 68.45908     ***
71   70 76.38610 68.00759     ***
72   71 76.07917 67.55609     ***
73   72 75.77224 67.10456     ***
74   73 75.46531 66.65302     ***
75   74 75.15838 66.20146     ***
76   75 74.85145 65.74988     ***
77   76 74.54451 65.29828     ***
78   77 74.23758 64.84667     ***
79   78 73.93065 64.39505     ***
80   79 73.62372 63.94341     ***
81   80 73.31679 63.49176     ***
82   81 73.00986 63.04009     ***
83   82 72.70293 62.58841     ***
84   83 72.39600 62.13672     ***
85   84 72.08906 61.68502     ***


 --- Batch#: 3 ---

Y = 101.7811 +( -0.3069313 ) X


   Time  Observed assay(%)  Calculated assay(%)  Residuals
1     0              104.1            101.78107 -2.3189274
2     3              102.1            100.86028 -1.2397213
3     6               99.5             99.93948  0.4394848
4     9               98.1             99.01869  0.9186909
5    12               95.7             98.09790  2.3978970
6    18               94.1             96.25631  2.1563091
7    24               94.0             94.41472  0.4147213
8    36               93.5             90.73155 -2.7684543


-- List of 95% CI for 84-month Time Interval:-

   time       fit     Lower starred
1     0 101.78107 100.17274        
2     1 101.47414  99.97000        
3     2 101.16721  99.76538        
4     3 100.86028  99.55843        
5     4 100.55335  99.34859        
6     5 100.24642  99.13508        
7     6  99.93948  98.91691        
8     7  99.63255  98.69276        
9     8  99.32562  98.46089        
10    9  99.01869  98.21915        
11   10  98.71176  97.96493        
12   11  98.40483  97.69544        
13   12  98.09790  97.40821        
14   13  97.79097  97.10171        
15   14  97.48403  96.77589        
16   15  97.17710  96.43223        
17   16  96.87017  96.07320        
18   17  96.56324  95.70157        
19   18  96.25631  95.31995        
20   19  95.94938  94.93054        
21   20  95.64245  94.53508        
22   21  95.33552  94.13490        
23   22  95.02858  93.73103        
24   23  94.72165  93.32422        
25   24  94.41472  92.91507        
26   25  94.10779  92.50403        
27   26  93.80086  92.09143        
28   27  93.49393  91.67756        
29   28  93.18700  91.26262        
30   29  92.88006  90.84678        
31   30  92.57313  90.43019        
32   31  92.26620  90.01294        
33   32  91.95927  89.59514     ***
34   33  91.65234  89.17686     ***
35   34  91.34541  88.75815     ***
36   35  91.03848  88.33908     ***
37   36  90.73155  87.91968     ***
38   37  90.42461  87.50000     ***
39   38  90.11768  87.08006     ***
40   39  89.81075  86.65989     ***
41   40  89.50382  86.23952     ***
42   41  89.19689  85.81897     ***
43   42  88.88996  85.39825     ***
44   43  88.58303  84.97738     ***
45   44  88.27610  84.55638     ***
46   45  87.96916  84.13525     ***
47   46  87.66223  83.71401     ***
48   47  87.35530  83.29266     ***
49   48  87.04837  82.87122     ***
50   49  86.74144  82.44970     ***
51   50  86.43451  82.02809     ***
52   51  86.12758  81.60641     ***
53   52  85.82064  81.18466     ***
54   53  85.51371  80.76284     ***
55   54  85.20678  80.34097     ***
56   55  84.89985  79.91904     ***
57   56  84.59292  79.49706     ***
58   57  84.28599  79.07503     ***
59   58  83.97906  78.65295     ***
60   59  83.67213  78.23083     ***
61   60  83.36519  77.80868     ***
62   61  83.05826  77.38649     ***
63   62  82.75133  76.96426     ***
64   63  82.44440  76.54200     ***
65   64  82.13747  76.11970     ***
66   65  81.83054  75.69738     ***
67   66  81.52361  75.27503     ***
68   67  81.21668  74.85266     ***
69   68  80.90974  74.43026     ***
70   69  80.60281  74.00784     ***
71   70  80.29588  73.58539     ***
72   71  79.98895  73.16293     ***
73   72  79.68202  72.74044     ***
74   73  79.37509  72.31793     ***
75   74  79.06816  71.89541     ***
76   75  78.76123  71.47287     ***
77   76  78.45429  71.05031     ***
78   77  78.14736  70.62774     ***
79   78  77.84043  70.20515     ***
80   79  77.53350  69.78255     ***
81   80  77.22657  69.35993     ***
82   81  76.91964  68.93731     ***
83   82  76.61271  68.51466     ***
84   83  76.30577  68.09201     ***
85   84  75.99884  67.66935     ***


**************************************************************************
                       << Summary and plots >>                            
--------------------------------------------------------------------------


                     One-sided lower LC analysis                        

   batch#   shelf-life*
1       1            17
2       2            20
3       3            31
-------------------------
*: estimated shelf-life


 Ps. When shelf-life = 84, it means that stab
 cannot find a reasonable shelf-life for the
 batch with presented dataset within 84 months.

 -----------------------------------------------------------------

 Drug product with lower acceptance limit of 90 % of label claimed
 shelf-life = 17 (months)                          

******************************************************************