Package 'EQUIVNONINF'

Title: Testing for Equivalence and Noninferiority
Description: Making available in R the complete set of programs accompanying S. Wellek's (2010) monograph ''Testing Statistical Hypotheses of Equivalence and Noninferiority. Second Edition'' (Chapman&Hall/CRC).
Authors: Stefan Wellek, Peter Ziegler
Maintainer: Stefan Wellek <[email protected]>
License: CC0
Version: 1.0.2
Built: 2024-12-15 07:30:48 UTC
Source: CRAN

Help Index


Testing for equivalence and noninferiority

Description

The package makes available in R the complete set of programs accompanying S. Wellek's (2010) monograph "Testing Statistical Hypotheses of Equivalence and Noninferiority. Second Edition" (Chapman&Hall/CRC).

Note

In order to keep execution time of all examples below the limit set by the CRAN administration, in a number of cases the function calls shown in the documentation contain specifications which are insufficient for real applications. This holds in particular true for the width sw of search grids, which should be chosen to be .001 or smaller. Similarly, the maximum number of interval halving steps to be carried out in finding maximally admissible significance levels should be set to values >= 10.

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

Maintainer: Stefan Wellek <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2015.

Examples

bi2ste1(397,397,0.0,0.025,0.511,0.384)
bi2ste2(0.0,0.025,0.95,0.8,0.80,1.0)

Critical constants and power of the UMP test for equivalence of a single binomial proportion to some given reference value

Description

The function computes the critical constants defining the uniformly most powerful (randomized) test for the problem pp1p \le p_1 or pp2p \ge p_2 versus p1<p<p2p_1 < p < p_2, with pp denoting the parameter of a binomial distribution from which a single sample of size nn is available. In the output, one also finds the power against the alternative that the true value of pp falls on the midpoint of the hypothetical equivalence interval (p1,p2).(p_1 , p_2).

Usage

bi1st(alpha,n,P1,P2)

Arguments

alpha

significance level

n

sample size

P1

lower limit of the hypothetical equivalence range for the binomial parameter pp

P2

upper limit of the hypothetical equivalence range for pp

Value

alpha

significance level

n

sample size

P1

lower limit of the hypothetical equivalence range for the binomial parameter pp

P2

upper limit of the hypothetical equivalence range for pp

C1

left-hand limit of the critical interval for the observed number XX of successes

C2

right-hand limit of the critical interval for XX

GAM1

probability of rejecting the null hypothesis when it turns out that X=C1X=C_1

GAM2

probability of rejecting the null hypothesis for X=C2X=C_2

POWNONRD

Power of the nonrandomized version of the test against the alternative p=(p1+p2)/2p = (p_1+p_2)/2

POW

Power of the randomized UMP test against the alternative p=(p1+p2)/2p = (p_1+p_2)/2

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 4.3.

Examples

bi1st(.05,273,.65,.75)

Power of the exact Fisher type test for equivalence

Description

The function computes exact values of the power of the randomized UMPU test for equivalence in the strict (i.e. two-sided) sense of two binomial distributions and the conservative nonrandomized version of that test. It is assumed that the samples being available from both distributions are independent.

Usage

bi2aeq1(m,n,rho1,rho2,alpha,p1,p2)

Arguments

m

size of Sample 1

n

size of Sample 2

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

Value

m

size of Sample 1

n

size of Sample 2

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

POWNR

Power of the nonrandomized version of the test

POW

Power of the randomized UMPU test

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.4.

Examples

bi2aeq1(302,302,0.6667,1.5,0.05,0.5,0.5)

Sample sizes for the exact Fisher type test for equivalence

Description

The function computes minimum sample sizes required in the randomized UMPU test for equivalence of two binomial distributions with respect to the odds ratio. Computation is done under the side condition that the ratio m/nm/n has some predefined value λ\lambda.

Usage

bi2aeq2(rho1,rho2,alpha,p1,p2,beta,qlambd)

Arguments

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

beta

target value of power

qlambd

sample size ratio m/nm/n

Value

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

beta

target value of power

qlambd

sample size ratio m/nm/n

M

minimum size of Sample 1

N

minimum size of Sample 2

POW

Power of the randomized UMPU test attained with the computed values of m,n

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.4.

Examples

bi2aeq2(0.5,2.0,0.05,0.5,0.5,0.60,1.0)

Determination of a maximally raised nominal significance level for the nonrandomized version of the exact Fisher type test for equivalence

Description

The objective is to raise the nominal significance level as far as possible without exceeding the target significance level in the nonrandomized version of the test. The approach goes back to R.D. Boschloo (1970) who used the same technique for reducing the conservatism of the traditional nonrandomized Fisher test for superiority.

Usage

bi2aeq3(m,n,rho1,rho2,alpha,sw,tolrd,tol,maxh)

Arguments

m

size of Sample 1

n

size of Sample 2

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tolrd

horizontal distance from 0 and 1, respectively of the left- and right-most boundary point to be included in the search grid

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

Details

It should be noted that, as the function of the nominal level, the size of the nonrandomized test is piecewise constant. Accordingly, there is a nondegenerate interval of "candidate" nominal levels serving the purpose. The limits of such an interval can be read from the output. In terms of execution time, bi2aeq3 is the most demanding program of the whole package.

Value

m

size of Sample 1

n

size of Sample 2

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tolrd

horizontal distance from 0 and 1, respectively of the left- and right-most boundary point to be included in the search grid

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

ALPH_0

current trial value of the raised nominal level searched for

NHST

number of interval-halving steps performed up to now

SIZE

size of the critical region corresponding to α0\alpha_0

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Boschloo RD: Raised conditional level of significance for the 2 x 2- table when testing the equality of two probabilities. Statistica Neerlandica 24 (1970), 1-35.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.5.

Examples

bi2aeq3(50,50,0.6667,1.5000,0.05,0.01,0.000001,0.0001,5)

Objective Bayesian test for noninferiority in the two-sample setting with binary data and the difference of the two proportions as the parameter of interest

Description

Implementation of the construction described on pp. 185-6 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

bi2by_ni_del(N1,N2,EPS,SW,NSUB,ALPHA,MAXH)

Arguments

N1

size of Sample 1

N2

size of sample 2

EPS

noninferiority margin to the difference of success probabilities

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

NSUB

number of subintervals for partitioning the range of integration

ALPHA

target significance level

MAXH

maximum number of interval halving steps to be carried out in finding the maximally admissible nominal level

Details

The program uses 96-point Gauss-Legendre quadrature on each of the NSUB intervals into which the range of integration is partitioned.

Value

N1

size of Sample 1

N2

size of sample 2

EPS

noninferiority margin to the difference of success probabilities

NSUB

number of subintervals for partitioning the range of integration

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPHA0

result of the search for the largest admissible nominal level

SIZE0

size of the critical region corresponding to α0\alpha_0

SIZE_UNC

size of the critical region of the test at uncorrected nominal level

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Statistical methods for the analysis of two-armed non-inferiority trials with binary outcomes. Biometrical Journal 47 (2005), 48–61.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.3.

Examples

bi2by_ni_del(20,20,.10,.01,10,.05,5)

Objective Bayesian test for noninferiority in the two-sample setting with binary data and the odds ratio as the parameter of interest

Description

Implementation of the construction described on pp. 179–181 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

bi2by_ni_OR(N1,N2,EPS,SW,NSUB,ALPHA,MAXH)

Arguments

N1

size of sample 1

N2

size of sample 2

EPS

noninferiority margin to the deviation of the odds ratio from unity

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

NSUB

number of subintervals for partitioning the range of integration

ALPHA

target significance level

MAXH

maximum number of interval halving steps to be carried out in finding the maximally admissible nominal level

Details

The program uses 96-point Gauss-Legendre quadrature on each of the NSUB intervals into which the range of integration is partitioned.

Value

N1

size of sample 1

N2

size of sample 2

EPS

noninferiority margin to the deviation of the odds ratio from unity

NSUB

number of subintervals for partitioning the range of integration

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPHA0

result of the search for the largest admissible nominal level

SIZE0

size of the critical region corresponding to α0\alpha_0

SIZE_UNC

size of the critical region of the test at uncorrected nominal level

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Statistical methods for the analysis of two-arm non-inferiority trials with binary outcomes. Biometrical Journal 47 (2005), 48–61.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.2.

Examples

bi2by_ni_OR(10,10,1/3,.0005,10,.05,12)

Determination of a corrected nominal significance level for the asymptotic test for equivalence of two unrelated binomial proportions with respect to the difference δ\delta of their population counterparts

Description

The program computes the largest nominal significance level which can be substituted for the target level α\alpha without making the exact size of the asymptotic testing procedure larger than α\alpha.

