pos2S: Probability of Success for 2 Sample Design

Description Usage Arguments Details Value Methods (by class) See Also Examples

View source: R/pos2S.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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 = 10,
  ...
)

## S3 method for class 'gammaMix'
pos2S(prior1, prior2, n1, n2, decision, eps = 1e-06, ...)

Arguments

prior1

Prior for sample 1.

prior2

Prior for sample 2.

n1, n2

Sample size of the respective samples. Sample size n1 must be greater than 0 while sample size n2 must be greater or equal to 0.

decision

Two-sample decision function to use; see decision2S.

...

Optional arguments.

eps

Support of random variables are determined as the interval covering 1-eps probability mass. Defaults to 10^{-6}.

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).

Details

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 θ_1 and θ_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|θ_2) \, p(θ_2) \, F_1(D_1(y_2)|θ_1) \, p(θ_1) \, dy_2 dθ_2 dθ_1.

where F is the distribution function of the sampling distribution and p(θ_1) and p(θ_2) specifies the assumed true distribution of the parameters θ_1 and θ_2, respectively. Each distribution p(θ_1) and p(θ_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.

Value

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.

Methods (by class)

See Also

Other design2S: decision2S_boundary(), decision2S(), oc2S()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# 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)

RBesT documentation built on Nov. 24, 2021, 5:07 p.m.