factorial2x2 v0.1.0


Monthly downloads



Design and Analysis of 2x2 Factorial Trial

Used for the design and analysis of a 2x2 factorial trial for a time-to-event endpoint. Performs power calculations and significance testing. Important reference papers include Slud EV. (1994) <https://www.ncbi.nlm.nih.gov/pubmed/8086609> Lin DY, Gong J, Gallo P, Bunn PH, Couper D. (2016) <DOI:10.1111/biom.12507> Leifer ES, Troendle JF, Kolecki A, Follmann DA. (2019) <https://github.com/EricSLeifer/factorial2x2/blob/master/Leifer%20et%20al%20Factorial.pdf>.



The goals of the factorial2x2 package are twofold: First, to provide power calculations for a two-by-two factorial design in which the effects of the two factors may be sub-additive. Power is provided for the overall effect test for as well as the multiple testing procedures described in Leifer, Troendle, Kolecki, and Follmann (2019). Second, to analyze two-by-two factorial trial data which may include baseline adjustment covariates. Further details are described in the factorial2x2 vignette.


You can install the released version of factorial2x2 from CRAN with:


Example of a power calculation

We reproduce the power calculations for scenario 5 from Table 2 in Leifer, Troendle, et al. using the fac2x2design function.

  n <- 4600          # total sample size
  rateC <- 0.0445    # one year event rate in the control group
  hrA <- 0.80        # simple A effect hazard ratio
  hrB <- 0.80        # simple B effect hazard ratio
  hrAB <- 0.72       # simple AB effect hazard ratio
  mincens <- 4.0     # minimum censoring time in years
  maxcens <- 8.4     # maximum censoring time in years

  fac2x2design(n, rateC, hrA, hrB, hrAB, mincens, maxcens, dig = 2, alpha = 0.05)
  [1] 0.7182932      # power to detect the overall A effect at the two-sided 0.05 level

  [1] 0.9290271      # power to detect the overall A or simple AB effects using the 
                     # 2/3-1/3 procedure

  [1] 0.9302084      # power to detect the overall A, simple A, or simple AB effects using 
                     # the 1/3-1/3-1/3 procedure

  [1] 0.9411688      # power to detect the simple A or simple AB effects using the 
                     # 1/2-1/2 procedure

  $events            # expected number of events
  [1] 954.8738

  $evtprob          # event probabilities for the C, A, B, and AB groups, respectively
  probC     probA     probB    probAB 
  0.2446365 0.2012540 0.2012540 0.1831806


Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. 2019. Submitted.

Lin, D-Y., Gong, J., Gallo, P., et al. Simultaneous inference on treatment effects in survival studies with factorial designs. Biometrics. 2016; 72: 1078-1085.

Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.

Functions in factorial2x2

Name Description
cor2x2 Hazard ratios and correlations for the 2x2 statistics
fac2x2design Power for the 2/3-1/3, 1/3-1/3-1/3, 1/2-1/2 procedures
power12_12 Power of the 1/2-1/2 procedure
power23_13 Power of the 2/3-1/3 procedure
power13_13_13 Power of the 1/3-1/3-1/3 procedure
lgrkPower Unstratified (ordinary) logrank power
fac2x2analyze Significance testing for the 2/3-1/3, 1/3-1/3-1/3, 1/2-1/2 procedures
crit2x2 Critical values for the 2/3-1/3, 1/3-1/3-1/3, and 1/2-1/2 procedures
eventProb Calculate event probabilities
roundDown Round down a negative number
strLgrkPower Stratified (overall) logrank power
simdata Simulated 2x2 factorial trial data
simdat Simulated 2x2 factorial trial data
No Results!

Vignettes of factorial2x2

No Results!

Last month downloads


Type Package
License GPL-2
Encoding UTF-8
LazyData true
VignetteBuilder knitr
RoxygenNote 6.1.1
NeedsCompilation no
Packaged 2019-09-05 16:35:23 UTC; leifere
Repository CRAN
Date/Publication 2019-09-07 09:40:02 UTC

Include our badge in your README