Package 'binMto'

Title: Many-to-One Comparisons of Proportions
Description: Asymptotic simultaneous confidence intervals for comparison of many treatments with one control, for the difference of binomial proportions, allows for Dunnett-like-adjustment, Bonferroni or unadjusted intervals. Simulation of power of the above interval methods, approximate calculation of any-pair-power, and sample size iteration based on approximate any-pair power. Exact conditional maximum test for many-to-one comparisons to a control.
Authors: Frank Schaarschmidt
Maintainer: Frank Schaarschmidt <[email protected]>
License: GPL-2
Version: 0.0-7
Built: 2024-12-23 06:17:58 UTC
Source: CRAN

Help Index


Asymptotic simultaneous confdence intervals for many-to-one comparisons of proportions

Description

Asymptotic simultaneous confidence intervals for comparison of many treatments with one control, for the difference of proportions, allows for Dunnett-like-adjustment, Bonferroni or unadjusted intervals.

Details

A formal definition and simulation results of the simultaneous coverage probability under various conditions can be found in Schaarschmidt et al. (2009).

Author(s)

Frank Schaarschmidt

Maintainer: <[email protected]>

References

Schaarschmidt, F., Biesheuvel, E., Hothorn, L.A. (2009) Asymptotic simultaneous confidence intervals for many-to-one comparisons of binary proportions in randomized clinical trials, Journal of Biopharmaceutical Statistics 19(2):292-310.

Examples

# binMto:
# Calculate and plot approximate simultaneous
# confidene intervals for many-to-one comparisons of a
# dichotomous variable in a one-way model. 

# Example from Table 5 in Koch, HF and Hothorn, LA,
# JSPI 82, 83-99:
# A toxicity study with 100 mice randomised in 4 groups.
# Response x was number of deaths after 6 months.
# Control (n=40, x=4), 10 mg/kg (n=20, x=1),
# 50 mg/kg (n=20, x=6), 100 mg/kg (n=20, x=8).

# Approximate simultaneous 95% add-4-CI: 

many21<-binMto(n=c(40,20,20,20), x=c(4,1,6,8),
 names=c("Control", "10mg", "50mg", "100mg"))

many21

plot(many21)

# Note that normal approximation becomes problematic for np(1-p)<2.

Approximate power (any rejection!) for many-to-one comparison of binomial proportions

Description

Approximative power to reject the hypothesis that all of the k differences of proportions of treatment groups vs. control group are zero, i.e.: probability to reject any H0[i]: p[i]-p[0] = 0, For a given setting of n[i], and p[i] assumed under the alternative.

Usage

apprPower(n, pH1, alpha = 0.05, alternative = "greater", method = "Add4")

Arguments

n

vector of integers specifying the number of observations in each group, where the first value is taken as sample size of control group

pH1

numeric vector with values between 0 and 1, specifying the proportions of success under the alternative hypothesis, should have the same length as n

alpha

pre-specified type-I-error

alternative

character string defining the alternative hypothesis, take care, that it fits to the parameters settings specified in pH1

method

character sring defining the confidence interval method to be used, one of "Add4", "Add2", "Wald"

Details

This function uses approximative calculation of any-pair-power of a maximum test as described in Bretz and Hothorn (2002) for a Wald test of multiple contrasts of binary data. Differing from Bretz and Hothorn (2002), unpooled variance estimators are used in the present function. In case of "Add4" and "Add2"-method, the Wald expectation and variance are replaced by that of add-4 and add-2. Since the approximate calculation assumes normality, this function can give misleading results, if sample size is small and/or proportions of success are extreme. The present function only calcualtes power for the test adjusting via the multivariate-normal-distribution. For Bonferroni-adjusted or unadjusted tests, one can make use of well-known formulas for power and sample size for binary data.

The use of the function simPower in this package will result in power estimation closer to the true performance of the methods but is less convenient.

Value

a single numeric value: the approximate any-pair power

Note

