designOBF {binseqtest}R Documentation

Design Sequential Binary Boundary


There are several functions that create binary sequential boundaries. The function designAb allows great flexibility in creating user defined boundaries. The functions designOBF and designOBFpower create boudaries of the O-Brien-Fleming type, extending those boundaries to allow looks after every observation. The former (designOBF) uses a user defined maximum number of observations (Nmax), while the latter (designOBFpower) uses the power argument to try to find a design with a smaller maximum that achieves the desired power. The functions designFixed and designFixedpower are analogous for fixed sample designs. The function designSimon uses the ph2simon from the clinfun package to create boundaries using Simon's (1989) two-stage design.


designAb(Nk, a = NULL, b = NULL, theta0 = NULL, 
    tsalpha = NULL, alternative = "two.sided", 
    conf.level = 0.95, binding = "both")

designOBF(Nmax,theta0 = 0.5,  k = Inf,  tsalpha = NULL,
    alternative = "two.sided", conf.level = 0.95, 
    binding = "both")
designOBFpower(theta0 = 0.5, theta1=.6,  k=Inf,
    power=.9, tsalpha = NULL, alternative = "two.sided",
    conf.level = 0.95, binding = "both", allNgreater=FALSE,
    checkmax=10, maxNmax=2*ss)

designFixed(Nmax, theta0 = 0.5, tsalpha = NULL, 
    alternative = "two.sided", conf.level = 0.95)
designFixedpower(theta0 = 0.5, theta1 = 0.6, power = 0.8,
    maxNmax = Inf, tsalpha = NULL, alternative = NULL,
    conf.level = 0.95, allNgreater = FALSE)

designSimon(theta0, theta1, alpha = 0.05, beta = 0.2, 
    type = c("optimal", "minimax"), nmax=100)



vector of unique N values where there is stopping


numeric vector with length(a)=length(Nk)-1, stop if number of successes out of Nk[i] is less than or equal to a[i] (see details)


numeric vector with length(a)=length(Nk)-1, stop if number of successes out of Nk[i] is greater than or equal to b[i] (see details)


maximum number of observations for the design


maximum number for Nmax (see details)


number of looks at the data, Inf denotes looking after each observation


probability of success under the null


vector of length 2 with nominal significance levels for each side, if not NULL overrides conf.level and alternative (see getTSalpha)


confidence level, ignored if tsalpha is not NULL


character, alternative hypothesis, either 'less', 'greater' or 'two.sided'


character, which sides are binding: 'both', 'upper', or 'lower'


probability of success under alternative for power calculations


nominal power, boundary strives to have power under the alternative at least equal to power


logical, if TRUE max(N) will be at least as large as the fixed sample size for which all greater N have power>power


integer, on the iteration checkmax, check that Nmax has power at least power


one sided alpha level for test theta>theta0


1-power, for theta1


character, type of 2-stage design, either 'optimal' or 'minimax'


maximum total sample size, cannot be higher than 1000


The tsalpha, alternative, and conf.level are input into the getTSalpha function to output a tsalpha vector. The tsalpha vector allows the nominal error to be different on each side. For details see getTSalpha.

For designAb, when you do not want to stop on the lower or upper boundary at any value of Nk, the associated value of a (lower) or b (upper) should be NA.

The designOBF function calculates a boundary that stops whenever the B-value (Lan and Wittes, 1988) is larger than one cutoff value or smaller than a different cutoff value. The cutoff values are chosen so that the probability of spending alpha on the appropriate side is almost all spent while still rejecting at at least one end value of the boundary.

The function designOBFpower repeatedly calls designOBF and finds the design that gives sufficient power under a given alternative. Specifically, by setting Nmax to Nmaxi in designOBF, where Nmaxi is increased by 1 at each iteration. The initial Nmaxi is either the first N that gives a large enough power in the fixed sample size design (allNgreater==FALSE) or the first N such that all larger N will give enough power for fixed samples (allNgreater==TRUE). On the (checkmax)th iteration, check that the power will be large enough when Nmaxi equals Nmax (from designOBFpower call). So if you set checkmax=1 then you will check the largest value of Nmax first, but this may be inefficient since larger values of Nmax in the obf call are slower.

See Kirk and Fay (2014) for an introductory paper about exact binary sequential tests using the binseqtest package.


a object of class boundEst


Kirk, J, and Fay, MP (2014). An Introduction to Practical Sequential Inferences via Single Arm Binary Response Studies Using the binseqtest R Package. (to appear in American Statistician).

Lan, KKG, and Wittes, J (1988). The B-Value: A Tool for Monitoring Data. Biometrics 44:579-585.

Simon R. (1989). Optimal Two-Stage Designs for Phase II Clinical Trials. Controlled Clinical Trials 10, 1-10.

[Package binseqtest version 1.0.3 Index]