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 |
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.
A formal definition and simulation results of the simultaneous coverage probability under various conditions can be found in Schaarschmidt et al. (2009).
Frank Schaarschmidt
Maintainer: <[email protected]>
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.
# 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.
# 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.
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.
apprPower(n, pH1, alpha = 0.05, alternative = "greater", method = "Add4")
apprPower(n, pH1, alpha = 0.05, alternative = "greater", method = "Add4")
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" |
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.
a single numeric value: the approximate any-pair power
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.
Frank Schaarschmidt
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.
simPower
# 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")
# 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")
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.)
## 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", ...)
## 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", ...)
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 |
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.
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
Frank Schaarschmidt
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.
# 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") )
# 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") )
For internal use.
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)
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)
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. |
alternative |
a character string, one of "two.sided", "less", "greater" |
A list containing
conf.int |
vector giving lower and upper bound |
estimate |
estimated difference px-py |
Frank Schaarschmidt
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.
pairwise.prop.test
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.
ec.mto(n, x, alternative = "less")
ec.mto(n, x, alternative = "less")
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" |
a single numeric value, the p.value of the maximum test
Frank Schaarschmidt
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)
# 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")
# 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")
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.
nbinMto(Ntotal = 500, pH1, ratio = 1, alpha = 0.05, power = 0.8, alternative = "two.sided", method = "Add4", trace = FALSE)
nbinMto(Ntotal = 500, pH1, ratio = 1, alpha = 0.05, power = 0.8, alternative = "two.sided", method = "Add4", trace = FALSE)
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) |
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.
A matrix containing in columns: n of the single groups, the total n, the approximative any-pair-power.
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.
Frank Schaarschmidt
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.
simPower
to estimate the power of all methods in binMto
by simulation
# 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.
# 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.
A plot function for confidence intervals calculated using binMto
.
## S3 method for class 'binMto' plot(x, ltyH0 = 3, H0line = 0, ltyCI = 2, main = NULL, xlab = NULL, ...)
## S3 method for class 'binMto' plot(x, ltyH0 = 3, H0line = 0, ltyCI = 2, main = NULL, xlab = NULL, ...)
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 |
Frank Schaarschmidt
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.
# 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) ))
# 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) ))
A print functions for objects produced by calling binMto
.
## S3 method for class 'binMto' print(x, digits=4, ...)
## S3 method for class 'binMto' print(x, digits=4, ...)
x |
an object of class "binMto", as can be calculated using |
digits |
digits for rounding the output |
... |
further arguments to be passed to |
Frank Schaarschmidt
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.
simPower(H0diff, pH1, n, n.sim = 1000, conf.level = 0.95, alternative = "two.sided", method = "Add4", adj = "Dunnett")
simPower(H0diff, pH1, n, n.sim = 1000, conf.level = 0.95, alternative = "two.sided", method = "Add4", adj = "Dunnett")
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 |
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).
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
Frank Schaarschmidt
# 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")
# 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")