The results of this functions are roughly checked by comparison with results of power simualtion, which indicate that the approximations are reasonable for at least moderate n and not too extreme proportions. The performance of a corresponding test using the add-4 or add-2 adjustment is not described.

Author(s)

Frank Schaarschmidt

References

Bretz,F and Hothorn, LA (2002): Detecting dose-response using contrasts: asymptotic power and sample size determination for binomial data. Statistics in Medicine 21, 3325-3335.

See Also

simPower

Examples

# Recalculate the power of the Dunnett-contrast
# for the first setting in Bretz and Hothorn (2002, Table III),
# using a balanced design and the allocation rule n0/ni=sqrt(k)
# of Dunnett(1955), desiring a power of 80 percent.
# Note that differing from Bretz and Hothorn (2002)
# in the present function unpooled variance estimators
# are used, what might lead to different results.

apprPower(n=c(196, 196, 196, 196, 196),
 pH1=c(0.45, 0.45, 0.5, 0.5, 0.6),
 alpha=0.05, alternative="greater", method="Wald")

apprPower(n=c(294, 147, 147, 147, 147 ),
 pH1=c(0.45, 0.45, 0.5, 0.5, 0.6),
 alpha=0.05, alternative="greater", method="Wald")

Confidence intervals for many-to-one comparisons of proportions

Description

Approximate simultaneous confidence intervals for many-to-one comparisons of proportions. The add-4, add-2, Newcombes Hybrid Score interval for the difference of proportions can be calculated using either quantiles of the multivariate normal distributrion (Dunnett) standard normal quantiles (Bonferroni or unadjusted.)

Usage

## Default S3 method:
binMto(x, n, names = NULL,
 base = 1, conf.level = 0.95, alternative = "two.sided",
 method = "Add4", adj = "Dunnett", ...)

## S3 method for class 'formula'
binMto(formula, data, base=1, conf.level=0.95,
 alternative="two.sided", method="Add4", adj="Dunnett", ...)

Arguments

x

vector giving the number of success in the groups

n

vector giving the number of trials, i.e. the sample size of each group

names

(character-)vector specifying the names of groups given in x and n, ignored if formula and data.frame are used

formula

a formula specifying a response and treatment variable like: response~treatment; the response must consist of 0,1 (failure and success)

data

data.frame containing the response and treatment variable specified in formula

base

a numeric value specifying which group to be treated as control group

conf.level

confidence level

alternative

character string, one of "two.sided", "less", "greater"

method

character string specifying the method of CI construction to used, one of: "Add4": adding-4-method (Agresti and Caffo, 2000), conservative, recommended for small sample sizes, "Add2": adding-2-method (Brown and Li, 2005),less conservative, recommended for one-sided limits, "NHS": Newcombes Hybrid Score method (Newcombe, 1998), "Wald": Wald method, not recommended, only for large sample sizes and not too extreme proportions.

adj

character string, specifying the adjustment for multiplicity, one of: "Dunnett": Recommended, using quantiles of the multivariate normal distribution adjusting for multiplicity and correlation between comparisons depending on sample size and estimated proportion (Piegorsch, 1991), "Bonf": Simple Bonferroni-adjustment, conseravtive for large number of comparisons, "Unadj": Unadjusted interval, i.e. each with local confidence level = conf.level

...

arguments to be passed to the methods binMto.formula and binMto.default

Details

All methods only asymptotically hold the nominal confidence level. Thus they can not be recommended if sample size is combined with extreme proportions of success (close to 0 or 1). Among the available methods Add-4 is most appropriate for small sample sizes, if conservative performance is acceptable.

Value

A list containing:

conf.int

a matrix containg estimates, lower and upper confidence limits

and further values specified in the function call, apply str() to the output for details

Author(s)

Frank Schaarschmidt

References

Schaarschmidt, F., Biesheuvel, E., Hothorn, L.A. (2009) Asymptotic simultaneous confidence intervals for many-to-one comparisons of binary proportions in randomized clinical trials, Journal of Biopharmaceutical Statistics 19(2):292-310.

