Description Usage Arguments Details Value Methods (by class) See Also Examples
View source: R/decision1S_boundary.R
Calculates the decision boundary for a 1 sample design. This is the critical value at which the decision function will change from 0 (failure) to 1 (success).
1 2 3 4 5 6 7 8 9 10  decision1S_boundary(prior, n, decision, ...)
## S3 method for class 'betaMix'
decision1S_boundary(prior, n, decision, ...)
## S3 method for class 'normMix'
decision1S_boundary(prior, n, decision, sigma, eps = 1e06, ...)
## S3 method for class 'gammaMix'
decision1S_boundary(prior, n, decision, eps = 1e06, ...)

prior 
Prior for analysis. 
n 
Sample size for the experiment. 
decision 
Onesample decision function to use; see 
... 
Optional arguments. 
sigma 
The fixed reference scale. If left unspecified, the default reference scale of the prior is assumed. 
eps 
Support of random variables are determined as the
interval covering 
The specification of the 1 sample design (prior, sample size and decision function, D(y)), uniquely defines the decision boundary
y_c = max_{y}{D(y) = 1},
which is the maximal value of y whenever the decision D(y)
function changes its value from 1 to 0 for a decision function
with lower.tail=TRUE
(otherwise the definition is y_c = max_{y}{D(y) = 0}). The decision
function may change at most at a single critical value as only
onesided decision functions are supported. Here,
y is defined for binary and Poisson endpoints as the sufficient
statistic y = ∑_{i=1}^{n} y_i and for the normal
case as the mean \bar{y} = 1/n ∑_{i=1}^n y_i.
The convention for the critical value y_c depends on whether
a left (lower.tail=TRUE
) or rightsided decision function
(lower.tail=FALSE
) is used. For lower.tail=TRUE
the
critical value y_c is the largest value for which the
decision is 1, D(y ≤q y_c) = 1, while for
lower.tail=FALSE
then D(y > y_c) = 1 holds. This is
aligned with the cumulative density function definition within R
(see for example pbinom
).
Returns the critical value y_c.
betaMix
: Applies for binomial model with a mixture
beta prior. The calculations use exact expressions.
normMix
: Applies for the normal model with known
standard deviation σ and a normal mixture prior for the
mean. As a consequence from the assumption of a known standard
deviation, the calculation discards sampling uncertainty of the
second moment. The function decision1S_boundary
has an extra
argument eps
(defaults to 10^{6}). The critical value
y_c is searched in the region of probability mass
1eps
for y.
gammaMix
: Applies for the Poisson model with a gamma
mixture prior for the rate parameter. The function
decision1S_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.
Other design1S:
decision1S()
,
oc1S()
,
pos1S()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  # noninferiority example using normal approximation of loghazard
# ratio, see ?decision1S for all details
s < 2
flat_prior < mixnorm(c(1,0,100), sigma=s)
nL < 233
theta_ni < 0.4
theta_a < 0
alpha < 0.05
beta < 0.2
za < qnorm(1alpha)
zb < qnorm(1beta)
n1 < round( (s * (za + zb)/(theta_ni  theta_a))^2 )
theta_c < theta_ni  za * s / sqrt(n1)
# double criterion design
# statistical significance (like NI design)
dec1 < decision1S(1alpha, theta_ni, lower.tail=TRUE)
# require mean to be at least as good as theta_c
dec2 < decision1S(0.5, theta_c, lower.tail=TRUE)
# combination
decComb < decision1S(c(1alpha, 0.5), c(theta_ni, theta_c), lower.tail=TRUE)
# critical value of double criterion design
decision1S_boundary(flat_prior, nL, decComb)
# ... is limited by the statistical significance ...
decision1S_boundary(flat_prior, nL, dec1)
# ... or the indecision point (whatever is smaller)
decision1S_boundary(flat_prior, nL, dec2)

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