bear v2.3.1 (uploaded on April 16, 2009) -
data analysis tool for average
bioequivalence
(ABE) and bioavailability
for R

Created by Hsin-ya Lee (hsinyalee@gmail.com), and
Yung-jin Lee (mobilePK@gmail.com)

College of Pharmacy, Kaohsiung Medical University
Kaohsiung, Taiwan 807

Introduction
This package is used to analyze average bioequivalence (ABE) data from noncompartmental analysis (NCA) to ANOVA (lm in R). Study design of ABE should be a 2-treatment,  2-sequence, and 2-period crossover design. The statistical analysis for bioavailability (BA) measurements (AUCs and Cmax) is based on the two one-sided tests (Schuirmann, 1987).  ABE involves the calculation of 90% confidence intervals (90%CIs) for the ratio of the averages of the measures for the test and reference products. The BE will be concluded based on the calculated 90%CIs falling within 80-125% or user's defined acceptance range. Now bear has been able to analyze data obtained from replicate crossover BE study (i.e., 2x2x3, 2x2x4, ... 2x2x6 ) and also parallel BE study design (2x2x1) since version 2.3.0. You can browse the bebac Forum - R for BE/BA to get more information about the development of bear.  We get a lots of supports from many experts of the bebac Forum - R for BE/BA.

Methods
This package includes three parts. First is doing “sample size estimation.” Users can choose 80 or 90% power and defined upper BE acceptance criteria to conduct a ABE between these two formulations. Sample size also depends on the magnitude of variability. Variance estimates can be obtained from the biomedical literature or pilot studies. For crossover designs, we provide two kinds of methods for different data (raw and log-transformed) (Liu, et al. 1992; Hauschke, et al.1992). This function will provide information about how many numbers of subjects should be included. Second part is to perform NCA.  We provide NCA approach to compute AUC0-t, AUC0-inf and terminal elimination rate constant (λz) with time-Cp profile. λz, the terminal phase rate constant, will be estimated from the slope of linear regression with various approaches (manual selection of the exact 3 data points, adjusted R2 (ARS), AIC, Two-Times-Tmax (TTT), TTT-ARS, TTT-AIC, etc).  All these approaches do not include the data point of (Tmax, Cmax).  Linear trapezoidal rule is used to calculate AUC0-t (AUC from time 0 to the last measurable Cp).  The extrapolated AUC (from time of the last measurable Cp to infinity) will be estimated from the last measurable Cp divided by λz.  AUC0-inf (AUC from time 0 to infinity) equals to AUC0-t plus the extrapolated AUC(AUCt-inf).  Cmax is obtained from observed time-Cp profile. All plots from NCA will be stored in a pdf file (like this .pdf) and all reports, including NCA reports (like this NCA PK) and pharmacokinetic summaries (Cmax, Tmax, AUC0-t, AUC0-inf, AUC0-t/AUC0-inf*100%, ln(Cmax), ln(AUC0-t), ln(AUC0-inf), MRT0-inf, T1/2, Vd/F, λz, Cl/F). Please refer to some pharmacokinetic textbooks about how to calculate these parameters with NCA.  Final step is to perform ANOVA (lm in R). For non-replicated crossover designs, FDA guidance (FDA, 2001) recommends parametric procedures to analyze log-transformed BA measures. It continues to perform ANOVA and calculate 90%CIs, and finally to conclude if it is bioequivalent with three pivotal BE parameters. This package also supplies ANOVA stat reports (like this ANOVA stat) or results of linear mixed effects (lme_stat.txt for replicate or parallel BE studies) and summaries (like this statistical summaries). All results obtained from outlier detection analysis (now only for 2x2x2 crossover BE study) will be also appearing in ANOVA_stat; and all plots from outlier detection analysis will be stored in this .pdf.