Examples

# 1)Simultaneous CI for Dunnett contrasts for
# the example in Table 1 of Bretz F and Hothorn LA (2002):
#  Detecting dose-response using contrasts: asymptotic
#  power and sample size determination for binomial data.
#  Statistics in Medicine 21, 3325-3335.

binMto(x=c(9,19,21,21,24),
 n=c(20,43,42,42,41),
 names = c("Placebo", 0.125, 0.5, 0.75, 1) )

#########################################################

# 2) Berth-Jones, J., Todd, G., Hutchinson, P.E.,
# Thestrup-Pedersen, K., Vanhoutte, F.P. (2000):
# Treatment of Psoriasis with oral liarozole:
# a dose-ranging study.
# British Journal of Dermatology 143 (6), 1170-1176.

# Three doses of a compound (liarozole) were compared
# to a group treated with placebo. The primary variable
# was defined as the proportion of patients with an at
# least marked improvement of psoriasis symptoms. 
# A total of 139 patients were assigned to the 4 treatment
# groups, sample sizes were 34,35,36,34, for the Placebo,
# 50mg, 75mg, and 150mg treatments, respectively.
# The number of patients with marked improvement of
# symptoms was 2,6,4,13 in the 4 treatment groups.

# two-sided Add-4 95-percent confidence intervals:

binMto(x=c(2,6,4,13),
 n=c(34,35,36,34),
 names = c("Placebo","50mg","75mg","150mg") )

CI for difference of two proportions based on standard normal approximation

Description

For internal use.

Usage

Add4(nx, ny, X, Y, quantile, alternative)
Add2(nx, ny, X, Y, quantile, alternative)
NHS(nx, ny, X, Y, quantile, alternative)
Wald(nx, ny, X, Y, quantile, alternative)

Arguments

nx

a single numeric value, number of trials in sample x

ny

a single numeric value, number of trials in sample y

X

a single numeric value, number of successes in sample x

Y

a single numeric value, number of successes in sample y

quantile

e.g. qnorm(p=0.975) for a two-sided 95 percent confidence interval

alternative

a character string, one of "two.sided", "less", "greater"

Value

A list containing

conf.int

vector giving lower and upper bound

estimate

estimated difference px-py

Author(s)

Frank Schaarschmidt

References

Schaarschmidt, F., Biesheuvel, E., Hothorn, L.A. (2009): Asymptotic simultaneous confidence intervals for many-to-one comparisons of binary proportions in randomized clinical trials, Journal of Biopharmaceutical Statistics 19(2):292-310.

Agresti, A. and Caffo, B. (2000): Simple and effective confidence intervals for proportions and differences of proportions result from adding two successes and two failures. American Statistician 54 (4), 280-288.

Brown, L. and Li, X. (2005): Confidence intervals for two sample binomial distribution. Journal of Statistical Planning and Inference 130, 359-375.

Newcombe, R.G. (1998): Interval estimation for the difference between independent proportions: comparison of eleven methods. Statistics in Medicine 17, 873-890.

See Also

pairwise.prop.test


Exact conditional test for many-to-one comparisons of proportions

Description

This function calculates the exact distribution of the maximum of test statistics with unpooled variance estimators for the difference of many-to-one comparisons of proportion. Using this, p-values for the max-test are computed.

Usage

ec.mto(n, x, alternative = "less")

Arguments

n

vector of integers specifying the number of trials in each group, where the first value is taken as control

x

vector of integers specifying the number of successes in each group, where the first value is taken as control

alternative

a character string, one of "two.sided", "greater", "less"

Value

a single numeric value, the p.value of the maximum test

Author(s)

Frank Schaarschmidt

References

Koch, H.F. and Hothorn, L.A. (1999): Exact unconditional distributions for dichotomous data in many-to-one comparisons. Journal of Statistical Planning and Inference 82, 83-99 (section 2.1)

Examples

# Example from Koch and Hothorn (1999), Table 5:
# Chronic toxicity study in mice over six months.


