| pos2S | R Documentation |
The pos2S function defines a 2 sample design (priors, sample
sizes & decision function) for the calculation of the probability
of success. A function is returned which calculates the calculates
the frequency at which the decision function is evaluated to 1 when
parameters are distributed according to the given distributions.
pos2S(prior1, prior2, n1, n2, decision, ...)
## S3 method for class 'betaMix'
pos2S(prior1, prior2, n1, n2, decision, eps, ...)
## S3 method for class 'normMix'
pos2S(
prior1,
prior2,
n1,
n2,
decision,
sigma1,
sigma2,
eps = 1e-06,
Ngrid = 5,
family = NULL,
offset1 = 0,
offset2 = offset1,
...
)
## S3 method for class 'gammaMix'
pos2S(prior1, prior2, n1, n2, decision, eps = 1e-06, ...)
prior1 |
Prior for sample 1. |
prior2 |
Prior for sample 2. |
n1, n2 |
Sample size of the respective samples. Sample size |
decision |
Two-sample 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). |
family |
Optional |
offset1 |
Numeric scalar added to the linear predictor of
sample 1 before evaluating the family's variance function.
Relevant for Poisson/negative-binomial models with log link where
|
offset2 |
Numeric scalar added to the linear predictor of
sample 2; see |
The pos2S function defines a 2 sample design and
returns a function which calculates its probability of success.
The probability of success is the frequency with which the decision
function is evaluated to 1 under the assumption of a given true
distribution of the data implied by a distirbution of the
parameters \theta_1 and \theta_2.
The calculation is analogous to the operating characeristics
oc2S() with the difference that instead of assuming
known (point-wise) true parameter values a distribution is
specified for each parameter.
Calling the pos2S function calculates the decision boundary
D_1(y_2) and returns a function which can be used to evaluate the
PoS for different predictive distributions. It is evaluated as
\int\int\int f_2(y_2|\theta_2) \, p(\theta_2) \, F_1(D_1(y_2)|\theta_1) \, p(\theta_1) \, dy_2 d\theta_2 d\theta_1.
where F is the distribution function of the sampling
distribution and p(\theta_1) and p(\theta_2) specifies
the assumed true distribution of the parameters \theta_1 and
\theta_2, respectively. Each distribution p(\theta_1)
and p(\theta_2) is a mixture distribution and given as the
mix1 and mix2 argument to the function.
For example, in the binary case an integration of the predictive
distribution, the BetaBinomial, instead of the binomial
distribution will be performed over the data space wherever the
decision function is evaluated to 1. All other aspects of the
calculation are as for the 2-sample operating characteristics, see
oc2S().
Returns a function which when called with two arguments
mix1 and mix2 will return the frequencies at
which the decision function is evaluated to 1. Each argument is
expected to be a mixture distribution representing the assumed true
distribution of the parameter in each group.
pos2S(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 1-eps probability mass. This is useful for designs
with large sample sizes where an exact approach is very costly to
calculate.
pos2S(normMix): Applies for the normal model with known
standard deviation \sigma 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
1-eps, respectively for y_1 and y_2. The
continuous decision function is evaluated at a discrete grid, which
is determined by a spacing with \delta_2 =
\sigma_2/\sqrt{N_{grid}}. Once the decision boundary is evaluated
at the discrete steps, a spline is used to inter-polate the
decision boundary at intermediate points. With the default adaptive
scheme (see option RBesT.decision2S_boundary in
RBesT) the boundary is evaluated at least once per
standard error \sigma_2/\sqrt{n_2} of the mean of sample 2
(using the reference scale \sigma_2 of prior 2 if
family is given) wherever it is requested and refined further
only where it bends, down to the spacing \delta_2. For single
component priors with fixed \sigma the boundary is instead an
exact line. Operating characteristics and
probability of success request the boundary in the regions which
hold the probability mass 1-eps of y_2. The decision
is represented by a single critical value of y_1 for each
y_2. If family is given, then the sampling standard
deviation grows without bound for extreme outcomes (e.g.\ response
rates close to 0 or 1) such that the posterior reverts to the prior
there and the decision can change a second time along y_1.
This second change is ignored and results are inaccurate whenever
sample 1 has relevant probability mass at such extreme outcomes,
which is the case for small expected event counts. The normal
approximation is questionable in these settings and the exact
designs for the respective endpoint should be used instead. The
operating characteristics and the probability of success issue a
warning if the affected outcomes have a probability of more than
roughly 0.005. This probability is estimated on a coarse grid
of outcomes and can differ from the actual error by a multiple.
pos2S(gammaMix): Applies for the Poisson model with a gamma
mixture prior for the rate parameter. The function
pos2S takes an extra argument eps (defaults to 10^{-6}) which
determines the region of probability mass 1-eps where the
boundary is searched for y_1 and y_2, respectively.
Other design2S:
decision2S(),
decision2S_boundary(),
oc2S()
# 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)
# example interim outcome
postP_interim <- postmix(priorP, n = 10, m = -50)
postT_interim <- postmix(priorT, n = 20, m = -80)
# assume that mean -50 / -80 were observed at the interim for
# placebo control(n=10) / active treatment(n=20) which gives
# the posteriors
postP_interim
postT_interim
# then the PoS to succeed after another 20/30 patients is
pos_final <- pos2S(postP_interim, postT_interim, 20, 30, successCrit)
pos_final(postP_interim, postT_interim)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.