Usage

bi2diffac(alpha,m,n,del1,del2,sw,tolrd,tol,maxh)

Arguments

alpha

significance level

m

size of Sample 1

n

size of Sample 2

del1

absolute value of the lower limit of the hypothetical equivalence range for p1p2p_1-p_2

del2

upper limit of the hypothetical equivalence range for p1p2p_1-p_2

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tolrd

horizontal distance of the left- and right-most boundary point to be included in the search grid

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

Value

alpha

significance level

m

size of Sample 1

n

size of Sample 2

del1

absolute value of the lower limit of the hypothetical equivalence range for p1p2p_1-p_2

del2

upper limit of the hypothetical equivalence range for p1p2p_1-p_2

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tolrd

horizontal distance of the left- and right-most boundary point to be included in the search grid

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

NH

number of interval-halving steps actually performed

ALPH_0

value of the raised nominal level obtained after NH steps

SIZE0

size of the critical region corresponding to α0\alpha_0

ERROR

error indicator answering the question of whether or not the sufficient condition for the correctness of the result output by the program, was satisfied

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.6.

Examples

bi2diffac(0.05,20,20,0.40,0.40,0.1,1e-6,1e-4,3)

Exact rejection probability of the asymptotic test for equivalence of two unrelated binomial proportions with respect to the difference of their expectations at any nominal level under an arbitrary parameter configuration

Description

The program computes exact values of the rejection probability of the asymptotic test for equivalence in the sense of δ1<p1p2<δ2-\delta_1 < p_1-p_2 < \delta_2, at any nominal level α0\alpha_0. [The largest α0\alpha_0 for which the test is valid in terms of the significance level, can be computed by means of the program bi2diffac.]

Usage

bi2dipow(alpha0,m,n,del1,del2,p1,p2)

Arguments

alpha0

nominal significance level

m

size of Sample 1

n

size of Sample 2

del1

absolute value of the lower limit of the hypothetical equivalence range for p1p2p_1-p_2

del2

upper limit of the hypothetical equivalence range for p1p2p_1-p_2

p1

true value of the success probability in Population 1

p2

true value of the success probability in Population 2

Value

alpha0

nominal significance level

m

size of Sample 1

n

size of Sample 2

del1

absolute value of the lower limit of the hypothetical equivalence range for p1p2p_1-p_2

del2

upper limit of the hypothetical equivalence range for p1p2p_1-p_2

p1

true value of the success probability in Population 1

p2

true value of the success probability in Population 2

POWEX0

exact rejection probability under (p1,p2)(p_1,p_2) of the test at nominal level α0\alpha_0 for equivalence of two binomial distributions with respect to the difference of the success probabilities

ERROR

error indicator answering the question of whether or not the sufficient condition for the correctness of the result output by the program, was satisfied

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.6.

Examples

bi2dipow(0.0228,50,50,0.20,0.20,0.50,0.50)

Power of the exact Fisher type test for relevant differences

Description

The function computes exact values of the power of the randomized UMPU test for relevant differences between two binomial distributions and the conservative nonrandomized version of that test. It is assumed that the samples being available from both distributions are independent.

Usage

bi2rlv1(m,n,rho1,rho2,alpha,p1,p2)

Arguments

m

size of Sample 1

n

size of Sample 2

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

Value

m

size of Sample 1

n

size of Sample 2

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

POWNR

power of the nonrandomized version of the test

POW

power of the randomized UMPU test

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 11.3.3.

Examples

bi2rlv1(200,300,.6667,1.5,.05,.25,.10)

Sample sizes for the exact Fisher type test for relevant differences

Description

The function computes minimum sample sizes required in the randomized UMPU test for relevant differences between two binomial distributions with respect to the odds ratio. Computation is done under the side condition that the ratio m/nm/n has some predefined value λ\lambda.

Usage

bi2rlv2(rho1,rho2,alpha,p1,p2,beta,qlambd)

Arguments

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

beta

target value of power

qlambd

sample size ratio m/nm/n

Value

rho1

lower limit of the hypothetical equivalence range for the odds ratio

rho2

upper limit of the hypothetical equivalence range for the odds ratio

alpha

significance level

p1

true success rate in Population 1

p2

true success rate in Population 2

beta

target value of power

qlambd

sample size ratio m/nm/n

M

minimum size of Sample 1

N

minimum size of Sample 2

POW

power of the randomized UMPU test attained with the computed values of m, n

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 11.3.3.

Examples

bi2rlv2(.6667,1.5,.05,.70,.50,.50,2.0)

Critical constants for the exact Fisher type UMPU test for equivalence of two binomial distributions with respect to the odds ratio

Description

The function computes the critical constants defining the uniformly most powerful unbiased test for equivalence of two binomial distributions with parameters p1p_1 and p2p_2 in terms of the odds ratio. Like the ordinary Fisher type test of the null hypothesis p1=p2p_1 = p_2, the test is conditional on the total number SS of successes in the pooled sample.

Usage

bi2st(alpha,m,n,s,rho1,rho2)

Arguments

alpha

significance level

m

size of Sample 1

n

size of Sample 2

s

observed total count of successes

rho1

lower limit of the hypothetical equivalence range for the odds ratio ϱ=p1(1p2)p2(1p1)\varrho = \frac{p_1(1-p_2)}{p_2(1-p_1)}

rho2

upper limit of the hypothetical equivalence range for ϱ\varrho

Value

alpha

significance level

m

size of Sample 1

n

size of Sample 2

s

observed total count of successes

rho1

lower limit of the hypothetical equivalence range for the odds ratio ϱ=p1(1p2)p2(1p1)\varrho = \frac{p_1(1-p_2)}{p_2(1-p_1)}

rho2

upper limit of the hypothetical equivalence range for ϱ\varrho

C1

left-hand limit of the critical interval for the number XX of successes observed in Sample 1

C2

right-hand limit of the critical interval for XX

GAM1

probability of rejecting the null hypothesis when it turns out that X=C1X=C_1

GAM2

probability of rejecting the null hypothesis for X=C2X=C_2

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.4.

Examples

bi2st(.05,225,119,171, 2/3, 3/2)

Power of the exact Fisher type test for noninferiority

Description

The function computes exact values of the power of the randomized UMPU test for one-sided equivalence of two binomial distributions and its conservative nonrandomized version. It is assumed that the samples being available from both distributions are independent.

Usage

bi2ste1(m, n, eps, alpha, p1, p2)

Arguments

m

size of Sample 1

n

size of Sample 2

eps

noninferiority margin to the odds ratio ϱ\varrho, defined to be the maximum acceptable deviation of the true value of ϱ\varrho from unity

alpha

significance level

p1

success rate in Population 1

p2

success rate in Population 2

Value

m

size of Sample 1

n

size of Sample 2

eps

noninferiority margin to the odds ratio ϱ\varrho, defined to be the maximum acceptable deviation of the true value of ϱ\varrho from unity

alpha

significance level

p1

success rate in Population 1

p2

success rate in Population 2

POWNR

power of the nonrandomized version of the test

POW

power of the randomized UMPU test

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, 6.6.1.

Examples

bi2ste1(106,107,0.5,0.05,0.9245,0.9065)

Sample sizes for the exact Fisher type test for noninferiority

Description

Sample sizes for the exact Fisher type test for noninferiority

Usage

bi2ste2(eps, alpha, p1, p2, bet, qlambd)

Arguments

eps

noninferiority margin to the odds ratio

alpha

significance level

p1

success rate in Population 1

p2

success rate in Population 2

bet

target power value

qlambd

sample size ratio m/nm/n

Details

The program computes the smallest sample sizes mm,nn satisfying m/n=λm/n = \lambda required for ensuring that the power of the randomized UMPU test does not fall below β\beta.

Value

eps

noninferiority margin to the odds ratio

alpha

significance level

p1

success rate in Population 1

p2

success rate in Population 2

bet

target power value

qlambd

sample size ratio m/nm/n

M

minimum size of Sample 1

N

minimum size of Sample 2

POW

power of the randomized UMPU test attained with the computed values of m, n

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, 6.6.1.

Examples

bi2ste2(0.5,0.05,0.9245,0.9065,0.80,1.00)

Determination of a maximally raised nominal significance level for the nonrandomized version of the exact Fisher type test for noninferiority

Description

The objective is to raise the nominal significance level as far as possible without exceeding the target significance level in the nonrandomized version of the test. The approach goes back to R.D. Boschloo (1970) who used the same technique for reducing the conservatism of the traditional nonrandomized Fisher test for superiority.

Usage

bi2ste3(m, n, eps, alpha, sw, tolrd, tol, maxh)

Arguments