ec.mto(n=c(40,20,20,20), x=c(4,1,6,8),
 alternative= "two.sided")


ec.mto(n=c(40,20,20,20), x=c(4,1,6,8),
 alternative= "greater")

Sample size iteration for many-to-one comparisons of binomials

Description

This function iteratively increases sample size until a pre-specified any-pair power of a test is achieved. Here, only power to reject the null hypothesis of no difference between treatment and control ( H0[i]: p[i] - p[0]=0 ) is covered . Approximative calculation of power is used, the ratio of sample size to the control group to the treatment groups can be specified.

Usage

nbinMto(Ntotal = 500, pH1, ratio = 1, alpha = 0.05, power = 0.8,
 alternative = "two.sided", method = "Add4", trace = FALSE)

Arguments

Ntotal

a single number or vector with two integers specifying the maximum or the range of total sample size allowed in iteration

pH1

numeric vector with values between 0 and 1, specifying the proportions of success under the alternative hypothesis; the first value will be taken as the proportion of the control group, and will be asssumed for the null hypothesis

ratio

a single positive number, specifying the ratio between sample size of control group to treatment groups: ratio=n0/ni

alpha

pre-specified type-I-error of the test

power

desired power

alternative

character string defining the alternative hypothesis, take care, that it fits to the parameters settings specified in pH1

method

character sring defining the confidence interval method to be used, one of "Add4", "Add2", "Wald"

trace

logical, indicating whether only the step acchieving pre-sepcified power (FALSE) shall be shown or all iteration steps are to be displayed (TRUE)

Details

This function uses approximative calculation of any-pair-power of a maximum test as described in Bretz and Hothorn (2002) for a Wald test of multiple contrasts of binary data. Differing from Bretz and Hothorn (2002), unpooled variance estimators are used in the present function. In case of "Add4" and "Add2"-method, the Wald expectation and variance are replaced by that of add-4 and add-2. Since the approximate calculation assumes normality, this function can give misleading results, if sample size is small and/or proportions of success are extreme. The present function only calcualtes power for the test adjusting via the multivariate-normal-distribution. For Bonferroni-adjusted or unadjusted tests, one can make use of well-known formulas for power and sample size for binary data.

The use of the function simPower in this package will result in power estimation closer to the true performance of the methods but is less convenient.

Value

A matrix containing in columns: n of the single groups, the total n, the approximative any-pair-power.

Note

The results of this functions are roughly checked by comparison with results of power simualtion, which indicate that the approximations are reasonable for at least moderate n and not too extreme proportions. The performance of a corresponding test using the add-4 or add-2 adjustment is not described.

Author(s)

Frank Schaarschmidt

References

Bretz,F and Hothorn, LA (2002): Detecting dose-response using contrasts: asymptotic power and sample size determination for binomial data. Statistics in Medicine 21, 3325-3335.

See Also

simPower to estimate the power of all methods in binMto by simulation

Examples

# Iterate the sample size necessary to achieve
# a power of 80% to reject the null of no treatment
# effects in a dose-response trial for comparing 
# four doses with placebo. The assumed proportions
# of success are 0.45 for the placebo,
# and 0.45, 0.5, 0.5, 0.6  for the increasing doses.
# Assume that only an increase of response is of interest:
# alternative="greater"

# a) use a balanced design: ratio=1

nbinMto(Ntotal = c(800, 1200), pH1=c(0.45, 0.45, 0.5, 0.5, 0.6),
 ratio = 1, alpha = 0.05, power = 0.8, 
 alternative = "greater", method = "Wald", trace = FALSE)

# Compare with the results in Bretz and Hothorn (2002),
# Table III. Note, that in the present function unpooled
# variance estimators are used, while Bretz and Hothorn use 
# a pooled variance estimator.
# Note further, that there is some Monte Carlo Error in computing
# multivariate normal probabilities.

Plot confidence intervals calculated using binMto.

Description

A plot function for confidence intervals calculated using binMto.

Usage

