bear v2.0.2 - data analysis tool for average
bioequivalence
(ABE) and bioavailability
for

Created by Hsin-ya Lee (hsinyalee@gmail.com), and
Yung-jin Lee (pkpd.taiwan@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, 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%. Currently, bear should not be used to analyze data obtained from replicated ABE studies.  We are now working on ANOVA with linear mixed effect (lme from nlme package) model.  You can also browse the Forum at bebac to get more information about the development of bear.  We get a lots of supports from many experts of bebac Forum.

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 AUCs and terminal elimination rate constants (λ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 will not include the data point of (Tmax, Cmax).  Linear trapezoidal rule is used to calculate AUC0t (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.  AUC0inf (AUC from time 0 to infinity) equals to AUC0t plus the extrapolated AUC.  Cmax is obtained from observed time-Cp profile. All plots 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, AUC0t, AUC0inf, AUC0t/AUC0inf, ln(Cmax), ln(AUC0t), ln(AUC0inf), MRT0inf, 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) and summaries (like this statistical summaries).

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, and sciplot) 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.7.2. So, please install R with the latest version (>v2.7.2). data input: The fastest 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 of the imported data format (.csv):-
Please note that this format is not for ANOVA.
This is the format for the raw data of a BE study.

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
(...)

where "subj", "seq", "prd", "time" and "conc" mean subject#, sequence, period, sampling time and drug concentration.

Output files

NCA output

~~~  This report is generated by bear v2.0.1 for R ~~~
Authors: Hsin-ya Lee, Yung-jin Lee
#100, Shih-chuan 1st Rd.
College of Pharmacy,
Kaohsiung Medical University,
Kaoshiung, Taiwan 80708
E-mail: hsinyalee@gmail.com,
        pkpd.taiwan@gmail.com 
bear's website: http://pkpd.kmu.edu.tw/bear
R website: www.r-project.org
---------------------------------------------------

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

<< NCA Output:- Subject# 1  (Ref.)>>
--------------------------------------------------------------------------
   subj  time   conc   AUC(0-t)    AUMC(0-t)
1     1  0.25   36.1     0.0000     0.000000
2     1  0.50  125.0    20.1375     8.940625
3     1  0.75  567.0   106.6375    69.909375
4     1  1.00  932.0   294.0125   239.565625
5     1  1.50 1343.0   862.7625   976.190625
6     1  2.00 1739.0  1633.2625  2349.315625
7     1  3.00 1604.0  3304.7625  6494.315625
8     1  4.00 1460.0  4836.7625 11820.315625
9     1  8.00  797.0  9350.7625 36252.315625
10    1 12.00  383.0 11710.7625 58196.315625
11    1 24.00   72.0 14440.7625 96140.315625

(...)

<< PK parameter summaries >>


                         Cmax                     
--------------------------------------------------
   subject Test  Ref Ratio
1        1 1633 1739 0.939
2        2 1837 1481 1.240
3        3 2073 1780 1.165
4        4 1629 1374 1.186
5        5 1385 1555 0.891
6        6 1522 1756 0.867
7        7 1643 1566 1.049
8        8 1615 1939 0.833
9        9 1759 1475 1.193
10      10 1483 1388 1.068
11      11 1682 1127 1.492
12      12 1247 1542 0.809
13      13 1605 1235 1.300
14      14 1718 1598 1.075

  summary     Test      Ref  Ratio
1  LSMEAN 1630.786 1539.643  1.079
2    S.D.  197.522  220.015  0.198
3  C.V(%)   12.112   14.290 18.383
--------------------------------------------------
(...)

ANOVA (lm) output

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

Type I SS
Analysis of Variance Table

Response: Cmax
          Df Sum Sq Mean Sq F value Pr(>F)
seq        1    585     585  0.0160 0.9014
prd        1  63175   63175  1.7293 0.2131
drug       1  58149   58149  1.5917 0.2311
seq:subj  12 634325   52860  1.4469 0.2660
Residuals 12 438395   36533               

Type III SS
Single term deletions

Model:
Cmax ~ seq + subj:seq + prd + drug
         Df Sum of Sq     RSS     AIC F value  Pr(F)
                 438395     302               
prd       1     63175  501570     304  1.7293 0.2131
drug      1     58149  496544     304  1.5917 0.2311
seq:subj 12    634325 1072719     303  1.4469 0.2660

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

Error: subj
          Df Sum Sq Mean Sq F value Pr(>F)
prd:drug   1    585     585  0.0111  0.918
Residuals 12 634325   52860               

Error: Within
          Df Sum Sq Mean Sq F value Pr(>F)
prd        1  63175   63175  1.7293 0.2131
drug       1  58149   58149  1.5917 0.2311
Residuals 12 438395   36533
(...)
                           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(MSResidual)= 12.60176 %
Inter_subj. CV=100*sqrt((MSSubject(seq)-MSResidual)/2)= 7.554316 %
(...)

                             BE Summary Report                            
--------------------------------------------------------------------------
  Dependent Variable: lnCmax                                               
--------------------------------------------------------------------------
        n1(R=>T) = 7 
        n2(T=>R) = 7 
        N(n1+n2) = 14 
         LSM-ref = 7.32951 
        LSM-test = 7.389964 
             MSE = 0.01588043 
              SE = 0.04763017 
Diff. (test-ref) = 0.06045413 
     t(0.95,N-2) = 1.782288 
         Z(beta) = 29.1319 
 Power(1-beta)_Z = 1.000 
         t(beta) = 28.59794 
 Power(1-beta)_t = 1.000 

************************90% C.I. for lnCmax********************************
     90%CI Lower = 97.586 
     90%CI Upper = 115.644 
--------------------------------------------------------------------------
(...)

Statistical Summary output

       
                  Statistical Summaries for Bioequivalence Study (N= 14 )
--------------------------------------------------------------------------

    parameters Test_Mean  Test_SD  Ref_Mean   Ref_SD Ratio
1         Cmax  1630.786  197.522  1539.643  220.015 1.079
2       AUC0-t 13975.284 1997.852 13158.790 1971.053 1.096
3     AUC0-inf 14659.822 2092.321 13776.930 2033.362 1.097
4     ln(Cmax)     7.390    0.122     7.329    0.147 1.009
5   ln(AUC0-t)     9.535    0.145     9.473    0.161 1.007
6 ln(AUC0-inf)     9.583    0.144     9.520    0.159 1.007


                           Statistical Analysis                           
--------------------------------------------------------------------------

    parameters F_value P_value CI90_lower CI90_upper power
1         Cmax   1.592   0.231          -          -     -
2       AUC0-t   0.884   0.366          -          -     -
3     AUC0-inf   0.967   0.345          -          -     -
4     ln(Cmax)   1.611   0.228     97.586    115.644 1.000
5   ln(AUC0-t)   0.836   0.378     94.288    120.058 1.000
6 ln(AUC0-inf)   0.912   0.358     94.635    120.023 1.000

-------------------------------------------------------------------------
Ratio = Test/Ref. (mean ratio)
F value and P value were obtained from ANOVA.
CI90: 90% confidence interval 
Power: required to detect at least 20% of differences
--------------------------------------------------------------------------


Summaries for Pharmacokinetic Analysis (NCA)


                        Test                     
-------------------------------------------------

  parameters   Mean    SD     CV
1       Cl/F  5.563 0.810 14.555
2   Lambda_z  0.133 0.014 10.682
3       Tmax  2.321 0.541 23.301
4    T1/2(z)  5.283 0.530 10.025
5       Vd/F 42.532 8.460 19.891
6    MRT0inf  8.198 0.516  6.290
7   AUCratio 95.324 1.125  1.180


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

  parameters   Mean    SD     CV
1       Cl/F  5.944 1.012 17.028
2   Lambda_z  0.133 0.007  5.201
3       Tmax  2.143 0.602 28.102
4    T1/2(z)  5.216 0.262  5.023
5       Vd/F 44.873 8.896 19.825
6    MRT0inf  8.128 0.399  4.905
7   AUCratio 95.482 0.768  0.805

-----------------------------------------------------
AUC ratio: (AUC0-t/AUC0-inf)*100 
-----------------------------------------------------

 Change Log (Oct. 14, 2008)
-----
v1.5.0~2.0.1
   - 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 testing bear on iMac machine)

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
    (kel) 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)
-----

Todo Lists (Oct. 14, 2008)
-----
1. NCA:
We're working on another five: AICs, TTT-ARS, TTT-AICs, 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)
; 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).
2.calculate intra-subject residuals (a little bit tough...):  we treat this as 'outlier detection in BE/BA' (suggested
   by Helmut)
3. implement the better algorithm for λz calculation (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.
4. implement "lme" for ANOVA as the additional method to current "lm". (suggested by EIMaestro)
5. implement the "Save" function for data points selection for each subjects before doing NCA (using data.frame()?)
6. add Type III SS (this should be able to be done quickly...) (done!)
7. add methods for replicated study... (it may take longer for this).
-----
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.