m

size of Sample 1

n

size of Sample 2

eps

noninferiority margin to the odds ratio ϱ\varrho, defined to be the maximum acceptable deviation of the true value of ϱ\varrho from unity

alpha

target significance level

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tolrd

horizontal distance from 0 and 1, respectively, of the left- and right-most boundary point to be included in the search grid

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval-halving steps to be carried out in finding the maximally raised nominal level

Details

It should be noted that, as the function of the nominal level, the size of the nonrandomized test is piecewise constant. Accordingly, there is a nondegenerate interval of "candidate" nominal levels serving the purpose. The limits of such an interval can be read from the output.

Value

m

size of Sample 1

n

size of Sample 2

eps

noninferiority margin to the odds ratio ϱ\varrho, defined to be the maximum acceptable deviation of the true value of ϱ\varrho from unity

alpha

target significance level

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tolrd

horizontal distance from 0 and 1, respectively, of the left- and right-most boundary point to be included in the search grid

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval-halving steps to be carried out in finding the maximally raised nominal level

ALPH_0

current trial value of the raised nominal level searched for

NHST

number of interval-halving steps performed up to now

SIZE

size of the critical region corresponding to α0\alpha_0

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Boschloo RD: Raised conditional level of significance for the 2 x 2- table when testing the equality of two probabilities. Statistica Neerlandica 24 (1970), 1-35.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S6.6.2.

Examples

bi2ste3(50, 50, 1/3, 0.05, 0.05, 1e-10, 1e-8, 10)

Function to compute corrected nominal levels for the Wald type (asymptotic) test for one-sided equivalence of two binomial distributions with respect to the difference of success rates

Description

Implementation of the construction described on pp. 183-5 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

bi2wld_ni_del(N1,N2,EPS,SW,ALPHA,MAXH)

Arguments

N1

size of Sample 1

N2

size of Sample 2

EPS

noninferiority margin to the difference of success probabilities

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPHA

target significance level

MAXH

maximum number of interval-halving steps

Details

The program computes the largest nominal significance level to be used for determining the critical lower bound to the Wald-type statistic for the problem of testing H:p1p2εH:p_1 \le p_2 - \varepsilon versus K:p1<p2εK: p_1 < p_2 - \varepsilon.

Value

N1

size of Sample 1

N2

size of Sample 2

EPS

noninferiority margin to the difference of success probabilities

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPHA

target significance level

MAXH

maximum number of interval-halving steps

ALPHA0

corrected nominal level

SIZE0

size of the critical region of the test at nominal level ALPHA0

SIZE_UNC

size of the test at uncorrected nominal level ALPHA

ERR_IND

indicator taking value 1 when it occurs that the sufficient condition allowing one to restrict the search for the maximum of the rejection probability under the null hypothesis to its boundary, fails to be satisfied; otherwise the indicator retains its default value 0.

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.6.3.

Examples

bi2wld_ni_del(25,25,.10,.01,.05,10)

Exact confidence bounds to the relative excess heterozygosity (REH) exhibited by a SNP genotype distribution

Description

Implementation of the interval estimation procedure described on pp. 305-6 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

cf_reh_exact(X1,X2,X3,alpha,SW,TOL,ITMAX)

Arguments

X1

count of homozygotes of the first kind [\leftrightarrow genotype AA]

X2

count of heterozygotes [\leftrightarrow genotype AB]

X3

count of homozygotes of the second kind [\leftrightarrow genotype BB]

alpha

1 - confidence level

SW

width of the search grid for determining an interval covering the parameter point at which the conditional distribution function takes value α\alpha and 1α1-\alpha, respectively

TOL

numerical tolerance to the deviation between the computed confidence limits and their exact values

ITMAX

maximum number of interval-halving steps

Details

The program exploits the structure of the family of all genotype distributions, which is 2-parameter exponential with log(REH)\log(REH) as one of these parameters.

Value

X1

count of homozygotes of the first kind [\leftrightarrow genotype AA]

X2

count of heterozygotes [\leftrightarrow genotype AB]

X3

count of homozygotes of the second kind [\leftrightarrow genotype BB]

alpha

1 - confidence level

SW

width of the search grid for determining an interval covering the parameter point at which the conditional distribution function takes value α\alpha and 1α1-\alpha, respectively

TOL

numerical tolerance to the deviation between the computed confidence limits and their exact values

ITMAX

maximum number of interval-halving steps

C_l_exact

exact conditional lower (1α)(1-\alpha)-confidence bound to REH

C_r_exact

exact conditional upper (1α)(1-\alpha)-confidence bound to REH

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S, Goddard KAB, Ziegler A: A confidence-limit-based approach to the assessment of Hardy-Weinberg equilibrium. Biometrical Journal 52 (2010), 253-270.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 9.4.3.

Examples

cf_reh_exact(34,118,96,.05,.1,1E-4,25)

Mid-p-value - based confidence bounds to the relative excess heterozygosity (REH) exhibited by a SNP genotype distribution

Description

Implementation of the interval estimation procedure described on pp. 306-7 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

cf_reh_midp(X1,X2,X3,alpha,SW,TOL,ITMAX)

Arguments

X1

count of homozygotes of the first kind [\leftrightarrow genotype AA]

X2

count of heterozygotes [\leftrightarrow genotype AB]

X3

count of homozygotes of the second kind [\leftrightarrow genotype BB]

alpha

1 - confidence level

SW

width of the search grid for determining an interval covering the parameter point at which the conditional distribution function takes value α\alpha and 1α1-\alpha, respectively

TOL

numerical tolerance to the deviation between the computed confidence limits and their exact values

ITMAX

maximum number of interval-halving steps

Details

The mid-p algorithm serves as a device for reducing the conservatism inherent in exact confidence estimation procedures for parameters of discrete distributions.

Value

X1

count of homozygotes of the first kind [\leftrightarrow genotype AA]

X2

count of heterozygotes [\leftrightarrow genotype AB]

X3

count of homozygotes of the second kind [\leftrightarrow genotype BB]

alpha

1 - confidence level

SW

width of the search grid for determining an interval covering the parameter point at which the conditional distribution function takes value α\alpha and 1α1-\alpha, respectively

TOL

numerical tolerance to the deviation between the computed confidence limits and their exact values

ITMAX

maximum number of interval-halving steps

C_l_midp

lower (1α)(1-\alpha)-confidence bound to REH based on conditional mid-p-values

C_r_midp

upper (1α)(1-\alpha)-confidence bound to REH based on conditional mid-p-values

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Agresti A: Categorical data Analysis (2nd edn). Hoboken, NJ: Wiley, Inc., 2002, Section 1.4.5.

Wellek S, Goddard KAB, Ziegler A: A confidence-limit-based approach to the assessment of Hardy-Weinberg equilibrium. Biometrical Journal 52 (2010), 253-270.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 9.4.3.

Examples

cf_reh_midp(137,34,8,.05,.1,1E-4,25)

Critical constants and power against the null alternative of the UMP test for equivalence of the hazard rate of a single exponential distribution to some given reference value

Description

The function computes the critical constants defining the uniformly most powerful test for the problem σ1/(1+ε)\sigma \le 1/(1 + \varepsilon) or σ(1+ε)\sigma\ge (1 + \varepsilon) versus 1/(1+ε)<σ<(1+ε)1/(1 + \varepsilon) < \sigma < (1 + \varepsilon), with σ\sigma denoting the scale parameter [\equiv reciprocal hazard rate] of an exponential distribution.

Usage

exp1st(alpha,tol,itmax,n,eps)

Arguments

alpha

significance level

tol

tolerable deviation from α\alpha of the rejection probability at either boundary of the hypothetical equivalence interval

itmax

maximum number of iteration steps

n

sample size

eps

margin determining the hypothetical equivalence range symmetrically on the log-scale

Value

alpha

significance level

tol

tolerable deviation from α\alpha of the rejection probability at either boundary of the hypothetical equivalence interval

itmax

maximum number of iteration steps

n

sample size

eps

margin determining the hypothetical equivalence range symmetrically on the log-scale

IT

number of iteration steps performed until reaching the stopping criterion corresponding to TOL

C1

left-hand limit of the critical interval for T=i=1nXiT =\sum_{i=1}^n X_i

C2

right-hand limit of the critical interval for T=i=1nXiT =\sum_{i=1}^n X_i

ERR1

deviation of the rejection probability from α\alpha under σ=1/(1+ε)\sigma = 1/(1 + \varepsilon)

POW0

power of the randomized UMP test against the alternative σ=1\sigma = 1

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 4.2.

Examples

exp1st(0.05,1.0e-10,100,80,0.3)