## S3 method for class 'binMto'
plot(x, ltyH0 = 3, H0line = 0,
 ltyCI = 2, main = NULL, xlab = NULL, ...)

Arguments

x

an object of class 'binMto' obtained from function binMto

ltyH0

numerical value specifying the line type of the vertical line in the plot, see ?par for options

H0line

a numerical value, specifying where to draw a vertical line in the plot

ltyCI

numerical value specifying the line type of the confidence intervals in the plot, see ?par for options

main

a main title as in ?plot

xlab

a x-axis label as in ?plot

...

further arguments as given in ?plot or ?par

Author(s)

Frank Schaarschmidt

References

The example below, see: Bretz, F. and Hothorn, L.A. (2002): Detecting dose-response using contrasts: Asymptotic power and sample size determination for binomial data. Statistics in Medicine 21, 3325-3335.

Examples

# 1)Simultaneous CI for Dunnett contrasts
# for the example in Table 1 of 

plot(binMto(x=c(9,19,21,21,24), n=c(20,43,42,42,41), names = c("Placebo",0.125,0.5,0.75,1) ))

Print function for objects of class "binMto"

Description

A print functions for objects produced by calling binMto.

Usage

## S3 method for class 'binMto'
print(x, digits=4, ...)

Arguments

x

an object of class "binMto", as can be calculated using binMto

digits

digits for rounding the output

...

further arguments to be passed to print

Author(s)

Frank Schaarschmidt


Simulation of power for the methods in binmto

Description

Simulation of the any-pair-power and coverage probability if interval methods given in binmto are used for a decision on hypothesis, for a given setting of sample sizes (n), assumed parameters (pH1), and parameters to test against (H0diff), and confidence interval method.

Usage

simPower(H0diff, pH1, n, n.sim = 1000, conf.level = 0.95,
 alternative = "two.sided", method = "Add4", adj = "Dunnett")

Arguments

H0diff

numeric vector or matrix, specifying the differences to test against, i.e. parameters in the null hypothesis

pH1

numeric vector or matrix, specifying the proportions assumed under the alternative the first value of the vector or the first row of the column are taken for the control group

n

a vector or matrix of sample sizes, should have the same length or number of columns as pH1 the first value of the vector or the first row of the column are taken for the control group

n.sim

number of simulations to be run

conf.level

nominal confidence level of the interval

alternative

character string defining the alternative hypothesis to be tested, take care, that it fits to the parameters settings specified in pH1

method

confidence interval method to be used, see ?binmto for details

adj

adjustment method to be used, see ?binmto for details

Details

The function nbinmto uses approximative power calculation tom iterate sample size. Since it assumes normal distribution, it can have misleading results for small sample sizes and extreme proportions. Then, the simulation of power, which takes the true distribution into account, will lead to better choice of sample size. Either one setting can be simulated, if vectors are given as input values, or several designs or settings can be simulated, if input values are given as matrices, where the columns represent the values of single groups or hypotheses to be tested and each row represents one setting. Take care that n and pH1 shold have the same length (k+1 groups), but H0diff should be one shorter in length or ncol of the matrix (k hyothesis).

Value

A matrix containing the hypotheses to be tested, the parameters assumed under the alternative, the any-pair-power and the coverage probability for the setting under the alternative in the columns

Author(s)

Frank Schaarschmidt

Examples

# three groups are to be tested vs. a control
# H0: all treatments have the same proportion of success: H0diff=c(0,0,0)
# proportion of success in the control: 0.2 
# proportions of success in the treatment groups: 0.3,0.4,0.5
# simulate power for balanced designs with 20, 30,...,100 observations
# per group

# create a matrix for the sample sizes to be used for simulation:

ni<-matrix(rep(seq(20,100,10), times=4), ncol=4)
ni


# one-sided, alternative greater:

simPower(H0diff=c(0.1,0.1,0.1), pH1=c(0.2,0.3,0.4,0.5), 
 n=ni, n.sim=1000, alternative="greater")