Learn R Programming

RBesT (version 1.2-2)

oc2S: Operating Characteristics for 2 Sample Design

Description

Calculates the frequency at which the decision function is evaluated to 1 under a specified true scenario and decision criteria in a two-sample experiment.

Usage

oc2S(prior1, prior2, n1, n2, decision, ...)

# S3 method for betaMix oc2S(prior1, prior2, n1, n2, decision, eps, ...)

# S3 method for normMix oc2S(prior1, prior2, n1, n2, decision, sigma1, sigma2, eps = 1e-06, Ngrid = 10, ...)

# S3 method for gammaMix oc2S(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.

decision

two-sample decision function to use, see oc2Sdecision.

...

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

Value

Returns a function which when called with two arguments theta1 and theta2 will return the frequencies at which the decision function is evaluated to 1. If called with a named argument y2 then the decision boundary \(y_{1,c} = D_1(y_2)\) is returned. Note that the returned function takes vector arguments.

Methods (by class)

  • betaMix: Applies for the beta-binomial model with a mixture beta prior. The calculations use exact expressions. The decision boundary is returned in alignment with the lower.tail argument of the decision function, i.e. for lower.tail=TRUE the returned critical value is the largest value \(y_{1,c}\) for which the decision is 1 while for lower.tail=FALSE the returned value is the largest value where the decision is still 0 which is compliant with the pbinom function. If the extra argument eps is defined, then an approximate method is used which limits the search for the decision boundary to the region of \(1-10^-6\). This is useful for designs with large sample sizes where an exact approach is very costly to calculate.

  • normMix: Used for the normal-normal model with fixed standard deviation (\(\sigma\)) of the sampling space and a normal mixture prior. As a consequence from the mean assumption, 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 discrete steps which are determined by \(\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.

  • gammaMix: Used for the Poisson-gamma case (Poisson-exponential not yet supported). Takes an extra argument eps (\(10^6\)) which determines the region of probability mass 1-eps where the boundary is searched for \(y_1\) and \(y_2\), respectively.

Details

The operating characteristics calculate the frequency with which the decision function is evaluated to 1 under the assumption of a given true distribution of the data defined by \(\theta_1\) and \(\theta_2\). 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) = \sup_{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) = \inf_{y_1}\{D(y_1,y_2) = 0\}\)). The decision function may change at most at a single critical value as only one-sided decision functions are supported. Here, \(y_2\) is defined for binary and Poisson endpoints as the sufficient statistic \(y_2 = \sum_{i=1}^{n_2} y_{2,i}\) and for the normal case as the mean \(\bar{y}_2 = 1/n_2 \sum_{i=1}^{n_2} y_{2,i}\).

Calling the oc2S function calculates the decision boundary \(D_1(y_2)\) and returns a function which can be used to evaluate the decision boundary or evaluate the desired frequency which is evaluated as

$$ \int f_2(y_2|\theta_2) F_1(D_1(y_2)|\theta_1) dy_2. $$

Note: Internally, the above integration is carried out assuming that it suffices to assume a true distribution of the mean.

See below for examples and specifics for the supported mixture priors.

References

Schmidli H, Gsteiger S, Roychoudhury S, O'Hagan A, Spiegelhalter D, Neuenschwander B. Robust meta-analytic-predictive priors in clinical trials with historical control information. Biometrics 2014;70(4):1023-1032.

See Also

Other oc2S: oc2Sdecision

Examples

Run this code
# NOT RUN {
# example from Schmidli et al., 2015
dec <- oc2Sdecision(0.975, 0, lower.tail=FALSE)

N <- 40
prior_inf <- mixbeta(c(1, 4, 16))
prior_rob <- robustify(prior_inf, weight=0.2, mean=0.5)
prior_uni <- mixbeta(c(1, 1,  1))
N_ctl <- N - ess(prior_inf, method="morita")

# compare designs with different priors
design_uni <- oc2S(prior_uni, prior_uni, N, N_ctl, dec)
design_inf <- oc2S(prior_uni, prior_inf, N, N_ctl, dec)
design_rob <- oc2S(prior_uni, prior_rob, N, N_ctl, dec)

# decision boundary conditional on outcome of control
design_uni(y2=0:N_ctl)
design_inf(y2=0:N_ctl)
design_rob(y2=0:N_ctl)

# type I error
curve(design_inf(x,x), 0, 1)
curve(design_uni(x,x), lty=2, add=TRUE)
curve(design_rob(x,x), lty=3, add=TRUE)

# power
curve(design_inf(0.2+x,0.2), 0, 0.5)
curve(design_uni(0.2+x,0.2), lty=2, add=TRUE)
curve(design_rob(0.2+x,0.2), lty=3, add=TRUE)


# }

Run the code above in your browser using DataLab