Critical constants and power of the UMPI (uniformly most powerful invariant) test for dispersion equivalence of two Gaussian distributions

Description

The function computes the critical constants defining the optimal test for the problem σ2/τ2ϱ1\sigma^2/\tau^2 \le \varrho_1 or σ2/τ2ϱ2\sigma^2/\tau^2 \ge \varrho_2 versus ϱ1<σ2/τ2<ϱ2\varrho_1 < \sigma^2/\tau^2 < \varrho_2, with (ϱ1,ϱ2)(\varrho_1,\varrho_2) as a fixed nonempty interval around unity.

Usage

fstretch(alpha,tol,itmax,ny1,ny2,rho1,rho2)

Arguments

alpha

significance level

tol

tolerable deviation from α\alpha of the rejection probability at either boundary of the hypothetical equivalence interval

itmax

maximum number of iteration steps

ny1

number of degrees of freedom of the estimator of σ2\sigma^2

ny2

number of degrees of freedom of the estimator of τ2\tau^2

rho1

lower equivalence limit to σ2/τ2\sigma^2/\tau^2

rho2

upper equivalence limit to σ2/τ2\sigma^2/\tau^2

Value

alpha

significance level

tol

tolerable deviation from α\alpha of the rejection probability at either boundary of the hypothetical equivalence interval

itmax

maximum number of iteration steps

ny1

number of degrees of freedom of the estimator of σ2\sigma^2

ny2

number of degrees of freedom of the estimator of τ2\tau^2

rho1

lower equivalence limit to σ2/τ2\sigma^2/\tau^2

rho2

upper equivalence limit to σ2/τ2\sigma^2/\tau^2

IT

number of iteration steps performed until reaching the stopping criterion corresponding to TOL

C1

left-hand limit of the critical interval for

T=n1m1i=1m(XiX)2/j=1n1(YjY)2T = \frac{n-1}{m-1} \sum_{i=1}^m (X_i-\overline{X})^2 / \sum_{j=1}^{n-1} (Y_j-\overline{Y})^2

C2

right-hand limit of the critical interval for

T=n1m1i=1m(XiX)2/j=1n1(YjY)2T = \frac{n-1}{m-1} \sum_{i=1}^m (X_i-\overline{X})^2 / \sum_{j=1}^{n-1} (Y_j-\overline{Y})^2

ERR

deviation of the rejection probability from α\alpha under σ2/τ2=ϱ1\sigma^2/\tau^2 = \varrho_1

POW0

power of the UMPI test against the alternative σ2/τ2=1\sigma^2/\tau^2 = 1

Note

If the two independent samples under analysis are from exponential rather than Gaussian distributions, the critical constants computed by means of fstretch with ν1=2m\nu_1 = 2m, ν2=2n\nu_2 = 2n, can be used for testing for equivalence with respect to the ratio of hazard rates. The only difference is that the ratio of sample means rather than variances has to be used as the test statistic then.

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.5.

Examples

fstretch(0.05, 1.0e-10, 50,40,45,0.5625,1.7689)

Critical constants of the exact UMPU test for approximate compatibility of a SNP genotype distribution with the Hardy-Weinberg model

Description

The function computes the critical constants defining the uniformly most powerful unbiased test for equivalence of the population distribution of the three genotypes distinguishable in terms of a single nucleotide polymorphism (SNP), to a distribution being in Hardy-Weinberg equilibrium (HWE).
The test is conditional on the total count SS of alleles of the kind of interest, and the parameter θ\theta, in terms of which equivalence shall be established, is defined by θ=π22π1(1π1π2)\theta = \frac{\pi_2^2}{\pi_1(1-\pi_1-\pi_2)}, with π1\pi_1 and π2\pi_2 denoting the population frequence of homozygotes of the 1st kind and heterozygotes, respectively.

Usage

gofhwex(alpha,n,s,del1,del2)

Arguments

alpha

significance level

n

number of genotyped individuals

s

observed count of alleles of the kind of interest

del1

absolute value of the lower equivalence limit to θ/41\theta/4 - 1

del2

upper equivalence limit to θ/41\theta/4 - 1

Value

alpha

significance level

n

number of genotyped individuals

s

observed count of alleles of the kind of interest

del1

absolute value of the lower equivalence limit to θ/41\theta/4 - 1

del2

upper equivalence limit to θ/41\theta/4 - 1

C1

left-hand limit of the critical interval for the observed number X2X_2 of heterozygotes

C2

right-hand limit of the critical interval for the observed number X2X_2

GAM1

probability of rejecting the null hypothesis when it turns out that X2=C1X_2=C_1

GAM2

probability of rejecting the null hypothesis for X2=C2X_2=C_2

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Tests for establishing compatibility of an observed genotype distribution with Hardy-Weinberg equilibrium in the case of a biallelic locus. Biometrics 60 (2004), 694-703.

Goddard KAB, Ziegler A, Wellek S: Adapting the logical basis of tests for Hardy-Weinberg equilibrium to the real needs of association studies in human and medical genetics. Genetic Epidemiology 33 (2009), 569-580.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 9.4.2.

Examples

gofhwex(0.05,475,429,1-1/1.96,0.96)

Critical constants of the exact UMPU test for absence of a substantial deficit of heterozygotes as compared with a HWE-compliant SNP genotype distribution [noninferiority version of the test implemented by means of gofhwex]

Description

The function computes the critical constants defining the UMPU test for one-sided equivalence of the population distribution of a SNP, to a distribution being in Hardy-Weinberg equilibrium (HWE).
A substantial deficit of heterozygotes is defined to occur when the true value of the parametric function ω=π2/2π1π3\omega = \frac{\pi_2/2}{\sqrt{\pi_1\pi_3}} [called relative excess heterozygosity (REH)] falls below unity by more than some given margin δ0\delta_0.
Like its two-sided counterpart [see the description of the R function gofhwex], the test is conditional on the total count SS of alleles of the kind of interest.

Usage

gofhwex_1s(alpha,n,s,del0)

Arguments

alpha

significance level

n

number of genotyped individuals

s

observed count of alleles of the kind of interest

del0

noninferiority margin for ω\omega, which has to satisfy ω>1δ0\omega > 1-\delta_0 under the alternative hypothesis to be established

Value

alpha

significance level

n

number of genotyped individuals

s

observed count of alleles of the kind of interest

del0

noninferiority margin for ω\omega, which has to satisfy ω>1δ0\omega > 1-\delta_0 under the alternative hypothesis to be established

C

left-hand limit of the critical interval for the observed number X2X_2 of heterozygotes

GAM

probability of rejecting the null hypothesis when it turns out that X2=CX_2=C

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, pp. 300-302.

Examples

gofhwex_1s(0.05,133,65,1-1/1.96)

Establishing approximate independence in a two-way contingency table: Test statistic and critical bound

Description

The function computes all quantities required for carrying out the asymptotic test for approximate independence of two categorial variables derived in §\S 9.2 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

gofind_t(alpha,r,s,eps,xv)

Arguments

alpha

significance level

r

number of rows of the contingency table under analysis

s

number of columns of the contingency table under analysis

eps

margin to the Euclidean distance between the vector π\mathbf{\pi} of true cell probabilities and the associated vector of products of marginal totals

xv

row vector of length rsr\cdot s whose (i1)s+j(i-1)s + j-th component is the entry in cell (i,j)(i,j) of the r×sr\times s contingency table under analysis i=1,,ri=1,\ldots,r, j=1,,sj=1,\ldots,s.

Value

n

size of the sample to which the input table relates

alpha

significance level

r

number of rows of the contingency table under analysis

s

number of columns of the contingency table under analysis

eps

margin to the Euclidean distance between the vector π\mathbf{\pi} of true cell probabilities and the associated vector of products of marginal totals

X(r, s)

observed cell counts

DSQ_OBS

observed value of the squared Euclidean distance

VN

square root of the estimated asymtotic variance of nDSQ_OBS\sqrt{n}DSQ\_OBS

CRIT

upper critical bound to nDSQ_OBS\sqrt{n}DSQ\_OBS

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 9.2.

Examples

xv <- c(8, 13, 15, 6,  19, 21, 31, 7) 
gofind_t(0.05,2,4,0.15,xv)

Establishing goodness of fit of an observed to a fully specified multinomial distribution: test statistic and critical bound

Description

The function computes all quantities required for carrying out the asymptotic test for goodness rather than lack of fit of an observed to a fully specified multinomial distribution derived in §\S 9.1 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

gofsimpt(alpha,n,k,eps,x,pio)

Arguments

alpha

significance level

n

sample size

k

number of categories

eps

margin to the Euclidean distance between the vectors π\mathbf{\pi} and π0\mathbf{\pi}_0 of true and hypothesized cell probabilities

