Description Usage Arguments Details Value Methods (by class) See Also Examples
View source: R/decision2S_boundary.R
The decision2S_boundary
function defines a 2 sample design
(priors, sample sizes, decision function) for the calculation of
the decision boundary. A function is returned which calculates the
critical value of the first sample y_{1,c} as a function of
the outcome in the second sample y_2. At the decision
boundary, the decision function will change between 0 (failure) and
1 (success) for the respective outcomes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  decision2S_boundary(prior1, prior2, n1, n2, decision, ...)
## S3 method for class 'betaMix'
decision2S_boundary(prior1, prior2, n1, n2, decision, eps, ...)
## S3 method for class 'normMix'
decision2S_boundary(
prior1,
prior2,
n1,
n2,
decision,
sigma1,
sigma2,
eps = 1e06,
Ngrid = 10,
...
)
## S3 method for class 'gammaMix'
decision2S_boundary(prior1, prior2, n1, n2, decision, eps = 1e06, ...)

prior1 
Prior for sample 1. 
prior2 
Prior for sample 2. 
n1, n2 
Sample size of the respective samples. Sample size 
decision 
Twosample decision function to use; see 
... 
Optional arguments. 
eps 
Support of random variables are determined as the
interval covering 
sigma1 
The fixed reference scale of sample 1. If left unspecified, the default reference scale of the prior 1 is assumed. 
sigma2 
The fixed reference scale of sample 2. If left unspecified, the default reference scale of the prior 2 is assumed. 
Ngrid 
Determines density of discretization grid on which decision function is evaluated (see below for more details). 
For a 2 sample design the specification of the priors, the sample sizes and the decision function, D(y_1,y_2), uniquely defines the decision boundary
D_1(y_2) = max_{y_1}{D(y_1,y_2) = 1},
which is the critical value of y_{1,c} conditional on the
value of y_2 whenever the decision D(y_1,y_2) function
changes its value from 0 to 1 for a decision function with
lower.tail=TRUE
(otherwise the definition is D_1(y_2) = max_{y_1}{D(y_1,y_2) =
0}). The decision function may change at most at a single critical
value for given y_{2} as only onesided decision functions
are supported. Here, y_2 is defined for binary and Poisson
endpoints as the sufficient statistic y_2 = ∑_{i=1}^{n_2}
y_{2,i} and for the normal case as the mean \bar{y}_2 = 1/n_2
∑_{i=1}^{n_2} y_{2,i}.
Returns a function with a single argument. This function calculates in dependence of the outcome y_2 in sample 2 the critical value y_{1,c} for which the defined design will change the decision from 0 to 1 (or vice versa, depending on the decision function).
betaMix
: Applies for binomial model with a mixture
beta prior. The calculations use exact expressions. If the
optional argument eps
is defined, then an approximate method
is used which limits the search for the decision boundary to the
region of 1eps
probability mass. This is useful for designs
with large sample sizes where an exact approach is very costly to
calculate.
normMix
: Applies for the normal model with known
standard deviation σ and normal mixture priors for the
means. As a consequence from the assumption of a known standard
deviation, the calculation discards sampling uncertainty of the
second moment. The function has two extra arguments (with
defaults): eps
(10^{6}) and Ngrid
(10). The
decision boundary is searched in the region of probability mass
1eps
, respectively for y_1 and y_2. The
continuous decision function is evaluated at a discrete grid, which
is determined by a spacing with δ_2 =
σ_2/√{N_{grid}}. Once the decision boundary is evaluated
at the discrete steps, a spline is used to interpolate the
decision boundary at intermediate points.
gammaMix
: Applies for the Poisson model with a gamma
mixture prior for the rate parameter. The function
decision2S_boundary
takes an extra argument eps
(defaults to 10^{6}) which
determines the region of probability mass 1eps
where the
boundary is searched for y_1 and y_2, respectively.
Other design2S:
decision2S()
,
oc2S()
,
pos2S()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  # see ?decision2S for details of example
priorT < mixnorm(c(1, 0, 0.001), sigma=88, param="mn")
priorP < mixnorm(c(1, 49, 20 ), sigma=88, param="mn")
# the success criteria is for delta which are larger than some
# threshold value which is why we set lower.tail=FALSE
successCrit < decision2S(c(0.95, 0.5), c(0, 50), FALSE)
# the futility criterion acts in the opposite direction
futilityCrit < decision2S(c(0.90) , c(40), TRUE)
# success criterion boundary
successBoundary < decision2S_boundary(priorP, priorT, 10, 20, successCrit)
# futility criterion boundary
futilityBoundary < decision2S_boundary(priorP, priorT, 10, 20, futilityCrit)
curve(successBoundary(x), 25:25  49, xlab="y2", ylab="critical y1")
curve(futilityBoundary(x), lty=2, add=TRUE)
# hence, for mean in sample 2 of 10, the critical value for y1 is
y1c < futilityBoundary(10)
# around the critical value the decision for futility changes
futilityCrit(postmix(priorP, m=y1c+1E3, n=10), postmix(priorT, m=10, n=20))
futilityCrit(postmix(priorP, m=y1c1E3, n=10), postmix(priorT, m=10, n=20))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.