Package 'RI2by2'

Title: Randomization Inference for Treatment Effects on a Binary Outcome
Description: Computes attributable effects based confidence interval, permutation test confidence interval, or asymptotic confidence interval for the average treatment effect on a binary outcome. Methods outlined in further detail in Rigdon and Hudgens (2015) <doi:10.1002/sim.6384>.
Authors: Joseph Rigdon <[email protected]>
Maintainer: Joseph Rigdon <[email protected]>
License: GPL (>= 3)
Version: 1.4
Built: 2025-03-06 03:32:47 UTC
Source: https://github.com/cran/RI2by2

Help Index


Attributable effects based confidence interval for a treatment effect on a binary outcome

Description

Computes the attributable effects based confidence interval for the average treatment effect on a binary outcome in an experiment where mm of nn individuals are randomized to treatment by design.

Usage

AE.CI(data, level)

Arguments

data

observed 2 by 2 table in matrix form where row 1 is the treatment assignment Z=1 and column 1 is the binary outcome Y=1

level

significance level of hypothesis tests, i.e., method yields a 100(1-level)% confidence interval

Details

The attributable effects based confidence interval from inverting n+2n+2 hypothesis tests.

Value

tau.hat

estimated average treatment effect

lower

lower bound of confidence interval

upper

upper bound of confidence interval

Author(s)

Joseph Rigdon [email protected]

References

Rigdon, J.R. and Hudgens, M.G. (2015). Randomization inference for treatment effects on a binary outcome. Statistics in Medicine, 34(6), 924-935.

Examples

ex = matrix(c(8,2,3,7),2,2,byrow=TRUE)
 AE.CI(ex,0.05)

Permutation test confidence interval for a treatment effect on a binary outcome

Description

Computes permutation-based confidence intervals for the average treatment effect on a binary outcome in an experiment where mm of nn individuals are randomized to treatment by design.

Usage

Perm.CI(data, level, nperm)

Arguments

data

observed 2 by 2 table in matrix form where row 1 is the treatment assignment Z=1 and column 1 is the binary outcome Y=1

level

significance level of hypothesis tests, i.e., method yields a 100(1-level)% confidence interval

nperm

number of randomizations to perform for each hypothesis test

Details

The permutation confidence interval results from inverting O(n4)O(n^{4}) hypothesis tests where nn is the total number of observations in the observed 2 by 2 table. For each hypothesis test, if (nm)n \choose m is less than or equal to nperm, (nm)n \choose m randomizations are performed, but if (nm)n \choose m is greater than nperm, a random sample with replacement of nperm randomizations are performed.

Value

tau.hat

estimated average treatment effect

lower

lower bound of confidence interval

upper

upper bound of confidence interval

Author(s)

Joseph Rigdon [email protected]

References

Rigdon, J.R. and Hudgens, M.G. (2015). Randomization inference for treatment effects on a binary outcome. Statistics in Medicine, 34(6), 924-935.

Examples

ex = matrix(c(8,2,3,7),2,2,byrow=TRUE)
 Perm.CI(ex,0.05,100)

Permutation test confidence interval for a treatment effect on a binary outcome

Description

Computes permutation-based confidence intervals for the average treatment effect on a binary outcome in an experiment where mm of nn individuals are randomized to treatment by design. This function is based on the modified approach (RLH) in Rigdon, Loh and Hudgens (forthcoming). The Chiba (2015) and Blaker (2000) intervals are also returned. There is an additional option of specifying the maximum number of hypothesis tests to be carried out.

Usage

Perm.CI.RLH(data, level, verbose=FALSE, total_tests=NA)

Arguments

data

observed 2 by 2 table in matrix form where row 1 is the treatment assignment Z=1 and column 1 is the binary outcome Y=1

level

significance level of hypothesis tests, i.e., method yields a 100(1-level)% confidence interval

verbose

If TRUE, returns an additional data frame listing all the values of (n11,n10,n01,n00)(n_{11},n_{10},n_{01},n_{00}) tested, and the corresponding p-values; default = FALSE.

total_tests

maximum number of hypotheses to be tested in total, with a minimum of two for each possible value of (n10n01)/n;(n_{10}-n_{01})/n; default = NA. By default, all hypotheses are evaluated until the minimum and maximum values of (n10n01)/n(n_{10}-n_{01})/n with p-values \ge level (or level/2 for the Chiba intervals) are found.

Value

A list with the following items:

Chiba

Chiba confidence interval

RLH

RLH confidence interval

Blaker

Blaker confidence interval

tau.hat

estimated average treatment effect

p_values

if verbose=TRUE, a data frame with all the p-values from the hypothesis tests; default=FALSE

Author(s)

Wen Wei Loh [email protected]

References

Rigdon, J.R. and Hudgens, M.G. (2015). Randomization inference for treatment effects on a binary outcome. Statistics in Medicine, 34(6), 924-935.

Chiba, Y. (2015). Exact tests for the weak causal null hypothesis on a binary outcome in randomized trials. Journal of Biometrics & Biostatistics, 6(244).

Chiba, Y. (2016). A note on exact confidence interval for causal effects on a binary outcome in randomized trials. Statistics in Medicine, 35(10), 1739-1741.

Blaker, H. (2000). Confidence curves and improved exact confidence intervals for discrete distributions. Canadian Journal of Statistics, 28(4), 783-798.

Rigdon, J.R., Loh W.W. and Hudgens, M.G. (forthcoming). Response to comment on "Randomization inference for treatment effects on a binary outcome."

Examples

ex = matrix(c(11,1,7,21),2,2,byrow=TRUE)
Perm.CI.RLH(ex,0.05)

ex = matrix(c(7,5,1,27),2,2,byrow=TRUE)
Perm.CI.RLH(ex,0.05)
Perm.CI.RLH(ex,0.05, verbose=TRUE)

ex = matrix(c(33,15,11,37),2,2,byrow=TRUE)
Perm.CI.RLH(ex,0.05, total_tests=1000)
Perm.CI.RLH(ex,0.05)

Asymptotic confidence interval for a treatment effect on a binary outcome

Description

Computes the Robins (1988) confidence interval for the average treatment effect on a binary outcome in an experiment where mm of nn individuals are randomized to treatment by design.

Usage

Robins.CI(data, level)

Arguments

data

observed 2 by 2 table in matrix form where row 1 is the treatment assignment Z=1 and column 1 is the binary outcome Y=1

level

significance level of hypothesis tests, i.e., method yields a 100(1-level)% confidence interval

Details

The Robins (1988) confidence interval is similar in form to the well known Wald confidence interval for a difference in proportions, but is guaranteed to have smaller width.

Value

tau.hat

estimated average treatment effect

lower

lower bound of confidence interval

upper

upper bound of confidence interval

Author(s)

Joseph Rigdon [email protected]

References

Robins, J.M. (1988). Confidence intervals for causal parameters. Statistics in Medicine, 7(7), 773-785.

Examples

#Example 1 from Robins (1988)
ex = matrix(c(40,60,15,85),2,2,byrow=TRUE)
Robins.CI(ex,0.05)