View source: R/getLikelihoodRatio.R
getLikelihoodRatio | R Documentation |
Calculate the likelihood ratio of a p-value for a given distribution.
getLikelihoodRatio(firstStagePValue, design)
firstStagePValue |
First-stage p-value or p-values. Must be a numeric vector between 0 and 1. |
design |
An object of class |
The calculation of the likelihood ratio for a first-stage p-value p_1
is done based on a distributional assumption, specified in the design
object.
The different options require different parameters, elaborated in the following.
likelihoodRatioDistribution="fixed"
: calculates the likelihood ratio for a fixed \Delta
. The non-centrality parameter of the likelihood ratio \vartheta
is then computed as deltaLR
*sqrt(firstStageInformation)
and the likelihood ratio is calculated as:
l(p_1) = e^{\Phi^{-1}(1-p_1)\vartheta - \vartheta^2/2}.
deltaLR
may also contain multiple elements, in which case a weighted likelihood ratio is calculated for the given values. Unless positive weights that sum to 1 are provided by the argument weightsDeltaLR
, equal weights are assumed.
likelihoodRatioDistribution="normal"
: calculates the likelihood ratio for a normally distributed prior of \vartheta
with mean deltaLR
*sqrt(firstStageInformation)
(\mu
) and standard deviation tauLR
*sqrt(firstStageInformation)
(\sigma
). The parameters deltaLR
and tauLR
must be specified on the mean difference scale.
l(p_1) = (1+\sigma^2)^{-\frac{1}{2}}\cdot e^{-(\mu/\sigma)^2/2 + (\sigma\Phi^{-1}(1-p_1) + \mu/\sigma)^2 / (2\cdot (1+\sigma^2))}
likelihoodRatioDistribution="exp"
: calculates the likelihood ratio for an exponentially distributed prior of \vartheta
with mean kappaLR
*sqrt(firstStageInformation)
(\eta
). The likelihood ratio is then calculated as:
l(p_1) = \eta \cdot \sqrt{2\pi} \cdot e^{(\Phi^{-1}(1-p_1)-\eta)^2/2} \cdot \Phi(\Phi^{-1}(1-p_1)-\eta)
likelihoodRatioDistribution="unif"
: calculates the likelihood ratio for a uniformly distributed prior of \vartheta
on the support [0, \Delta\cdot\sqrt{I_1}]
, where \Delta
is specified as deltaMaxLR
and I_1
is the firstStageInformation
.
l(p_1) = \frac{\sqrt{2\pi}}{\Delta\cdot\sqrt{I_1}} \cdot e^{\Phi^{-1}(1-p_1)^2/2} \cdot (\Phi(\Delta\cdot\sqrt{I_1} - \Phi^{-1}(1-p_1))-p_1)
likelihoodRatioDistribution="maxlr"
: the non-centrality parameter \vartheta
is estimated from the data and no additional parameters must be specified. The likelihood ratio is estimated from the data as:
l(p_1) = e^{max(0, \Phi^{-1}(1-p_1))^2/2}
The maximum likelihood ratio is always restricted to effect sizes \vartheta \geq 0
(corresponding to p_1 \leq 0.5
).
The value of the likelihood ratio for the given specification.
Brannath, W. & Bauer, P. (2004). Optimal conditional error functions for the control of conditional power. Biometrics. https://www.jstor.org/stable/3695393
Hung, H. M. J., O’Neill, R. T., Bauer, P. & Kohne, K. (1997). The behavior of the p-value when the alternative hypothesis is true. Biometrics. https://www.jstor.org/stable/2533093
# Get a design
design <- getDesignOptimalConditionalErrorFunction(
alpha = 0.025, alpha1 = 0.001, alpha0 = 0.5, conditionalPower = 0.9,
delta1 = 0.25, likelihoodRatioDistribution = "fixed", deltaLR = 0.25,
firstStageInformation = 80, useInterimEstimate = FALSE,
)
getLikelihoodRatio(firstStagePValue = c(0.05, 0.1, 0.2), design = design)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.