x

vector of length kk with the observed cell counts as components

pio

prespecified vector of cell probabilities

Value

alpha

significance level

n

sample size

k

number of categories

eps

margin to the Euclidean distance between the vectors π\mathbf{\pi} and π0\mathbf{\pi}_0 of true and hypothesized cell probabilities

X(1, K)

observed cell counts

PI0(1, K)

hypothecized cell probabilities

DSQPIH_0

observed value of the squared Euclidean distance

VN_N

square root of the estimated asymtotic variance of nDSQPIH_0\sqrt{n}DSQPIH\_0

CRIT

upper critical bound to nDSQPIH_0\sqrt{n}DSQPIH\_0

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 9.1.

Examples

x<- c(17,16,25,9,16,17)
pio <- rep(1,6)/6
gofsimpt(0.05,100,6,0.15,x,pio)

Mann-Whitney test for equivalence of two continuous distributions of arbitrary shape: test statistic and critical upper bound

Description

Implementation of the asymptotically distribution-free test for equivalence of two continuous distributions in terms of the Mann-Whitney-Wilcoxon functional. For details see Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition, §\S 6.2.

Usage

mawi(alpha,m,n,eps1_,eps2_,x,y)

Arguments

alpha

significance level

m

size of Sample 1

n

size of Sample 2

eps1_

absolute value of the left-hand limit of the hypothetical equivalence range for π+1/2\pi_+ - 1/2

eps2_

right-hand limit of the hypothetical equivalence range for π+1/2\pi_+ - 1/2

x

row vector with the mm observations making up Sample1 as components

y

row vector with the nn observations making up Sample2 as components

Details

Notation: π+\pi_+ stands for the Mann-Whitney functional defined by π+=P[X>Y]\pi_+ = P[X>Y], with XFX\sim F \equiv cdf of Population 1 being independent of YGY\sim G \equiv cdf of Population 2.

Value

alpha

significance level

m

size of Sample 1

n

size of Sample 2

eps1_

absolute value of the left-hand limit of the hypothetical equivalence range for π+1/2\pi_+ - 1/2

eps2_

right-hand limit of the hypothetical equivalence range for π+1/2\pi_+ - 1/2

W+

observed value of the UU-statistics estimator of π+\pi_+

SIGMAH

square root of the estimated asymtotic variance of W+W_+

CRIT

upper critical bound to W+1/2(ε2ε1)/2/σ^|W_+ - 1/2 - (\varepsilon^\prime_2-\varepsilon^\prime_1)/2|/\hat{\sigma}

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: A new approach to equivalence assessment in standard comparative bioavailability trials by means of the Mann-Whitney statistic. Biometrical Journal 38 (1996), 695-710.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.2.

Examples

x <- c(10.3,11.3,2.0,-6.1,6.2,6.8,3.7,-3.3,-3.6,-3.5,13.7,12.6)
y <- c(3.3,17.7,6.7,11.1,-5.8,6.9,5.8,3.0,6.0,3.5,18.7,9.6)
mawi(0.05,12,12,0.1382,0.2602,x,y)

Determination of a corrected nominal significance level for the asymptotic test for noninferiority in the McNemar setting

Description

The program computes the largest nominal significance level which can be substituted for the target level α\alpha without making the exact size of the asymptotic testing procedure larger than α\alpha.

Usage

mcnasc_ni(alpha,n,del0,sw,tol,maxh)

Arguments

alpha

significance level

n

sample size

del0

absolute value of the noninferiority margin for δ:=p10p01\delta := p_{10}-p_{01}, with p10p_{10} and p01p_{01} denoting the probabilities of discordant pairs of both kinds

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

Value

alpha

significance level

n

sample size

del0

absolute value of the noninferiority margin for δ:=p10p01\delta := p_{10}-p_{01}, with p10p_{10} and p01p_{01} denoting the probabilities of discordant pairs of both kinds

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPH_0

value of the corrected nominal level obtained after nh steps

SIZE_UNC

exact size of the rejection region of the test at uncorrected nominal level α\alpha

SIZE0

exact size of the rejection region of the test at nominal level α0\alpha_0

NH

number of interval-halving steps actually performed

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.2.3.

Examples

mcnasc_ni(0.05,50,0.05,0.05,0.0001,5)

Bayesian test for noninferiority in the McNemar setting with the difference of proportions as the parameter of interest

Description

The program determines through iteration the largest nominal level α0\alpha_0 such that comparing the posterior probability of the alternative hypothesis K1:δ>δ0K_1: \delta > -\delta_0 to the lower bound 1α01-\alpha_0 generates a critical region whose size does not exceed the target significance level α\alpha. In addition, exact values of the power against specific parameter configurations with δ=0\delta = 0 are output.

Usage

mcnby_ni(N,DEL0,K1,K2,K3,NSUB,SW,ALPHA,MAXH)

Arguments

N

sample size

DEL0

noninferiority margin to the difference of the parameters of the marginal binomial distributions under comparison

K1

Parameter 1 of the Dirichlet prior for the family of trinomial distributions

K2

Parameter 2 of the Dirichlet prior for the family of trinomial distributions

K3

Parameter 3 of the Dirichlet prior for the family of trinomial distributions

NSUB

number of subintervals for partitioning the range of integration

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPHA

target significance level

MAXH

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

Details

The program uses 96-point Gauss-Legendre quadrature on each of the NSUB intervals into which the range of integration is partitioned.

Value

N

sample size

DEL0

noninferiority margin to the difference of the parameters of the marginal binomial distributions under comparison

K1

Parameter 1 of the Dirichlet prior for the family of trinomial distributions

K2

Parameter 2 of the Dirichlet prior for the family of trinomial distributions

K3

Parameter 3 of the Dirichlet prior for the family of trinomial distributions

NSUB

number of subintervals for partitioning the range of integration

SW

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPHA

target significance level

MAXH

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

ALPHA0

result of the search for the largest admissible nominal level

SIZE0

size of the critical region corresponding to α0\alpha_0

SIZE_UNC

size of the critical region of test at uncorrected nominal level α\alpha

POW

power against 7 different parameter configurations with δ=0\delta =0

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.2.3.

Examples

mcnby_ni(25,.10,.5,.5,.5,10,.05,.05,5)

Computation of the posterior probability of the alternative hypothesis of noninferiority in the McNemar setting, given a specific point in the sample space

Description

Evaluation of the integral on the right-hand side of Equation (5.24) on p. 88 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

mcnby_ni_pp(N,DEL0,N10,N01)

Arguments

N

sample size

DEL0

noninferiority margin to the difference of the parameters of the marginal binomial distributions under comparison

N10

count of pairs with (X,Y)=(1,0)(X,Y) = (1,0)

N01

count of pairs with (X,Y)=(0,1)(X,Y) = (0,1)

Details

The program uses 96-point Gauss-Legendre quadrature on each of 10 subintervals into which the range of integration is partitioned.

Value

N

sample size

DEL0

noninferiority margin to the difference of the parameters of the marginal binomial distributions under comparison

N10

count of pairs with (X,Y)=(1,0)(X,Y) = (1,0)

N01

count of pairs with (X,Y)=(0,1)(X,Y) = (0,1)

PPOST

posterior probability of the alternative hypothesis K1:δ>δ0K_1: \delta > -\delta_0 with respect to the noninformative prior determined according to Jeffrey's rule

Note

The program uses Equation (5.24) of Wellek S (2010) corrected for a typo in the middle line which must read