How to use it (To install and use bear correctly, please read this section first.)
installation:
For how to install bear, please read this for more detailed information about how to use R. Users have to follow the installation procedures as indicated to correctly install bear.  This is because bear will call some other R packages (reshape, nlme, sciplot and more) when running. These packages will be installed automatically when you're installing bear at the same time.  Bear is complied and tested under R v2.8.1 (soon) So, please install R with the latest version (>v2.8.0). Data input: The fastest and the easist way to use bear is to import your data into it.  You can choose "NCA --> ANOVA" from the menu and then import your data with .csv (comma-separated values) format. Please note that the readily imported file (.csv) should be placed on R accessible path.  In Windows XP/Vista, the file path is set by default on the directory of "C:\Documents and Settings\UserName\My Documents" for XP,  or "C:\UserName\My Documents" for Vista.  UserName here indicates the user's name. Thus, it can be different on each computer.  User can type "getwd()" in R console to examine your default file path.   All output files (.txt, .pdf, .csv or .RData) generated by bear will also be placed in this directory.   Now, you can import a .csv file into bear for ANOVA.   If you like to do NCA first, followed by ANOVA, you can import bear generated NCA output file which can be a .RData or a .csv format into bear for ANOVA.  You can also provide your own data file (.csv file format) now.  Then pick three time-Cp data points from each plot by clicking it with your mouse.  Here is flash demo for the selection of three Cp to estimate λ and a sample data (.csv) (right click your mouse and use "Save as..." function) which can be imported into bear for analysis (also see the following).  The sequences of column must be followed (i.e. subject# -> study sequence -> study period -> sampling time -> measured drug concentration from the left to the right).  However, you can change the column name. For example, you can change "prd" as "period" if you like.  We have presumably defined the study sequence in bear as "1" when a subject takes the reference product first, followed by test product and "2" in reversed. This is very critical to remember when using bear. If it is a BA study, only NCA will be performed. Required other computer software: With bear for R, all computer software you need is a spreadsheet, such as MS-Excel (if it's available for your computer) or OpenOffice Calc (which is a very nice freeware!) or even a plain ascii (.txt) editor which can create your .csv format for your data.  Validation:  We have tested bear with one of BE dataset and found that all output results to be the same as those generated by commercial software (like NCA using WinNonlin and ANOVA with SAS).

Sample size estimation

          <<Sample Size Estimation>>

 Upper acceptance limit = 125 %
 Lower acceptance limit = 80 %
     Expected ratio T/R = 95.00 %
           Target power = 80.00 %
Inter- or Intra-subj CV = 20.0 %

 study    2x2x1         2x2x2        2x2x3        2x2x4
design   parallel     crossover   replicated   replicated
------- ----------- ------------ ------------ ------------
   N       36            20           16           10

Estimated power = 80.99398 % (for parallel study)
Estimated power = 83.46802 % (for crossover/replicate study)
where 2x2x2 means 2-treatment, 2-sequence, and 2-period crossover study.

Sample file of the imported data format (.csv): Please note that this format is not for ANOVA or lme data.
This is the format ONLY for the raw data of a 2x2x2 crossover (A), replicate (2x2x3/2x2x4...2x2x6) (B), and
the parallel study (C).

subj,seq,prd,time,conc
1,2,2,0.00,0.00
1,2,2,0.25,36.1
1,2,2,0.50,125
1,2,2,0.75,567
1,2,2,1.00,932
1,2,2,1.50,1343
1,2,2,2.00,1739
1,2,2,3.00,1604
1,2,2,4.00,1460
(...)
subj,seq,prd,tmt,time,conc 1,2,2,1,0,0 1,2,2,1,0.25,36.1 1,2,2,1,0.5,125 1,2,2,1,0.75,567 1,2,2,1,1,932 1,2,2,1,1.5,1343 1,2,2,1,2,1739 1,2,2,1,3,1604 1,2,2,1,4,1460
(...)
subj,drug,time,conc 1,2,0,0 1,2,0.25,36.1 1,2,0.5,125 1,2,0.75,567 1,2,1,932 1,2,1.5,1343 1,2,2,1739 1,2,3,1604 1,2,4,1460
(...)
  (A)                                              (B)                                                      (C)

where "subj", "seq", "prd", "tmt" (or "drug"), "time" and "conc" represents subject#, sequence, period, treatment (or drug), sampling time and drug concentration, respectively.  Users can use different column names as wished.  Please note that
1. Users must follow the column sequence as shown above; However, the column name can be different.
2. We have internally defined the study sequence in bear as "1" (no double quote, please) when a subject
    takes the reference product first, followed by test product and "2" in reversed.
3. In coding "tmt" or "drug", please set drug or tmt ="1" for the Reference, and drug or tmt = "2" for the Test.
4. All data should be entered only as the numerical format, not the text format (not double quote!);
5. When a drug plasma/serum/blood concentration is near the end of sampling time and is below LLOQ,
    this value (entire row) should be deleted; otherwise, it can affect the estimation of λz (auto mode), and
6. Please also delete the entire row for a missing sample or a missing data. Do not enter zero (0) for missing
   data. 

Output files

NCA output

~~~  This report is generated using bear v2.3.0 for R. ~~~
Authors: Hsin-ya Lee, Yung-jin Lee
College of Pharmacy, Kaohsiung Medical University
Kaohsiung, Taiwan 80708
E-mail: hsinyalee@gmail.com,mobilePK@gmail.com
bear's website: http://pkpd.kmu.edu.tw/bear
R website: http://www.r-project.org
---------------------------------------------------

Lambda_z is calculated using the Akaike information criterion (AIC) method
without including the data point of (Tmax, Cmax).
--------------------------------------------------------------------------

                    Reference                      
---------------------------------------------------

<< NCA Outputs:- Subj.# 1 , Seq 2 , Prd 2  (Ref.)>>
--------------------------------------------------------------------------
   subj  time   conc  AUC(0-t) AUMC(0-t)
1     1  0.00    0.0     0.000     0.000
2     1  0.25   36.1     4.513     1.128
3     1  0.50  125.0    24.650    10.069
4     1  0.75  567.0   111.150    71.037
5     1  1.00  932.0   298.525   240.694
6     1  1.50 1343.0   867.275   977.319
7     1  2.00 1739.0  1637.775  2350.444
8     1  3.00 1604.0  3309.275  6495.444
9     1  4.00 1460.0  4841.275 11821.444
10    1  8.00  797.0  9355.275 36253.444
11    1 12.00  383.0 11715.275 58197.444
12    1 24.00   72.0 14445.275 96141.444

--------------------------------------------------
   subj seq prd drug time conc code
8     1   2   2    1    3 1604    2
9     1   2   2    1    4 1460    2
10    1   2   2    1    8  797    2
11    1   2   2    1   12  383    2
12    1   2   2    1   24   72    2


----------------------------
           R sq. = 0.9979083 
Adj. R sq. (ARS) = 0.997211 
             AIC = -25.53606 
        lambda_z = 0.1498811 
            Cmax = 1739 
            Tmax = 2 
            Cl/F = 5.359898 
            Vd/F = 35.76101 
         T1/2(z) = 4.624648 
        AUC(0-t) = 14445.27 
      AUC(0-inf) = 14925.66 
       AUMC(0-t) = 96141.44 
     AUMC(0-inf) = 110875.7 
        MRT(0-t) = 6.655563 
      MRT(0-inf) = 7.428529 
----------------------------

<< NCA Outputs:- Subj.# 1 , Seq 2 , Prd 3  (Ref.)>>
--------------------------------------------------------------------------
   subj  time conc  AUC(0-t) AUMC(0-t)
1     1  0.00    0     0.000     0.000
2     1  0.25   29     3.625     0.906
3     1  0.50  125    22.875     9.625
4     1  0.75  567   109.375    70.594
5     1  1.00  800   280.250   223.750
6     1  1.50 1343   816.000   927.375
7     1  2.00 1650  1564.250  2256.000
8     1  3.00 1604  3191.250  6312.000
9     1  4.00 1432  4709.250 11582.000
10    1  8.00  600  8773.250 32638.000
11    1 12.00  383 10739.250 51430.000
12    1 24.00   69 13451.250 88942.000

<>
--------------------------------------------------
   subj seq prd drug time conc code
20    1   2   3    1    3 1604    3
21    1   2   3    1    4 1432    3
22    1   2   3    1    8  600    3
23    1   2   3    1   12  383    3
24    1   2   3    1   24   69    3
(...)

Outputs of ANOVA (lm) (same as SAS PROC GLM) or lme (same as SAS PROC MIXED)

                           
(...)   Data Summary of BA measurement                  
--------------------------------------------------------------------------
   subj drug seq prd Cmax    AUC0t   AUC0INF   lnCmax   lnAUC0t lnAUC0INF
1     1    1   2   2 1739 14445.27 14925.656 7.461066  9.578123  9.610837
2     2    1   1   1 1481 12516.14 13134.553 7.300473  9.434774  9.483002
3     3    1   2   2 1780 15371.40 15999.744 7.484369  9.640264  9.680328
4     4    1   1   1 1374 11063.10 11647.240 7.225481  9.311371  9.362824
5     5    1   2   2 1555 13971.45 14556.963 7.349231  9.544771  9.585825
6     6    1   1   1 1756 15376.35 15950.591 7.470794  9.640586  9.677251
(...)


  Class Level Information                  
--------------------------------------------------------------------------
  Class       Levels      Values
  SUBJECT      14          1 2 3 4 5 6 7 8 9 10 11 12 13 14 
  DRUG          2          1 2 
  SEQUENCE      2          1 2 
  PERIOD        2          1 2 
-----------
DRUG 1: the Ref. product; DRUG 2: the Test product
SEQUENCE 1:  Ref. -> Test, and SEQUENCE 2: Test -> Ref.
-------------------------------------------------------

 Means                  
--------------------------------------------------------------------------
  SEQUENCE     Cmax    AUC0t  AUC0INF  lnCmax  lnAUC0t lnAUC0INF
1        1 1602.071 14109.25 14713.39 7.37045 9.538976  9.582570
2        2 1589.786 13357.85 13970.66 7.36052 9.487205  9.532541


   SUBJECT SEQUENCE   Cmax    AUC0t  AUC0INF   lnCmax  lnAUC0t lnAUC0INF
1        1        2 1686.0 13369.59 13950.10 7.429620 9.497491  9.540791
2        2        1 1659.0 13907.39 14645.04 7.408181 9.535147  9.586510
3        3        2 1926.5 15277.70 15838.53 7.560560 9.634131  9.670149
4        4        1 1501.5 12522.38 13133.29 7.310602 9.428436  9.476462
5        5        2 1470.0 12911.54 13523.30 7.291343 9.462496  9.509240
6        6        1 1639.0 14607.04 15146.74 7.399287 9.587870  9.624130
(...)

  PERIOD     Cmax    AUC0t  AUC0INF   lnCmax lnAUC0t lnAUC0INF
1      1 1632.714 13855.25 14531.50 7.390958 9.52988  9.577774
2      2 1559.143 13611.85 14152.54 7.340011 9.49630  9.537337


  DRUG     Cmax    AUC0t  AUC0INF  lnCmax  lnAUC0t lnAUC0INF
1    1 1539.643 13171.14 13781.86 7.32951 9.474286  9.519987
2    2 1652.214 14295.97 14902.19 7.40146 9.551895  9.595125 


   Statistical analysis (ANOVA(lm), 90%CI...)                   
--------------------------------------------------------------------------
  Dependent Variable: lnCmax                                               

Type I SS
Analysis of Variance Table

Response: lnCmax
          Df   Sum Sq  Mean Sq F value Pr(>F)
seq        1 0.000017 0.000017  0.0011 0.9743
prd        1 0.027294 0.027294  1.7187 0.2144
drug       1 0.025583 0.025583  1.6110 0.2284
seq:subj  12 0.255270 0.021273  1.3395 0.3103
Residuals 12 0.190565 0.015880               

Type III SS
Single term deletions

Model:
lnCmax ~ seq + subj:seq + prd + drug
         Df Sum of Sq      RSS      AIC F value  Pr(F)
                   0.191 -107.719               
prd       1     0.027    0.218 -105.971  1.7187 0.2144
drug      1     0.026    0.216 -106.192  1.6110 0.2284
seq:subj 12     0.255    0.446 -107.920  1.3395 0.3103

Tests of Hypothesis for SUBJECT(SEQUENCE) as an error term

Error: subj
          Df   Sum Sq  Mean Sq F value Pr(>F)
prd:drug   1 0.000017 0.000017   8e-04 0.9778
Residuals 12 0.255270 0.021273               

Error: Within
          Df   Sum Sq  Mean Sq F value Pr(>F)
prd        1 0.027294 0.027294  1.7187 0.2144
drug       1 0.025583 0.025583  1.6110 0.2284
Residuals 12 0.190565 0.015880               

Intra_subj. CV = 100*sqrt(abs(exp(MSResidual)-1)) = 13.4025 %
Inter_subj. CV = 100*sqrt(abs(exp((MSSubject(seq)-MSResidual)/2)-1)) = 5.4059 %
    MSResidual = 0.01780339 
MSSubject(seq) = 0.0236397

(...) 

(...)  Statistical analysis (lme, 90%CI...) - replicate BE study               
--------------------------------------------------------------------------
  Dependent Variable: lnCmax                                                 

Linear mixed-effects model fit by REML
 Data: TotalData 
        AIC       BIC   logLik
  -45.23532 -29.93913 30.61766

Random effects:
 Formula: ~1 | subj
        (Intercept) Residual
StdDev:  0.07591504 0.096394

Fixed effects: lnCmax ~ seq + prd + drug 
                Value  Std.Error DF   t-value p-value
(Intercept)  7.372429 0.04264797 38 172.86705  0.0000
seq2        -0.009494 0.04806556 12  -0.19753  0.8467
prd2        -0.062443 0.03643351 38  -1.71389  0.0947
prd3         0.017159 0.03643351 38   0.47097  0.6404
prd4         0.027577 0.03643351 38   0.75691  0.4538
drug2        0.046554 0.02576238 38   1.80705  0.0787
 Correlation: 
      (Intr) seq2   prd2   prd3   prd4  
seq2  -0.564                            
prd2  -0.427  0.000                     
prd3  -0.427  0.000  0.500              
prd4  -0.427  0.000  0.500  0.500       
drug2 -0.302  0.000  0.000  0.000  0.000

Standardized Within-Group Residuals:
       Min         Q1        Med         Q3        Max 
-1.9923453 -0.4759801  0.1513995  0.5975501  1.5432336 

Number of Observations: 56
Number of Groups: 14 

Type I Tests of Fixed Effects
            numDF denDF  F-value p-value
(Intercept)     1    38 94465.47  <.0001
seq             1    12     0.04  0.8467
prd             3    38     2.45  0.0785
drug            1    38     3.27  0.0787

Type III Tests of Fixed Effects
            numDF denDF   F-value p-value
(Intercept)     1    38 29883.017  <.0001
seq             1    12     0.039  0.8467
prd             3    38     2.449  0.0785
drug            1    38     3.265  0.0787

(...)    BE Summary Report                            
--------------------------------------------------------------------------
  Dependent Variable: lnCmax                                               
--------------------------------------------------------------------------
        n1(R=>T) = 7 
        n2(T=>R) = 7 
        N(n1+n2) = 14 
  Lower criteria = 80 %
  Upper criteria = 125 %
        MEAN-ref = 7.32951 
       MEAN-test = 7.40146 
             MSE = 0.01780339 
              SE = 0.05043155 
Diff. (test-ref) = 0.07195028 

**************** Classical (Shortest) 90% C.I. for lnCmax ****************

  CI90_lower Point_estimated CI90_upper
1     98.223         107.460    117.566

---------------------- Two One-Sided Tests (TOST) -------------------------

     TOST   T value   P value
1 T_lower   -5.8514    0.0000
2 T_upper   -2.9980    0.0056

**Interpretation:
Ho: Theta =<  0.8  or  Theta >=  1.25 
Ha:  0.8  < Theta <  1.25 
Theta = Mean_test/Mean_ref  
Because all P values are less than 0.05, we will reject the null hypothesis (Ho). 
BE acceptance range is set at 80 % -  125 % .

------------------------ Anderson-Hauck Test ------------------------------

          P value = 0.005515 

**Interpretation:
Ho: Theta =<  0.8  or  Theta >=  1.25 
Ha:  0.8  < Theta <  1.25 
Theta = Mean_test/Mean_ref  
Because all P values are less than 0.05, we will reject the null hypothesis (Ho). 
BE acceptance range is set at 80 % -  125 % .

---------------------------------------------------------------------------
Ref.:
1. Chow SC and Liu JP. Design and Analysis of Bioavailability-       
   Bioequivalence Studies. 3rd ed., Chapman & Hall/CRC, New York (2009).
2. Schuirmann DJ. On hypothesis testing to determine if the mean of a  
   normal distribution is continued in a known interval. Biometrics, 37, 
   617(1981).                                                           
3. Schuirmann DJ. A comparison of the two one-sided tests procedure and the 
   power approach for assessing the equivalence of average bioavailability.
   Journal of Pharmacokinetics and Biopharmaceutics, 15, 657-680 (1987). 
4. Anderson S and Hauck WW.  A new procedure for testing equivalence in 
   comparative bioavailability and other clinical trials. Communications 
   in Statistics-Theory and Methods, 12, 2663-2692 (1983).     
-------------------------------------------------------------------------- 
(...)
(...)  Data Summary of BA measurement                  
--------------------------------------------------------------------------
   subj drug seq prd Cmax AUC0t AUC0INF lnCmax lnAUC0t lnAUC0INF
1     1    1   2   2 1739 14445   14933   7.46    9.58      9.61
2     2    1   1   1 1481 12516   13185   7.30    9.43      9.49
3     3    1   2   2 1780 15371   16032   7.48    9.64      9.68
4     4    1   1   1 1374 11063   11668   7.23    9.31      9.36
5     5    1   2   2 1555 13971   14557   7.35    9.54      9.59
(...)


  Class Level Information                  
--------------------------------------------------------------------------
  Class       Levels      Values
  SUBJECT      14          1 2 3 4 5 6 7 8 9 10 11 12 13 14 
  DRUG          2          1 2 
  SEQUENCE      2          1 2 
  PERIOD        4          1 2 3 4 
--------
DRUG 1: the Ref. product; DRUG 2: the Test product
--------------------------------------------------

 Means                  
--------------------------------------------------------------------------
  SEQUENCE     Cmax    AUC0t  AUC0INF   lnCmax  lnAUC0t lnAUC0INF
1        1 1580.286 13793.89 14472.89 7.357143 9.520714  9.568571
2        2 1591.214 13351.86 13970.64 7.358929 9.483929  9.529643


   SUBJECT SEQUENCE    Cmax    AUC0t  AUC0INF lnCmax lnAUC0t lnAUC0INF
1        1        2 1678.25 13195.75 13770.00 7.4225  9.4825    9.5225
2        2        1 1656.50 13910.75 14725.00 7.4050  9.5325    9.5875
3        3        2 1931.50 15348.75 15931.00 7.5600  9.6375    9.6725
4        4        1 1496.50 12468.00 13081.50 7.3050  9.4225    9.4675
5        5        2 1467.75 12826.00 13465.00 7.2875  9.4525    9.5050
(...)


  PERIOD     Cmax    AUC0t  AUC0INF   lnCmax  lnAUC0t lnAUC0INF
1      1 1632.714 13856.64 14540.71 7.391429 9.529286  9.580000
2      2 1537.714 13307.43 13930.00 7.330000 9.482143  9.527143
3      3 1538.500 13294.71 13898.86 7.323571 9.475000  9.518571
4      4 1634.071 13832.71 14517.50 7.387143 9.522857  9.570714


  DRUG     Cmax    AUC0t  AUC0INF   lnCmax  lnAUC0t lnAUC0INF
1    1 1537.536 13155.25 13764.75 7.326071 9.470000  9.517143
2    2 1633.964 13990.50 14678.79 7.390000 9.534643  9.581071

(...)

Statistical Summary output

Statistical Summaries for Pivotal Parameters of Bioequivalence Study (N= 14 )
--------------------------------------------------------------------------

    Parameters Test_Mean  Test_SD  Ref_Mean   Ref_SD
1         Cmax  1662.536  181.868  1589.643  186.703
2       AUC0-t 13742.526 1945.507 13124.974 1994.792
3     AUC0-inf 14479.338 2230.335 13721.289 2068.855
4     ln(Cmax)     7.411    0.106     7.365    0.120
5   ln(AUC0-t)     9.519    0.143     9.470    0.163
6 ln(AUC0-inf)     9.570    0.152     9.515    0.161


Statistical Summaries for Pivotal Parameters of Bioequivalence Study (N= 14 ) (cont'd)
-------------------------------------------------------------------------------------

    Parameters CI90_lower Point_estimated CI90_upper
1     ln(Cmax)    100.312         104.765    109.416
2   ln(AUC0-t)     98.529         104.875    111.629
3 ln(AUC0-inf)     99.080         105.534    112.409

-------------------------------------------------------------------------
CI90: 90% confidence interval 
--------------------------------------------------------------------------


Summaries for Misc. Pharmacokinetic Parameters (N= 14 )

                      Test                Reference        
------------------------------------------------------

  Parameters   Mean    SD     CV     Mean    SD     CV
1       Cl/F  5.654 0.855 15.124    5.975 1.031 17.258
2   Lambda_z  0.134 0.015 11.386    0.136 0.007  5.173
3       Tmax  2.321 0.541 23.301    2.161 0.585 27.080
4    T1/2(z)  5.268 0.672 12.757    5.119 0.265  5.185
5       Vd/F 42.676 6.746 15.808   44.214 8.550 19.337
6    MRT0inf  8.200 0.824 10.054    8.027 0.397  4.951
7   AUCratio 95.053 1.811  1.905   95.634 0.685  0.717

-----------------------------------------------------
AUCratio: (AUC0-t/AUC0-inf)*100 
-----------------------------------------------------

Analysis of outliers detection and related plots

       
(...)Intra-subject and Inter-subject Residuals                  
--------------------------------------------------------------------------
   subj      Obs      Exp     Intra Stud_Intra     Inter Stud_Inter
1     1 9.470745 9.598578 -0.127834  -1.054118  0.016499   0.084320
2     2 9.483002 9.569159 -0.086158  -0.710458  0.007879   0.040268
3     3 9.659970 9.727936 -0.067967  -0.560454  0.275215   1.406519
4     4 9.362824 9.459112 -0.096287  -0.793987 -0.212216  -1.084554
5     5 9.432655 9.567027 -0.134372  -1.108037 -0.046603  -0.238169
(...)
13   13 9.699149 9.528906  0.170243   1.403827 -0.122846  -0.627819
14   14 9.673686 9.824056 -0.150371  -1.239958  0.517673   2.645629
------------------------------------------------
Obs: Observed lnAUC0INF
Exp: Expected lnAUC0INF
Intra: Intra-subject residuals
Stud_Intra: Studentized intra-subject residuals
Inter: Inter-subject residuals
Stud_Inter: Studentized inter-subject residuals
**Ref: Chow SC and Liu JP. Design and Analysis of Bioavailability-          
Bioequivalence Studies. 3rd ed., Chapman & Hall/CRC, New York (2009).     
---------------------------------------------------------------------
(...)

****************************************************************************
Analysis of Outlier Detection
****************************************************************************

Test for Normality Assumption  (Shapiro-Wilk)             
--------------------------------------------------------------------------
             Parameter    Test P value
1    lnCmax_Stud_Intra 0.91950  0.2163
2    lnCmax_Stud_Inter 0.94222  0.4475
3   lnAUC0t_Stud_Intra 0.90395  0.1287
4   lnAUC0t_Stud_Inter 0.87428  0.0482
5 lnAUC0INF_Stud_Intra 0.88242  0.0629
6 lnAUC0INF_Stud_Inter 0.87166  0.0443

-------------------------------------------------
Stud_Intra: studentized intra-subject residuals
Stud_Inter: studentized inter-subject residuals
-------------------------------------------------
**Interpretation:
  The normality of the studentized intra-subject residuals and the 
studentized inter-residuals was examined using the test of Shapiro-Wilk. 
If a P value is more than 0.05, we will fail to reject the normal         
assumption hypothesis.                                                    

**Ref: Chow SC and Liu JP. Design and Analysis of Bioavailability-      
Bioequivalence Studies. 3rd ed., Chapman & Hall/CRC, New York (2009).
---------------------------------------------------------------------

Test for Normality Assumption  (Pearson)             
--------------------------------------------------------------------------
  Parameter     Test P value
1    lnCmax -0.27517  0.3410
2   lnAUC0t -0.50957  0.0627
3 lnAUC0INF -0.49037  0.0750

-------------------------------------------------
Pearson: Pearson's correlation coefficient
-------------------------------------------------
**Interpretation:
  Either Pearson correlation coefficient or Spearman's rank correlation  
coefficient is used to examine the assumption of independence between   
intra- and inter-subject variabilities.  Thus, if a P value is more than 
0.05, there is no evidence to suggest that the assumption is not true.   

**Ref: Chow SC and Liu JP. Design and Analysis of Bioavailability-          
Bioequivalence Studies. 3rd ed., Chapman & Hall/CRC, New York (2009).     
-------------------------------------------------------------------------

Test for Normality Assumption  (Spearman)             
--------------------------------------------------------------------------
  Parameter     Test P value
1    lnCmax -0.37143  0.1917
2   lnAUC0t -0.41099  0.1458
3 lnAUC0INF -0.43736  0.1198

-------------------------------------------------
Spearman: Spearman's rank correlation coefficient
-------------------------------------------------------------------------

  Hotelling T^2 with Chi-square test  
--------------------------------------------------------------------------
   subj    Cmax P value  lnCmax P value
1     1 0.92550 0.62955 0.87200 0.64662
2     2 0.89118 0.64045 0.85392 0.65249
3     3 6.64221 0.03611 5.56026 0.06203
4     4 0.59125 0.74407 0.52257 0.77006
(...)
13   13 2.26697 0.32191 2.47282 0.29042
14   14 3.46892 0.17650 3.00119 0.22300

   subj    AUC0t P value  lnAUC0t P value
1     1  0.91572 0.63263  0.88935 0.64103
2     2  0.22251 0.89471  0.24628 0.88414
3     3  1.59543 0.45036  1.60903 0.44730
4     4  1.30339 0.52116  1.16065 0.55972
5     5  0.93873 0.62540  1.06203 0.58801
(...)
11   11  5.47893 0.06460  6.45905 0.03958
12   12  3.00762 0.22228  3.68832 0.15816
13   13  4.16647 0.12453  4.54473 0.10307
14   14 36.99471 0.00000 23.07303 0.00001

   subj  AUC0INF P value lnAUC0INF P value
1     1  0.78347 0.67588   0.76142 0.68338
2     2  0.29003 0.86501   0.32987 0.84795
3     3  1.51641 0.46851   1.53149 0.46499
4     4  1.26269 0.53188   1.12343 0.57023
(...)
12   12  3.36757 0.18567   4.09229 0.12923
13   13  3.93636 0.13971   4.18647 0.12329
14   14 36.26111 0.00000  23.50638 0.00001

-------------------------------------------------
**Interpretation: If subjects have relatively BIG T^2 values which 
 cause P value less than 0.05, these subject may be outlying subjects. 

Ref.:
1. Liu JP and Weng CS. Detection of outlying data in bioavailability-
   bioequivalence studies. Statistics in Medicine, 10, 1375-1389(1991).
2. Chow SC and Liu JP. Design and Analysis of Bioavailability-        
   Bioequivalence Studies. 3rd ed., Chapman & Hall/CRC, New York (2009).
-------------------------------------------------------------------------

  Test for Equality of Intra-subject variabilities between formulations   
--------------------------------------------------------------------------
                Parameter     Test P value
1          lnCmax_Pearson -0.08448  0.7740
2    lnCmax_Pitman_Morgan  0.08626  0.7740
3         lnCmax_Spearman -0.10769  0.7156
4         lnAUC0t_Pearson  0.11349  0.6993
5   lnAUC0t_Pitman_Morgan  0.15657  0.6993
6        lnAUC0t_Spearman -0.07692  0.7966
7       lnAUC0INF_Pearson  0.07876  0.7890
8 lnAUC0INF_Pitman_Morgan  0.07490  0.7890
9      lnAUC0INF_Spearman -0.05934  0.8438

-------------------------------------------------
**Interpretation:
  The standard 2*2*2 crossover design was assumed that intra-subject      
variabilities for  the Test and the Reference formulations are the same.    
Thus, if the intra-subject variabilities between formulations are different, 
equivalence in average bioavailabilities between formulations does not    
imply that the two formulations are therapeutically equivalent and        
interchangeable.                                                          
  We use use both parametric (Pitman-Morgan's adjusted F test and Pearson 
correlation coefficient) and nonparametric test (Spearman's rank correlation
coefficient) for testing equality of intra-subject variabilities between 
formulations.  If a P value is less than 0.05, we may reject the null     
hypothesis of equality in intra-subject variabilities between formulations.

**Ref.:
 1. Chow SC and Liu JP. Design and Analysis of Bioavailability-            
    Bioequivalence Studies. 3rd ed., Chapman & Hall/CRC, New York (2009).  
 2. Haynes JD. Statistical simulation study of new proposed uniformity     
    requirements for bioequivalency studies. Journal of Pharmaceutical     
    Sciences, 70, 673-675 (1981).                                          
 3. McCulloch CE. Tests for equality of variances with paired data.        
    Communications in Statistics-Theory and Methods, 16, 1377-1391 (1987).  
--------------------------------------------------------------------------

Point and Interval Estimation of Inter- and Intra-subject Variability  
--------------------------------------------------------------------------
              Parameter Point_Estimate CI95_lower CI95_upper
1          lnCmax_intra          0.018      0.009      0.049
2          lnCmax_inter          0.003     -0.009      0.025
3     lnCmax_intraclass          0.141     -0.423      0.626
4           lnCmax_prob        0.31554          -          -
5         lnAUC0t_intra          0.037      0.019      0.100
6         lnAUC0t_inter         -0.006     -0.024      0.019
7    lnAUC0t_intraclass         -0.192     -0.657      0.379
8          lnAUC0t_prob        0.74431          -          -
9       lnAUC0INF_intra          0.034      0.018      0.094
10      lnAUC0INF_inter         -0.006     -0.023      0.016
11 lnAUC0INF_intraclass         -0.211     -0.669      0.362
12       lnAUC0INF_prob        0.76603          -          -

-------------------------------------------------
intra: intra-subject variability
inter: inter-subject variability
intraclass: intraclass correlation
prob: the probability for obtaining a negative estimate of inter-subject
      variability
CI95: 95% confidence interval 
-------------------------------------------------
**Interpretation:
1. Prior information of inter- and intra- subject variabilities can be used   
   for sample size determination.                                            
2. Intraclass correlation shows the precision of intra-subject variability.
   A negative estimate indicates that inter- and intra- variability on the   
   subjects are negatively correlated.                                       
3. Searle(1971) provided a formula for calculation of the probability for  
   obtaining a negative estimate of inter-subject variability. In addition,   
   a negative estimate may indicate that the general model is incorrect or   
   sample size is too small.  Thus, prob provides the probability for      
   obtaining a negative estimate.  If P value is less than 0.05, the chance  
   of obtaining a negative estimate is negligible.                          

**Ref.:
 1. Chow SC and Liu JP. Design and Analysis of Bioavailability-            
    Bioequivalence Studies. 3rd ed., Chapman & Hall/CRC, New York (2009).  
 2. Searle SR. Linear Models. John Wiley & Sons, New York (1971).          
 3. Snedecor GW and Cochran WG. Statistical Methods. 7th ed.,  Iowa State  
    University Press, Ames, IA (1980).                                     
 4. Hocking RP. The Analysis of Linear Models. Brooks/Cole, Monterey, CA   
    (1985).                                                                
-------------------------------------------------------------------------

Quantiles for Boxplots (intrasubj)  
--------------------------------------------------------------------------
       Quantile lnCmax_Estimate lnAUC0t_Estimate lnAUC0INF_Estimate
100%   Max 100%      1.58859255        1.5645553          1.5930108
99%         99%      1.58859255        1.5645553          1.5930108
95%         95%      1.58859255        1.5645553          1.5930108
90%         90%      1.33567805        1.5411660          1.5730580
75%      Q3 75%      0.93884707        0.6873813          0.6338556
50%  Median 50%     -0.04497309       -0.2919099         -0.3120133
25%      Q1 25%     -1.06347243       -0.7792669         -0.8037332
10%         10%     -1.21551649       -1.1020990         -1.1080370
5%           5%     -1.36618557       -1.3727270         -1.2399578
1%           1%     -1.36618557       -1.3727270         -1.2399578
0%       Min 0%     -1.36618557       -1.3727270         -1.2399578
-------------------------------------------------------------------------

Quantiles for Boxplots (intersubj)  
--------------------------------------------------------------------------
       Quantile lnCmax_Estimate lnAUC0t_Estimate lnAUC0INF_Estimate
100%   Max 100%       1.9874004        2.6115077          2.6456287
99%         99%       1.9874004        2.6115077          2.6456287
95%         95%       1.9874004        2.6115077          2.6456287
90%         90%       1.2193723        1.4261550          1.4065194
75%      Q3 75%       0.6865071        0.4745906          0.4247924
50%  Median 50%       0.2170634       -0.2231420         -0.1773188
25%      Q1 25%      -1.0106795       -0.9256405         -0.9399940
10%         10%      -1.3212861       -1.0355480         -0.9965418
5%           5%      -1.3490155       -1.0729741         -1.0845536
1%           1%      -1.3490155       -1.0729741         -1.0845536
0%       Min 0%      -1.3490155       -1.0729741         -1.0845536
-------------------------------------------------------------------------



 Change Log (April 16, 2009)
-----
v2.3.1
    - fixed NCA plots of  Time scale (with autoscale)
    - used the difference of lsmeans between the Ref. and the Test to calculate 90% CIs for Cmax and AUCs
v2.3.0
    - add sample size estimation and lme analysis for the parallel BE study
    - add References into bear's output (such as ANOVA)
    - label outliers' subjects number for boxplot only if there is any (see crossover demo)
    - add input data summary of BA measurement (class level information, means, etc.)
    - add interpretations for some statistical tests (such as Hotelling T2 test)
    - add add Two One-Sided Tests (TOST) and Anderson-Hauck's tests (just for educational purposes ONLY)
    - allow users to change BE acceptance range now (not fixed on 80%-125% any more!); different countries have
      different regulatory basis...
    - show MSResidual and MSSubject(seq) values when calculating inter- and intra-subject CV
   - change Hotelling T
2 test layout

v 2.2.0
   
- add point estimate along with 90% CI in output file called 'Statistical_summaries.txt (suggested by DLabes).
    - add sample size estimation for replicate BE study, and output re-arrangement.
    - add Hotelling T2 function and boxplot for outlier detection
    - add Quantiles for intrasubject and intersubject (with boxplot)
    - add replicated study for 2*2*3, 2*2*4, 2*2*5, and 2*2*6 (using lme to analyze replicated BE study)
    - add sample size estimation for replicated study (using 2*2*2 sample size estimation extended
      to 2*2*n sample size of replicate crossover design)

v.2.1.0
    - we add 'analysis of outliers detection' since this release.  These include some normality tests, and some
      diagnostic plots for this functions, such as QQ plots and intra- and inter- subject  residual plots.
    - fix intra-subject CV calculation based on ref. #6. (thanks to Helmut).

v1.5.0~2.0.3
   - now λz can be estimated from three methods: manual selections of the 3 exact data points, computer
     selection based on adjusted R sq. (ARS), and the Two-Times-Tmax (TTT) Method.
   - re-structure all codes of bear since v2.0.0.
   - add R sq. in NCA output; the original one is adjusted R sq. & changed T1/2 to T1/2(z) in NCA output file
   - corrected some typo errors appearing in the output files or console display
   - rearrange the output files with better styles: such as 3-decimal digits for 'power', etc.
   - built-in the data file (.RData) required for demo purposes; user doesn't need to enter/import/load it again
   - manual selection of the 3 exact data points can be saved now.  user does not have to redo it next time.
   - displayed the method used to estimate λz in NCA output
   - changed '0.693' to ln(2) when estimating T1/2(z) (= ln(2)/λz) in NCA algorithm
   - changed LSM-ref and LSM-test to LSMEAN-ref and LSMEAN-test, respectively, in the output file of
     'Statistical_Summaries.txt'
   - and many more that I just cannot remember right now...

v1.1.5
   - fixed the anova (lm) calculation due to the import of a .csv file. (thanks to Jiri Hofmann, Czech Republic)
   - added Type III SS (suggested by EIMaestro)
   - changed upper bound of sample size estimation from 105% to 95% (more conservative; suggested by Helmut)

v1.1.4
   - fixed the compatibility for iMac and Linux (thanks to Koji Shimamoto, Tokyo, Japan; also for his testing bear
     on an iMac)

v1.1.3-1.1.0
   - removed the function of "Sample size estimation (raw data)"; also improve the function of "Sample size estimation
    (Log Transform)."
   - fixed the rounding error in the display of "Sample size estimation (Log transform)" (thanks to Helmut)
  - fixed some the format (comma, semicolon, etc.) of import data file (thanks to Helmut); users now can choose their
    favorite formats.
  - display the PATH where bear will import from and will output the all results to.
  - display only one graphic devices (using PageDown & PageUp to change plots) (thanks to Helmut)
  - display semilog (not linear) plots when choosing data points to do linear regression for lambda_z in NCA
    (thanks to Helmut)
  - calculate CV_intra & CV_inter now (thanks to Helmut)
  - output both the .csv and the .RData file formats obtained from NCA; users can choose either one for anova.
  - use "Tests of SUBJECT(SEQUENCE) as an error term" in ANOVA output (thanks to Helmut)
  - changed ANOVA(GLM) to ANOVA (lm) in the menu title (thanks to EIMaestro)
-----

To-do lists (Mar. 09, 2009)
-----
- add configuration setup file (as .RData data frame) into bear.  Use can create/edit this configuration file.  Once data has been imported, don't need to enter anything...
- data analysis for multiple-dose BE?  should be not so difficult...
-
add sample size estimation and data analysis for parallel BE study design (2-tr x 2-seq x 1-per).
- add point estimate along with 90% CI in output file called 'Statistical_summaries.txt (suggested by DLabes).
(done!)
- add more 90% CI calculations of pivotal parameters of BE study for educational purpose. (only shortest CI added.)
- add Hotelling T2 test and box plots into current outliers detection analysis. (done!)
- NCA:
We're working on another five: AICs, TTT-ARS, TTT-AICs,(done!) lee.function-ARS, and lee.function-AICs
  
(from an R package PK). These methods are all exclude the data point of Cmax for estimation of λz (thanks
   to Ace, martin, DLabes and Helmut on bebac Forum - R for BE/BA)
; the selected data points now can only be displayed on R
   console, and we will try to include these information into the output file (NAC_PK.txt).

- calculate intra-subject residuals (a little bit tough...):  we treat this as 'outlier detection in BE/BA'
(suggested
   by Helmut) (done!)

- implement the better algorithm for λz calculation
(done!) (suggested by martin and Ace; especially
   Ace who provided us his R codes for this; later DLabes & Helmut) as additional options; then we have
   tested some algorithms (function.Ace, WinNonlin v5.x.x, TTT method and even combination of TTT method
   with a best fit criterion, such ajd. R sq. (ARS) or AIC.  See Bebac.forum for details.
- implement "lme" for ANOVA as the additional method to current "lm". (suggested by EIMaestro) (done!)
- implement the "Save" function for data points selection for each subjects before doing NCA (using data.frame()?)
- add Type III SS (this should be able to be done quickly...) (done!)
- add methods for replicated study... (it may take longer for this).(done!)
-----

References

1. Hauschke D, Steinijans VW, Diletti E and Burke M. Sample size determination for bioequivalence assessment
    using a multiplicative model. J. Pharmacokin. Biopharm. 20:557-561, 1992.
2. U.S. Dept of Health and Human Services, Food and Drug Administration, Center for Drug Evaluation and Research.
    Guidance for industry. Statistical approaches to establishing bioequivalence, 2001.
3. Liu JP and Chow SC. Sample size determination for the twp one-sided tests procedure in bioequivalence. J.
    Pharmacokin. Biopharm
. 20:101-104, 1992.
4. Schuirmann DJ. A comparison of the two one-sided tests procedure and the power approach for assessing the
    equivalence of average bioavailability. J. Pharmacokin. Biopharm. 15:657-680, 1987.
5. Chow SC, Liu JP. Design and Analysis of Bioavailability and Bioequivalence Studies. 2009; 3rd. ed., CRC Press,
    Chapman & Hall/CRC.
6. Hauschke D, Steinijans V, Pigeot I. Bioequivalence Studies in Drug Development: Mehtods and Applications,
    2007; John Wiley & Sons Ltd.