View source: R/farringtonManning.R
farrington.manning | R Documentation |
The Farrington-Manning test for rate differences can be used to compare the rate difference of successes between two groups to a preset value. It uses an explicit formula for the standard deviation of the test statistic under the null hypothesis [1].
farrington.manning( group1, group2, delta = 0, alternative = "greater", alpha = 0.025 )
group1 |
a logical vector of data from group 1, where |
group2 |
a logical vector of data from group 2, where |
delta |
the rate difference under the null hypothesis |
alternative |
character string indicating the alternative to use, either of "two.sided", "less", "greater" |
alpha |
the significance level (acceptable error of the first kind), a two-sided confidence intnerval is returned with confidence level 1 - 2*alpha, such that the lower bound is a valid one sided confidence interval at the confidence level 1 - alpha. |
The Farrington-Maning test for rate differences test the null hypothesis of
H[0]: p[1] - p[2] = δ
for the "two.sided" alternative (or ≥ for the "greater" respectively ≤ for the "less" alternative). This formulation allows to specify non-inferiority and superiority test in a consistent manner:
for delta < 0 and alternative == "greater" the null hypothesis reads H[0]: p[1] - p[2] ≥ δ and consequently rejection allows concluding that p[1] ≥ p[2] + δ i.e. that the rate of success in group one is at least the success rate in group two plus delta - as delta is negagtive this is equivalent to the success rate of group 1 being at worst |delta| smaller than that of group 2.
for delta >= 0 and alternative == "greater" the null hypothesis reads H[0]: p[1] - p[2] ≥ δ and consequently rejection allows concluding that p[1] ≥ p[2] + δ i.e. that the rate of success in group one is at least delta greater than the success rate in group two.
The confidence interval is always computed as two-sided, but with 1-2α confidence level in case of a one-sided hypthesis. This means that the lower or upper vound are valid one-sided confidence bounds at level α in this case. The confidence interval is constructed by inverting the two-sided test directly.
A list of class "htest" containing the following components:
statistic : | the value of the Z-statistic |
parameter : | delta, rate difference (group 1 - group 2) under the null hypothesis |
p.value : | the p-value for the Farrington-Manning test |
null.value : | rate difference (group 1 - group 2) under the null |
alternative : | a character string indicating the alternative hypothesis |
method : | a character string indicating the exact method employed |
data.name : | a character string giving the names of the data used |
estimate : | the estimated rate difference (maximum likelihood) |
conf.int : | a confidence interval for the rate difference |
sample.size : | the total sample size used for the test |
Kevin Kunzmann
[1] Farrington, Conor P., and Godfrey Manning. "Test statistics and sample size formulae for comparative binomial trials with null hypothesis of non-zero risk difference or non-unity relative risk." Statistics in medicine 9.12 (1990): 1447-1454.
x <- c(rep(TRUE, 20), rep(FALSE, 15)) y <- c(rep(TRUE, 30), rep(FALSE, 25)) farrington.manning(x, y, -.3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.