δ0(1+δ0)/2[B(n01+1/2,nn01+1)p01n011/2(1p01)nn01\int_{\delta_0}^{(1+\delta_0)/2}\Big[ B\big(n_{01}+1/2,n-n_{01}+1\big)\,\, p_{01}^{n_{01}-1/2}(1-p_{01})^{n-n_{01}}

.

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.2.3.

Examples

mcnby_ni_pp(72,0.05,4,5)

Determination of a corrected nominal significance level for the asymptotic test for equivalence of two paired binomial proportions with respect to the difference of their expectations (McNemar setting)

Description

The program computes the largest nominal significance level which can be substituted for the target level α\alpha without making the exact size of the asymptotic testing procedure larger than α\alpha.

Usage

mcnemasc(alpha,n,del0,sw,tol,maxh)

Arguments

alpha

significance level

n

sample size

del0

upper limit set to p10p01|p_{10}-p_{01}| under the alternative hypothesis of equivalence, with p10p_{10} and p01p_{01} denoting the probabilities of discordant pairs of both kinds

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

tol

upper bound to the absolute difference between size and target level below which the search for a corrected nominal level terminates

maxh

maximum number of interval halving steps to be carried out in finding the maximally raised nominal level

Value

alpha

significance level

n

sample size

del0

upper limit set to p10p01|p_{10}-p_{01}| under the alternative hypothesis of equivalence, with p10p_{10} and p01p_{01} denoting the probabilities of discordant pairs of both kinds

sw

width of the search grid for determining the maximum of the rejection probability on the common boundary of the hypotheses

ALPH_0

value of the corrected nominal level obtained after nh steps

NH

number of interval-halving steps actually performed

ERROR

error indicator messaging "!!!!!" if the sufficient condition for the correctness of the result output by the program was found violated

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.2.2.

Examples

mcnemasc(0.05,50,0.20,0.05,0.0005,5)

Exact rejection probability of the asymptotic test for equivalence of two paired binomial proportions with respect to the difference of their expectations (McNemar setting)

Description

The program computes exact values of the rejection probability of the asymptotic test for equivalence in the sense of δ0<p10p01<δ0-\delta_0 < p_{10}-p_{01} < \delta_0, at any nominal level α\alpha. [The largest α\alpha for which the test is valid in terms of the significance level, can be computed by means of the program mcnemasc.]

Usage

mcnempow(alpha,n,del0,p10,p01)

Arguments

alpha

nominal significance level

n

sample size

del0

upper limit set to δ|\delta| under the alternative hypothesis of equivalence

p10

true value of P[X=1,Y=0]P[X=1,Y=0]

p01

true value of P[X=0,Y=1]P[X=0,Y=1]

Value

alpha

nominal significance level

n

sample size

del0

upper limit set to δ|\delta| under the alternative hypothesis of equivalence

p10

true value of P[X=1,Y=0]P[X=1,Y=0]

p01

true value of P[X=0,Y=1]P[X=0,Y=1]

POW

exact rejection probability of the asymptotic McNemar test for equivalence at nominal level α\alpha

ERROR

error indicator messaging "!!!!!" if the sufficient condition for the correctness of the result output by the program was found violated

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, p.84.

Examples

mcnempow(0.024902,50,0.20,0.30,0.30)

Analogue of mwtie_xy for settings with grouped data

Description

Implementation of the asymptotically distribution-free test for equivalence of discrete distributions from which grouped data are obtained. Hypothesis formulation is in terms of the Mann-Whitney-Wilcoxon functional generalized to the case that ties between observations from different distributions may occur with positive probability. For details see Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition, p.155.

Usage

mwtie_fr(k,alpha,m,n,eps1_,eps2_,x,y)

Arguments

k

total number of grouped values which can be distinguished in the pooled sample

alpha

significance level

m

size of Sample 1

n

size of Sample 2

eps1_

absolute value of the left-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

eps2_

right-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

x

row vector with the mm observations making up Sample1 as components

y

row vector with the nn observations making up Sample2 as components

Details

Notation: π+\pi_+ and π0\pi_0 stands for the functional defined by π+=P[X>Y]\pi_+ = P[X>Y] and π0=P[X=Y]\pi_0 = P[X=Y], respectively, with XFX\sim F \equiv cdf of Population 1 being independent of YGY\sim G \equiv cdf of Population 2.

Value

alpha

significance level

m

size of Sample 1

n

size of Sample 2

eps1_

absolute value of the left-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

eps2_

right-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

WXY_TIE

observed value of the UU-statistics – based estimator of π+/(1π0)\pi_+/(1-\pi_0)

SIGMAH

square root of the estimated asymtotic variance of W+/(1W0)W_+/(1-W_0)

CRIT

upper critical bound to W+/(1W0)1/2(ε2ε1)/2/σ^|W_+/(1-W_0) - 1/2 - (\varepsilon^\prime_2-\varepsilon^\prime_1)/2|/\hat{\sigma}

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S, Hampel B: A distribution-free two-sample equivalence test allowing for tied observations. Biometrical Journal 41 (1999), 171-186.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.4.

Examples

x <- c(1,1,3,2,2,3,1,1,1,2,1,2,2,2,1,2,1,3,2,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,3,1,3,2,1,1,
       2,1,2,1,1,2,2,1,2,1,1,1,1,1,2,2,1,2,2,1,3,1,2,1,1,2,2,1,2,2,1,1,1,3,2,1,1,1,2,1,
       3,3,3,1,2,1,2,2,1,1,1,2,2,1,1,2,1,1,2,3,1,3,2,1,1,1,1,2,2,2,1,1,2,2,3,2,1,2,1,1,
       2,2,1,2,2,2,1,1,2,3,2,1,3,2,1,1,1,2,2,2,2,1,2,2,1,1,1,1,2,1,1,1,2,1,2,2,1,2,2,2,
       2,1,1,2,1,2,2,1,1,1,1,3,1,1,2,2,1,1,1,2,2,2,1,2,3,2,2,1,2,1,2,1,1,2,1,2,2,1,1,1,
       2,2,2,2)
y <- c(2,1,2,2,1,1,2,2,2,1,1,2,1,3,3,1,1,1,1,1,1,2,2,3,1,1,1,3,1,1,1,1,1,1,1,2,2,3,2,1,
       2,2,2,1,2,1,1,2,2,1,2,1,1,1,1,2,1,2,1,1,3,1,1,1,2,2,2,1,1,1,1,2,1,2,1,1,2,2,2,2,
       2,1,1,1,3,2,2,2,1,2,3,1,2,1,1,1,2,1,3,3,1,2,2,2,2,2,2,1,2,1,1,1,1,2,2,1,1,1,1,2,
       1,3,1,1,2,1,2,1,2,2,2,1,2,2,2,1,1,1,2,1,2,1,2,1,1,1,2,1,2,2,1,1,1,1,2,2,3,1,3,1,
       1,2,2,2,1,1,1,1,2,1,1,3,2,2,3,1,2,2,1,1,2,1,1,2,1,2,2,1,2,1,2,2,2,1,1,1,1,1,1,1,
       1,1,1,2,1,3,2,2,1,1,1,2,2,1,1,2,1,2,1,2,2,2,1,2,3,1,1,2,1,2,2,1,1,1,1,2,2,2,1,1,
       3,2,1,2,2,2,1,1,1,2,1,2,2,1,2,1,1,2)
mwtie_fr(3,0.05,204,258,0.10,0.10,x,y)

Distribution-free two-sample equivalence test for tied data: test statistic and critical upper bound

Description

Implementation of the asymptotically distribution-free test for equivalence of discrete distributions in terms of the Mann-Whitney-Wilcoxon functional generalized to the case that ties between observations from different distributions may occur with positive probability. For details see Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition, §\S 6.4.

Usage

mwtie_xy(alpha,m,n,eps1_,eps2_,x,y)

Arguments

alpha

significance level

m

size of Sample 1

n

size of Sample 2

eps1_

absolute value of the left-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

eps2_

right-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

x

row vector with the mm observations making up Sample1 as components

y

row vector with the nn observations making up Sample2 as components

Details

Notation: π+\pi_+ and π0\pi_0 stands for the functional defined by π+=P[X>Y]\pi_+ = P[X>Y] and π0=P[X=Y]\pi_0 = P[X=Y], respectively, with XFX\sim F \equiv cdf of Population 1 being independent of YGY\sim G \equiv cdf of Population 2.

Value

alpha

significance level

m

size of Sample 1

n

size of Sample 2

eps1_

absolute value of the left-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

eps2_

right-hand limit of the hypothetical equivalence range for π+/(1π0)1/2\pi_+/(1-\pi_0) - 1/2

WXY_TIE

observed value of the UU-statistics – based estimator of π+/(1π0)\pi_+/(1-\pi_0)

SIGMAH

square root of the estimated asymtotic variance of W+/(1W0)W_+/(1-W_0)

CRIT

upper critical bound to W+/(1W0)1/2(ε2ε1)/2/σ^|W_+/(1-W_0) - 1/2 - (\varepsilon^\prime_2-\varepsilon^\prime_1)/2|/\hat{\sigma}

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S, Hampel B: A distribution-free two-sample equivalence test allowing for tied observations. Biometrical Journal 41 (1999), 171-186.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.4.

Examples

x <- c(1,1,3,2,2,3,1,1,1,2)
y <- c(2,1,2,2,1,1,2,2,2,1,1,2)
mwtie_xy(0.05,10,12,0.10,0.10,x,y)

Bayesian posterior probability of the alternative hypothesis of probability-based individual bioequivalence (PBIBE)

Description

Implementation of the algorithm presented in §\S 10.3.3 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition.

Usage

po_pbibe(n,eps,pio,zq,s,tol,sw,ihmax)

Arguments

n

sample size

eps

equivalence margin to an individual log-bioavailability ratio

pio

prespecified lower bound to the probability of obtaining an individual log-bioavailability ratio falling in the equivalence range (ε,ε)(-\varepsilon,\varepsilon)

zq

mean log-bioavailability ratio observed in the sample under analysis

s

square root of the sample variance of the log-bioavailability ratios

tol

maximum numerical error allowed for transforming the hypothesis of PBIBE into a region in the parameter space of the log-normal distribution assumed to underlie the given sample of individual bioavailability ratios

sw

step width used in the numerical procedure yielding results at a level of accuracy specified by the value chosen for tol

ihmax

maximum number of interval halving steps to be carried out in finding the region specified in the parameter space according to the criterion of PBIBE

Details

The program uses 96-point Gauss-Legendre quadrature.

Value

n

sample size

eps

equivalence margin to an individual log-bioavailability ratio

pio

prespecified lower bound to the probability of obtaining an individual log-bioavailability ratio falling in the equivalence range (ε,ε)(-\varepsilon,\varepsilon)

zq

mean log-bioavailability ratio observed in the sample under analysis

s

square root of the sample variance of the log-bioavailability ratios

tol

maximum numerical error allowed for transforming the hypothesis of PBIBE into a region in the parameter space of the log-normal distribution assumed to underlie the given sample of individual bioavailability ratios

sw

step width used in the numerical procedure yielding results at a level of accuracy specified by the value chosen for tol

ihmax

maximum number of interval halving steps to be carried out in finding the region specified in the parameter space according to the criterion of PBIBE

PO_PBIBE

posterior probability of the alternative hypothesis of PBIBE

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Bayesian construction of an improved parametric test for probability-based individual bioequivalence. Biometrical Journal 42 (2000), 1039-52.

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 10.3.3.

Examples

po_pbibe(20,0.25,0.75,0.17451,0.04169, 10e-10,0.01,100)

Bayesian posterior probability of the alternative hypothesis in the setting of the one-sample t-test for equivalence

Description

Evaluation of the integral appearing on the right-hand side of equation (3.6) on p. 38 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition

Usage

postmys(n,dq,sd,eps1,eps2,tol)

Arguments

n

sample size

dq

mean within-pair difference observed in the sample under analysis

sd

square root of the sample variance of the within-pair differences

eps1

absolute value of the left-hand limit of the hypothetical equivalence range for δ/σD\delta/\sigma_D

eps2

right-hand limit of the hypothetical equivalence range for δ/σD\delta/\sigma_D

tol

tolerance for the error induced through truncating the range of integration on the right

Details

The program uses 96-point Gauss-Legendre quadrature.

Value

n

sample size

dq

mean within-pair difference observed in the sample under analysis

sd

square root of the sample variance of the within-pair differences

eps1

absolute value of the left-hand limit of the hypothetical equivalence range for δ/σD\delta/\sigma_D

eps2

right-hand limit of the hypothetical equivalence range for δ/σD\delta/\sigma_D

tol

tolerance for the error induced through truncating the range of integration on the right

PPOST

posterior probability of the set of all (δ,σD)(\delta,\sigma_D) such that ε1<δ/σD<ε2-\varepsilon_1 < \delta/\sigma_D < \varepsilon_2

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 3.2.

Examples

postmys(23,0.16,3.99,0.5,0.5,1e-6)

Confidence innterval inclusion test for average bioequivalence: exact power against an arbitrary specific alternative

Description

Evaluation of the integral on the right-hand side of equation (10.11) of p. 317 of Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition

Usage

pow_abe(m,n,alpha,del_0,del,sig)

Arguments

m

sample size in sequence group T(est)/R(eference)

n

sample size in sequence group R(eference)/T(est)

alpha

significance level

del_0

equivalence margin to the absolute value of the log-ratio μT\mu^*_T and μR\mu^*_R of the formulation effects

del

assumed true value of log(μT/μR)| \log(\mu^*_T/\mu^*_R) |, with 0δ<δ00\le\delta < \delta_0

sig

theoretical standard deviation of the log within-subject bioavailability ratios in each sequence group

Details

The program uses 96-point Gauss-Legendre quadrature.

Value

m

sample size in sequence group T(est)/R(eference)

n

sample size in sequence group R(eference)/T(est)

alpha

significance level

del_0

equivalence margin to the absolute value of the log-ratio μT\mu^*_T and μR\mu^*_R of the formulation effects

del

assumed true value of log(μT/μR)| \log(\mu^*_T/\mu^*_R) |, with 0δ<δ00\le\delta < \delta_0

POW_ABE

power of the interval inclusion test for average bioequivalence against the specific alternative given by (δ,σ)(\delta,\sigma)

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 10.2.1.

Examples

pow_abe(12,13,0.05,log(1.25),log(1.25)/2,0.175624)

Nonconditional power of the UMPU sign test for equivalence and its nonrandomized counterpart

Description

The program computes for each possible value of the number n0n_0 of zero observations the power conditional on N0=n0N_0 = n_0 and averages these conditional power values with respect to the distribution of N0N_0. Equivalence is defined in terms of the logarithm of the ratio p+/pp_+/p_-, where p+p_+ and pp_- denotes the probability of obtaining a positive and negative sign, respectively.

Usage

powsign(alpha,n,eps1,eps2,poa)

Arguments

alpha

significance level

n

sample size

eps1

absolute value of the lower limit of the hypothetical equivalence range for log(p+/p)\log(p_+/p_-).

eps2

upper limit of the hypothetical equivalence range for log(p+/p)\log(p_+/p_-).

poa

probability of a tie under the alternative of interest

Value

alpha

significance level

n

sample size

eps1

absolute value of the lower limit of the hypothetical equivalence range for log(p+/p)\log(p_+/p_-).

eps2

upper limit of the hypothetical equivalence range for log(p+/p)\log(p_+/p_-).

poa

probability of a tie under the alternative of interest

POWNONRD

power of the nonrandomized version of the test against the alternative p+=p=(1p)/2p_+ = p_- = (1-p_\circ)/2

POW

power of the randomized UMPU test against the alternative p+=p=(1p)/2p_+ = p_- = (1-p_\circ)/2

Note

A special case of the test whose power is computed by this program, is the exact conditional equivalence test for the McNemar setting (cf. Wellek 2010, pp. 76-77).

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.1.

Examples

powsign(0.06580,50,0.847298,0.847298,0.26)

Signed rank test for equivalence of an arbitrary continuous distribution of the intraindividual differences in terms of the probability of a positive sign of a Walsh average: test statistic and critical upper bound

Description

Implementation of the paired-data analogue of the Mann-Whitney-Wilcoxon test for equivalence of continuous distributions. The continuity assumption relates to the intraindividual differences DiD_i. For details see Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition,§\S 5.4.

Usage

sgnrk(alpha,n,qpl1,qpl2,d)

Arguments

alpha

significance level

n

sample size

qpl1

lower equivalence limit q+q_+^{\prime} to the target functional q+q_+

qpl2

upper equivalence limit q+q_+^{\prime\prime} to the target functional q+q_+

d

row vector with the intraindividual differences for all nn pairs as components

Details

q+q_+ is the probability of getting a positive sign of the so-called Walsh-average of a pair of within-subject differences and can be viewed as a natural paired-observations analogue of the Mann-Whitney functional π+=P[X>Y]\pi_+ = P[X>Y].

Value

alpha

significance level

n

sample size

qpl1

lower equivalence limit q+q_+^{\prime} to the target functional q+q_+

qpl2

upper equivalence limit q+q_+^{\prime\prime} to the target functional q+q_+

U_pl

observed value of the UU-statistics estimator of q+q_+

SIGMAH

square root of the estimated asymtotic variance of U+U_+

CRIT

upper critical bound to U+(q++q+)/2/σ^\big|U_+-\big(q_+^{\prime}+q_+^{\prime\prime}\big)/2\big|/\hat{\sigma}

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.4.

Examples

d <- c(-0.5,0.333,0.667,1.333,1.5,-2.0,-1.0,-0.167,1.667,0.833,-2.167,-1.833,
       4.5,-7.5,2.667,3.333,-4.167,5.667,2.333,-2.5)
sgnrk(0.05,20,0.2398,0.7602,d)

Generalized signed rank test for equivalence for tied data: test statistic and critical upper bound

Description

Implementation of a generalized version of the signed-rank test for equivalence allowing for arbitrary patterns of ties between the within-subject differences. For details see Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition, §\S 5.5.

Usage

srktie_d(n,alpha,eps1,eps2,d)

Arguments

n

sample size

alpha

significance level

eps1

absolute value of the left-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

eps2

right-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

d

row vector with the intraindividual differences for all nn pairs as components

Details

Notation: q+q_+ and q0q_0 stands for the functional defined by q+=P[Di+Dj>0]q_+ = P[D_i+D_j>0] and q0=P[Di+Dj=0]q_0 = P[D_i+D_j=0], respectively, with DiD_i and DjD_j as the intraindividual differences observed in two individuals independently selected from the underlying bivariate population.

Value

n

sample size

alpha

significance level

eps1

absolute value of the left-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

eps2

right-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

U_pl

observed value of the UU-statistics estimator of q+q_+

U_0

observed value of the UU-statistics estimator of q0q_0

UAS_PL

observed value of U+/(1U0)U_+/(1-U_0)

TAUHAS

square root of the estimated asymtotic variance of nU+/(1U0)\sqrt{n}U_+/(1-U_0)

CRIT

upper critical bound to nU+/(1U0)1/2(ε2ε1)/2/τ^\sqrt{n}|U_+/(1-U_0) - 1/2 - (\varepsilon_2-\varepsilon_1)/2|/\hat{\tau}

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Note

The function srktie_d can be viewed as the paired-data analogue of mwtie_xy

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.5.

Examples

d <- c(0.8,0.2,0.0,-0.1,-0.3,0.3,-0.1,0.4,0.6,0.2,0.0,-0.2,-0.3,0.0,0.1,0.3,-0.3,
       0.1,-0.2,-0.5,0.2,-0.1,0.2,-0.1)
srktie_d(24,0.05,0.2602,0.2602,d)

Analogue of srktie_d for settings where the distribution of intraindividual differences is concentrated on a finite lattice

Description

Analogue of the function srktie_d tailored for settings where the distribution of the within-subject differences is concentrated on a finite lattice. For details see Wellek S (2010) Testing statistical hypotheses of equivalence and noninferiority. Second edition, pp.112-3.

Usage

srktie_m(n,alpha,eps1,eps2,w,d)

Arguments

n

sample size

alpha

significance level

eps1

absolute value of the left-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

eps2

right-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

w

span of the lattice in which the intraindividual differences take their values

d

row vector with the intraindividual differences for all nn pairs as components

Details

Notation: q+q_+ and q0q_0 stands for the functional defined by q+=P[Di+Dj>0]q_+ = P[D_i+D_j>0] and q0=P[Di+Dj=0]q_0 = P[D_i+D_j=0], respectively, with DiD_i and DjD_j as the intraindividual differences observed in two individuals independently selected from the underlying bivariate population.

Value

n

sample size

alpha

significance level

eps1

absolute value of the left-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

eps2

right-hand limit of the hypothetical equivalence range for q+/(1q0)1/2q_+/(1-q_0) - 1/2

w

span of the lattice in which the intraindividual differences take their values

U_pl

observed value of the UU-statistics estimator of q+q_+

U_0

observed value of the UU-statistics estimator of q0q_0

UAS_PL

observed value of U+/(1U0)U_+/(1-U_0)

TAUHAS

square root of the estimated asymtotic variance of nU+/(1U0)\sqrt{n}U_+/(1-U_0)

CRIT

upper critical bound to nU+/(1U0)1/2(ε2ε1)/2/τ^\sqrt{n}|U_+/(1-U_0) - 1/2 - (\varepsilon_2-\varepsilon_1)/2|/\hat{\tau}

REJ

indicator of a positive [=1] vs negative [=0] rejection decision to be taken with the data under analysis

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, pp. 112-114.

Examples

d <- c(0.8,0.2,0.0,-0.1,-0.3,0.3,-0.1,0.4,0.6,0.2,0.0,-0.2,-0.3,0.0,0.1,0.3,-0.3,
       0.1,-0.2,-0.5,0.2,-0.1,0.2,-0.1)
srktie_m(24,0.05,0.2602,0.2602,0.1,d)

Critical constants and power against the null alternative of the one-sample t-test for equivalence with an arbitrary, maybe nonsymmetric choice of the limits of the equivalence range

Description

The function computes the critical constants defining the uniformly most powerful invariant test for the problem δ/σDθ1\delta/\sigma_D \le \theta_1 or δ/σDθ2\delta/\sigma_D \ge \theta_2 versus θ1<δ/σD<θ2\theta_1 < \delta/\sigma_D < \theta_2, with (θ1,θ2)(\theta_1,\theta_2) as a fixed nondegenerate interval on the real line. In addition, tt1st outputs the power against the null alternative δ=0\delta = 0.

Usage

tt1st(n,alpha,theta1,theta2,tol,itmax)

Arguments

n

sample size

alpha

significance level

theta1

lower equivalence limit to δ/σD\delta/\sigma_D

theta2

upper equivalence limit to δ/σD\delta/\sigma_D

tol

tolerable deviation from α\alpha of the rejection probability at either boundary of the hypothetical equivalence interval

itmax

maximum number of iteration steps

Value

n

sample size

alpha

significance level

theta1

lower equivalence limit to δ/σD\delta/\sigma_D

theta2

upper equivalence limit to δ/σD\delta/\sigma_D

IT

number of iteration steps performed until reaching the stopping criterion corresponding to TOL

C1

left-hand limit of the critical interval for the one-sample tt-statistic

C2

right-hand limit of the critical interval for the one-sample tt-statistic

ERR1

deviation of the rejection probability from α\alpha under δ/σD=θ1\delta/\sigma_D = \theta_1

ERR2

deviation of the rejection probability from α\alpha under δ/σD=θ2\delta/\sigma_D = \theta_2

POW0

power of the UMPI test against the alternative δ=0\delta = 0

Note

If the output value of ERR2 is NA, the deviation of the rejection probability at the right-hand boundary of the hypothetical equivalence interval from α\alpha is smaller than the smallest real number representable in R.

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 5.3.

Examples

tt1st(36,0.05, -0.4716,0.3853,1e-10,50)

Critical constants and power against the null alternative of the two-sample t-test for equivalence with an arbitrary, maybe nonsymmetric choice of the limits of the equivalence range

Description

The function computes the critical constants defining the uniformly most powerful invariant test for the problem (ξη)/σε1(\xi-\eta)/\sigma \le -\varepsilon_1 or (ξη)/σε2(\xi-\eta)/\sigma \ge \varepsilon_2 versus ε1<(ξη)/σ<ε2-\varepsilon_1 < (\xi-\eta)/\sigma < \varepsilon_2, with ξ\xi and η\eta denoting the expected values of two normal distributions with common variance σ2\sigma^2 from which independent samples are taken. In addition, tt2st outputs the power against the null alternative ξ=η\xi = \eta.

Usage

tt2st(m,n,alpha,eps1,eps2,tol,itmax)

Arguments

m

size of the sample from N(ξ,σ2){\cal N}(\xi,\sigma^2)

n

size of the sample from N(η,σ2){\cal N}(\eta,\sigma^2)

alpha

significance level

eps1

absolute value of the lower equivalence limit to (ξη)/σ(\xi-\eta)/\sigma

eps2

upper equivalence limit to (ξη)/σ(\xi-\eta)/\sigma

tol

tolerable deviation from α\alpha of the rejection probability at either boundary of the hypothetical equivalence interval

itmax

maximum number of iteration steps

Value

m

size of the sample from N(ξ,σ2){\cal N}(\xi,\sigma^2)

n

size of the sample from N(η,σ2){\cal N}(\eta,\sigma^2)

alpha

significance level

eps1

absolute value of the lower equivalence limit to (ξη)/σ(\xi-\eta)/\sigma

eps2

upper equivalence limit to (ξη)/σ(\xi-\eta)/\sigma

IT

number of iteration steps performed until reaching the stopping criterion corresponding to TOL

C1

left-hand limit of the critical interval for the two-sample tt-statistic

C2

right-hand limit of the critical interval for the two-sample tt-statistic

ERR1

deviation of the rejection probability from α\alpha under (ξη)/σ=ε1(\xi-\eta)/\sigma= -\varepsilon_1

ERR2

deviation of the rejection probability from α\alpha under (ξη)/σ=ε2(\xi-\eta)/\sigma= \varepsilon_2

POW0

power of the UMPI test against the alternative ξ=η\xi = \eta

Note

If the output value of ERR2 is NA, the deviation of the rejection probability at the right-hand boundary of the hypothetical equivalence interval from α\alpha is smaller than the smallest real number representable in R.

Author(s)

Stefan Wellek <[email protected]>
Peter Ziegler <[email protected]>

References

Wellek S: Testing statistical hypotheses of equivalence and noninferiority. Second edition. Boca Raton: Chapman & Hall/CRC Press, 2010, §\S 6.1.

Examples

tt2st(12,12,0.05,0.50,1.00,1e-10,50)