Package 'sensitivity2x2xk'

Title: Sensitivity Analysis for 2x2xk Tables in Observational Studies
Description: Performs exact or approximate adaptive or nonadaptive Cochran-Mantel-Haenszel-Birch tests and sensitivity analyses for one or two 2x2xk tables in observational studies.
Authors: Paul R. Rosenbaum and Dylan S. Small
Maintainer: Paul R. Rosenbaum <[email protected]>
License: GPL-2
Version: 1.01
Built: 2024-12-07 06:45:50 UTC
Source: CRAN

Help Index


Adaptive Exact Test for Two 2x2xk Tables

Description

Given two statistically independent contingency tables, a focal 2x2xk table and an additional 2x2xm table, adaptmh performs an exact, adaptive test and sensitivity analysis. The test is adaptive in that is considers one test using the focal table alone, another test that combines the focal and additional tables, correcting for multiple testing using the exact joint distribution. Use adaptmhLS for a large sample approximation to this exact test.

Usage

adaptmh(tab1,tab2,Gamma=1,alpha=0.05,double=FALSE,inc=0.25)

Arguments

tab1

tab1 is a 2x2 or a 2x2xk focal table that will be emphasized in the test.

tab2

tab2 is a 2x2 or a 2x2xm additional table that will be given less emphasis in the test. tab1 and tab2 must be statistically independent describing different individuals.

Gamma

Gamma>=1 is the sensitivity parameter, where Gamma=1 yields a randomization test.

alpha

alpha is a number, 0<alpha<1, where the test is performed with level alpha. The test is one sided, testing no effect against an increasted risk in the first row, the treated row. To do a two-sided test, report rejection at level alpha as rejection at level 2*alpha. By default, alpha=0.05, so rejection at one-sided alpha=0.025 can be described as rejection at two-sided 0.05.

double

If double = FALSE, then one test uses tab1 and the other uses both tab1 and tab2 as essentially a 2x2x(k+m) table; that is, the test statistic is the total count in the [1,1,j] cells of this 2x2x(k+m) table, as in the Cochran-Mantel-Haenszel-Birch test.

If double = TRUE, then one test uses tab1 as a 2x2xk table, and the other doubles the test statistic from this table and adds the test statistic for tab2, the 2x2xm table. In other words, the counts in the [1,1,j] cell of tab1 are given twice the weigth of the counts in the [1,1,j] cell of tab2.

inc

The sensitivity analysis is performed at values of Gamma between 1 and the number Gamma set when calling the function, in increments of inc. For instance, setting Gamma=1.5 with inc=0.1 does the sensitivity analysis for 1, 1.1, 1.2, 1.3, 1.4, 1.5. The results end with the first Gamma at which the null hypothesis is accepted at level alpha.

Value

A

A is the total count in the [1,1,j] cells of the 2x2xk table tab1, summing over j=1,...,k. It is the test statistic in Birch's (1964) exact version of the Cochran-Mantel-Haenszel test. A is the test statistic for the first test.

B

Define A* to be the total count in the [1,1,j] cells of the 2x2xm table tab2, summing over j=1,...,m. If double=FALSE, then B = A+A*. If double=TRUE, then B = 2A+A*. B is the test statistic for the second test.

result

In row i of result, the test is performed so that, under H0, Pr(A>=a or B>=b) = peither <= alpha for the given Gamma. The table also reports Pr(A>=a) = pa, Pr(B>=b) = pb, and adif = |Pr(A>=a)-Pr(B>=b)| = |pa-pb|. The values a, b are selected so that Pr(A>=a or B>=b) <= alpha, neither a nor b can be reduced without increasing the other, and |Pr(A>=a)-Pr(B>=b)| is minimized. If either A>=a or B>=b then the test rejects at level alpha.

Note

The test is Birch's (1964) one-sided exact test for no partial association in a 2x2xk table, reducing to Fisher's exact test if k=1. The large sample version of Birch's test is the one-sided version of the Cochran (1954) - Mantel-Haenszel (1959) test.

Because this is an exact test with a discrete distribution, it may have size strictly less than its level. Discreteness also implies that the optimal a and b may take small steps up and down as Gamma increases.

The adaptmh function performs the exact test using the fast fourier transform to convolve probability generating functions for the extended hypergeometric distribution. The function makes use of the BiasedUrn package. The sensitivity analysis for one 2x2xk (treatment x outcome x covariate) table in an observational study is developed in Rosenbaum (1995; 2002, Chapter 4). Exact adaptive tests combining two groups of matched pairs or sets are described in Rosenbaum (2012a), Small et al. (2013) and Rosenbaum and Small (2015). Another function, adaptmhLS, performs a parallel test using a Normal approximation to the exact null distribution.

The adaptive test shares alpha between two tests. Some tables have such small counts or marginal totals that rejection at level alpha is not possible no matter how the results come out. The program has to do a certain amount of computation to discover this situation. When the situation occurs, a warning message is returned and the program executes a stop() with an error. In this case, you did not reject the null hypothesis at the given alpha and Gamma, but no result with these data could do that.

References

Abbas, S. et al. (2008) Serum 25-hydroxyvitamin D and risk of post-menopausal breast cancer – results in a large case-control study. Carcinogenesis 29, 93-99.

Birch, M. W. (1964). The detection of partial association, I: The 2 x 2 case. Journal of the Royal Statistical Society. Series B (Methodological), 313-324.

Cochran, W. G. (1954). Some methods for strengthening the common chi-squared tests. Biometrics, 10, 417-451.

Fu, Zhenming, Martha J. Shrubsole, Walter E. Smalley, Huiyun Wu, Zhi Chen, Yu Shyr, Reid M. Ness, and Wei Zheng (2012). Lifestyle factors and their combined impact on the risk of colorectal polyps. American Journal of Epidemiology 176, 766-776.

Mantel, N. and Haenszel, W. (1959). Statistical aspects of the analysis of data from retrospective studies. Journal of the National Cancer Institute 22, 719-748.

Rosenbaum, P. R. (1995). Quantiles in nonrandom samples and observational studies. Journal of the American Statistical Association, 90, 1424-1431.

Rosenbaum, P. R. (2002) Observational Studies (2nd edition). New York: Springer.

Rosenbaum, P. R. (2012a). An exact adaptive test with superior design sensitivity in an observational study of treatments for ovarian cancer. The Annals of Applied Statistics, 6(1), 83-105.

Rosenbaum, P. R. (2012b). Testing one hypothesis twice in observational studies. Biometrika, 99, 763-774.

Rosenbaum, P. R. (2015). The cross-cut statistic and its sensitivity to bias in observational studies with ordered doses of treatment. Biometrics, to appear. DOI: 10:1111/biom.12373

Rosenbaum, P. R. and Small, D. S. (2015) An adaptive Mantel-Haenszel test for sensitivity analysis in observational studies. Manuscript.

Satagopan, J. M., Offit, K., Foulkes, W., Robson, M. E. Wacholder, S., Eng, C. M., Karp, S. E. and Begg, C. B. (2001). The lifetime risks of breast cancer in Ashkenazi Jewish carriers of brca1 and brca2 mutations. Cancer Epidemology, Biomarkers and Prevention, 10, 467-473.

Small, D. S., Cheng, J., Halloran, M. E. and Rosenbaum, P. R. (2013). Case definition and design sensitivity. Journal of the American Statistical Association, 108, 1457-1468.

Examples

# The first example is from Satagopan, et al. (2001), Table 2.
# It is a case-control study of breast cancer and BRCA1+ mutations
# for women aged <40 and women aged >=40.
ageLT40<-matrix(c(18,51,11,673),2,2)
ageGE40<-matrix(c(39,652,21,2699),2,2)
rownames(ageLT40)<-rownames(ageGE40)<-c("BRCA1+","Negative")
colnames(ageLT40)<-colnames(ageGE40)<-c("Case","Control")
names(dimnames(ageLT40))<-c("Mutation","Breast Cancer")
names(dimnames(ageGE40))<-c("Mutation","Breast Cancer")
adaptmh(ageLT40,ageGE40,Gamma=10)

#The second example is from Fu et al (2012) as discussed
#in Rosenbaum (2015, Table 1). In effect, the test
#adapts between two possible definitions of a high
#life-style risk of large adenomas discovered by colonoscopy.

tab1<-matrix(c(42,45,136,913),2,2)
tab2<-matrix(c(77,78,482,885),2,2)
colnames(tab1)<-c(">1cm","None")
colnames(tab2)<-c(">1cm","None")
rownames(tab1)<-c("5-6","0-1")
rownames(tab2)<-c("4","2")
names(dimnames(tab1))<-c("Risk Score","Adenoma Size")
names(dimnames(tab2))<-c("Risk Score","Adenoma Size")

#An adaptive randomization test,
#where both component tests reject.
adaptmh(tab1,tab2,Gamma=1)

#An adaptive randomization test,
#giving double weight to the extreme table.

adaptmh(tab1,tab2,Gamma=1,double=TRUE)

#A sensitivity analysis at Gamma=5.
#Only the high risk table leads to rejection.

adaptmh(tab1,tab2,Gamma=5,double=TRUE)

#The third example is from Table II of
#Abbas, S. et al. (2008).  The table started as a 5x2
# crossclassification of doses of vitamin D
#in blood serum (25(OH)D in nM), and became
#two 2x2 tables, an outer table of extreme doses
#and an inner table of moderate doses.

tab1<-matrix(c(345,209,218,294),2,2)
tab2<-matrix(c(354,186,327,218),2,2)

colnames(tab2)<-colnames(tab1)<-c("cases","controls")
rownames(tab1)<-c("<30",">=70")
rownames(tab2)<-c("30-45","60-75")
names(dimnames(tab1))<-c("Vitamin D","Breast Cancer")
names(dimnames(tab2))<-c("Vitamin D","Breast Cancer")

#This performs the adaptive test with increments
#of .25 to limit computation
#in the example, but increments of 0.05
#would provide more detail.

adaptmh(tab1,tab2,Gamma=2, inc=0.25)

Large Sample Adaptive Test for Two 2x2xk Tables

Description

Given two statistically independent contingency tables, a focal 2x2xk table and an additional 2x2xm table, adaptmh performs an approximate, adaptive test and sensitivity analysis. The test is adaptive in that is considers one test using the focal table alone, another test that combines the focal and additional tables, correcting for multiple testing using a Normal approximation to the exact joint distribution. Uses the BiasedUrn and mvtnorm packages.

Usage

adaptmhLS(tab1,tab2,Gamma=1,double=FALSE)

Arguments

tab1

tab1 is a 2x2 or a 2x2xk table that will be emphasized in the test.

tab2

tab2 is a 2x2 or a 2x2xm table that will be given less emphasis in the test. tab1 and tab2 must be statistically independent describing different individuals.

Gamma

Gamma>=1 is the sensitivity parameter, where Gamma=1 yields a randomization test.

double

If double = FALSE, then one test uses tab1 and the other uses both tab1 and tab2 as essentially a 2x2x(k+m) table; that is, the test statistic is the total count in the [1,1,j] cells of this 2x2x(k+m) table, as in the Cochran-Mantel-Haenszel-Birch test.

If double = TRUE, then one test uses tab1 as a 2x2xk table, and the other doubles the test statistic from this table and adds the test statistic for tab2, the 2x2xm table. In other words, the counts in the [1,1,j] cell of tab1 are given twice the weigth of the counts in the [1,1,j] cell of tab2.

In either case, the exact expectations, variances and covariances of the two test statistics are used in a Normal approximation to the bivariate distribution.

Value

pval

The pval from the adaptive test.

maxdeviate

The larger of the two standardized deviates for the two component tests.

correlation

The correlation of the two component test statistics under the null hypothesis.

detail

The component test statistics, their null expectations, variances, standardized deviates, and p-values. Only the overall pval above provides a valid test that corrects for testing the hypothesis twice.

Note

adaptmhLS is the large sample approximation to the exact adaptive test in adaptmh. The Normal approximation is similar to that in Rosenbaum (2012b).

References

Birch, M. W. (1964). The detection of partial association, I: The 2 x 2 case. Journal of the Royal Statistical Society. Series B (Methodological), 313-324.

Cochran, W. G. (1954). Some methods for strengthening the common chi-squared tests. Biometrics, 10, 417-451.

Fu, Zhenming, Martha J. Shrubsole, Walter E. Smalley, Huiyun Wu, Zhi Chen, Yu Shyr, Reid M. Ness, and Wei Zheng (2012). Lifestyle factors and their combined impact on the risk of colorectal polyps. American Journal of Epidemiology 176, 766-776.

Mantel, N. and Haenszel, W. (1959). Statistical aspects of the analysis of data from retrospective studies. Journal of the National Cancer Institute 22, 719-748.

Rosenbaum, P. R. (1995). Quantiles in nonrandom samples and observational studies. Journal of the American Statistical Association, 90, 1424-1431.

Rosenbaum, P. R. (2002) Observational Studies (2nd edition). New York: Springer.

Rosenbaum, P. R. (2012a). An exact adaptive test with superior design sensitivity in an observational study of treatments for ovarian cancer. The Annals of Applied Statistics, 6(1), 83-105.

Rosenbaum, P. R. (2012b). Testing one hypothesis twice in observational studies. Biometrika, 99, 763-774.

Rosenbaum, P. R. (2015). The cross-cut statistic and its sensitivity to bias in observational studies with ordered doses of treatment. Biometrics, to appear. DOI: 10:1111/biom.12373

Rosenbaum, P. R. and Small, D. S. (2015) An adaptive Mantel-Haenszel test for sensitivity analysis in observational studies. Manuscript.

Small, D. S., Cheng, J., Halloran, M. E. and Rosenbaum, P. R. (2013). Case definition and design sensitivity. Journal of the American Statistical Association, 108, 1457-1468.

Examples

# The first example is from Satagopan, et al. (2001),
# Table 2.  It is a case-control study of
# breast cancer and BRCA1+ mutations
# for women aged <40 and women aged >=40.
ageLT40<-matrix(c(18,51,11,673),2,2)
ageGE40<-matrix(c(39,652,21,2699),2,2)
rownames(ageLT40)<-c("BRCA1+","Negative")
rownames(ageGE40)<-c("BRCA1+","Negative")
colnames(ageLT40)<-c("Case","Control")
colnames(ageGE40)<-c("Case","Control")
names(dimnames(ageLT40))<-c("Mutation","Breast Cancer")
names(dimnames(ageGE40))<-c("Mutation","Breast Cancer")
adaptmhLS(ageLT40,ageGE40,Gamma=9.6)

#This example is from Fu et al (2012) as discussed
#in Rosenbaum (2015, Table 1). In effect, the test
#adapts between two possible definitions of a high
#life-style risk of large adenomas
#discovered by colonoscopy.

tab1<-matrix(c(42,45,136,913),2,2)
tab2<-matrix(c(77,78,482,885),2,2)
colnames(tab1)<-c(">1cm","None")
colnames(tab2)<-c(">1cm","None")
rownames(tab1)<-c("5-6","0-1")
rownames(tab2)<-c("4","2")
names(dimnames(tab1))<-c("Risk Score","Adenoma Size")
names(dimnames(tab2))<-c("Risk Score","Adenoma Size")

#An adaptive randomization test,
#where both component tests reject.
adaptmhLS(tab1,tab2,Gamma=1)

#An adaptive randomization test,
#giving double weight to the extreme table.
adaptmhLS(tab1,tab2,Gamma=1,double=TRUE)

#A sensitivity analysis at Gamma=4.
#Only the high risk table leads to rejection.
adaptmhLS(tab1,tab2,Gamma=4,double=TRUE)

Convolution of Two Probability Generating Functions

Description

Computes the convolution of two probability generating functions using the convolve function in the stats package. The convolve function uses the fast fourier transform.

Usage

gconv(g1,g2)

Arguments

g1

A probability generating function. A vector g1 for a random variable X taking values 0, 1, 2, ..., length(g1)-1, where g1[i] = Pr(X=i-1)For example, g1 = c(2/3, 1/3) is the generating function of a binary random variable X with Pr(X=0)=2/3, Pr(X=1)=1/3. The random variable that is 0 with probability 1 has g1=1.

g2

Another probability generating function for a random variable Y. For a fair die, g2 = c(0, 1/6, 1/6, 1/6, 1/6, 1/6, 1/6).

Value

The probability generating function of X+Y when X and Y are independent.

References

Pagano, M. and Tritchler, D. (1983). On obtaining permutation distributions in polynomial time. Journal of the American Statistical Association, 78, 435-440.

Rosenbaum, P. R. (2010). Design of Observational Studies. New York: Springer. Section 3.9: Appendix Exact Computations for Sensitivity Analysis.

Examples

gconv(c(2/3,1/3),c(2/3,1/3))

gconv(1,c(2/3,1/3))

gconv(c(0, 1/6, 1/6, 1/6, 1/6, 1/6, 1/6),
     c(0, 1/6, 1/6, 1/6, 1/6, 1/6, 1/6))

Exact Test for One 2x2xk Table in Observational Studies

Description

Exact, one-sided sensitivity analysis for a 2x2xk table.

Usage

mh(tab,Gamma=1)

Arguments

tab

tab is a 2x2 or a 2x2xk contingency table, typically treatment x outcome x covariate.

Gamma

Gamma>=1 is the sensitivity parameter, where Gamma=1 yields a randomization test.

Value

pval

Upper bound on the one-sided P-value.

A

A is the total count in the [1,1,j] cells of the 2x2xk table tab, summing over j=1,...,k. It is the test statistic in Birch's (1964) exact version of the Cochran-Mantel-Haenszel test. Birch's test is the uniformly most powerful unbiased test against a constant odds ratio alternative.

Note

The mh function uses the exact distribution. Use mhLS for a large sample approximation based on exact moments.

References

Birch, M. W. (1964). The detection of partial association, I: The 2 x 2 case. Journal of the Royal Statistical Society. Series B (Methodological), 313-324.

Cochran, W. G. (1954). Some methods for strengthening the common chi-squared tests. Biometrics, 10, 417-451.

Fu, Zhenming, Martha J. Shrubsole, Walter E. Smalley, Huiyun Wu, Zhi Chen, Yu Shyr, Reid M. Ness, and Wei Zheng (2012). Lifestyle factors and their combined impact on the risk of colorectal polyps. American Journal of Epidemiology 176, 766-776.

Mantel, N. and Haenszel, W. (1959). Statistical aspects of the analysis of data from retrospective studies. Journal of the National Cancer Institute 22, 719-748.

Rosenbaum, P. R. (1995). Quantiles in nonrandom samples and observational studies. Journal of the American Statistical Association, 90, 1424-1431.

Rosenbaum, P. R. (2002) Observational Studies (2nd edition). New York: Springer.

Satagopan, J. M., Offit, K., Foulkes, W., Robson, M. E. Wacholder, S., Eng, C. M., Karp, S. E. and Begg, C. B. (2001). The lifetime risks of breast cancer in Ashkenazi Jewish carriers of brca1 and brca2 mutations. Cancer Epidemology, Biomarkers and Prevention, 10, 467-473.

Examples

# The example is from Satagopan, et al. (2001), Table 2.
# It is a case-control study of breast cancer and
# BRCA1+ mutations for women aged <40 and women aged >=40.
ageLT40<-matrix(c(18,51,11,673),2,2)
ageGE40<-matrix(c(39,652,21,2699),2,2)
rownames(ageLT40)<-c("BRCA1+","Negative")
rownames(ageGE40)<-c("BRCA1+","Negative")
colnames(ageLT40)<-colnames(ageGE40)<-c("Case","Control")
names(dimnames(ageLT40))<-c("Mutation","Breast Cancer")
names(dimnames(ageGE40))<-c("Mutation","Breast Cancer")
both<-array(c(18,51,11,673,39,652,21,2699),c(2,2,2))
dimnames(both)<-list(c("BRCA1+","Negative"),
      c("Case","Control"),c("LT40","GE40"))
names(dimnames(both))<-c("Mutation","Breast Cancer","Age")

mh(ageLT40,Gamma=9.3)
mh(ageGE40,Gamma=9.3)
mh(both,Gamma=9.3)

#Compare with adaptmh(ageLT40,ageGE40,Gamma=10)

Large Sample Test for One 2x2xk Table

Description

Large sample approximation to a one-sided sensitivity analysis for a 2x2 or 2x2xk table.

Usage

mhLS(tab,Gamma=1,correction=FALSE)

Arguments

tab

tab is a 2x2 or a 2x2xk contingency table, typically treatment x outcome x covariate.

Gamma

Gamma>=1 is the sensitivity parameter, where Gamma=1 yields a randomization test.

correction

If correction=TRUE, a continuity correction is used. The usual Mantel-Haenszel test for a 2x2xk table uses a continuity correction.

Value

pval

Upper bound on the one-sided P-value.

A

A is the total count in the [1,1,j] cells of the 2x2xk table tab, summing over j=1,...,k. It is the test statistic in Birch's (1964) version of the Cochran-Mantel-Haenszel test. Birch's test is the uniformly most powerful unbiased test against a constant odds ratio alternative.

Expectation

Null expectation of A for the upper bounding distribution of A.

Variance

Null variance of A for the upper bounding distribution of A. The approximate P-value is 1-pnorm((A-Expectation)/sqrt(Variance)), unless correction=TRUE, in which case A is reduced by 1/2.

Note

The mhLS function uses the exact null expectation and variance of A in a Normal approximation. Use mh for an exact test.

References

Birch, M. W. (1964). The detection of partial association, I: The 2 x 2 case. Journal of the Royal Statistical Society. Series B (Methodological), 313-324.

Cochran, W. G. (1954). Some methods for strengthening the common chi-squared tests. Biometrics, 10, 417-451.

Fu, Zhenming, Martha J. Shrubsole, Walter E. Smalley, Huiyun Wu, Zhi Chen, Yu Shyr, Reid M. Ness, and Wei Zheng (2012). Lifestyle factors and their combined impact on the risk of colorectal polyps. American Journal of Epidemiology 176, 766-776.

Mantel, N. and Haenszel, W. (1959). Statistical aspects of the analysis of data from retrospective studies. Journal of the National Cancer Institute 22, 719-748.

Rosenbaum, P. R. (1995). Quantiles in nonrandom samples and observational studies. Journal of the American Statistical Association, 90, 1424-1431.

Rosenbaum, P. R. (2002) Observational Studies (2nd edition). New York: Springer.

Satagopan, J. M., Offit, K., Foulkes, W., Robson, M. E. Wacholder, S., Eng, C. M., Karp, S. E. and Begg, C. B. (2001). The lifetime risks of breast cancer in Ashkenazi Jewish carriers of brca1 and brca2 mutations. Cancer Epidemology, Biomarkers and Prevention, 10, 467-473.

Examples

# The first example is from Satagopan, et al. (2001), Table 2.
# It is a case-control study of breast cancer and
# BRCA1+ mutations for women aged <40 and women aged >=40.
ageLT40<-matrix(c(18,51,11,673),2,2)
ageGE40<-matrix(c(39,652,21,2699),2,2)
rownames(ageLT40)<-c("BRCA1+","Negative")
rownames(ageGE40)<-c("BRCA1+","Negative")
colnames(ageLT40)<-c("Case","Control")
colnames(ageGE40)<-c("Case","Control")
names(dimnames(ageLT40))<-c("Mutation","Breast Cancer")
names(dimnames(ageGE40))<-c("Mutation","Breast Cancer")
both<-array(c(18,51,11,673,39,652,21,2699),c(2,2,2))
dimnames(both)<-list(c("BRCA1+","Negative"),
      c("Case","Control"),c("LT40","GE40"))
names(dimnames(both))<-c("Mutation","Breast Cancer","Age")

mhLS(ageLT40,Gamma=9.3)
mhLS(ageLT40,Gamma=9.3,correction=TRUE)
mhLS(ageGE40,Gamma=9.3)
mhLS(ageGE40,Gamma=9.3,correction=TRUE)

#Compare with the exact test:
mh(ageLT40,Gamma=9.3)
mh(ageGE40,Gamma=9.3)

mhLS(both,Gamma=9.3)
mhLS(both,Gamma=9.3,correction=TRUE)

#Compare with the exact test
mh(both,Gamma=9.3)

#Compare with the adaptive test
adaptmhLS(ageLT40,ageGE40,Gamma=9.3)

Weighted Exact Test for Two 2x2xk Tables

Description

Exact, one-sided sensitivity analysis for two 2x2xk tables, where the first table receives twice the weight.

Usage

mhWeighted(tab1,tab2,Gamma=1)

Arguments

tab1

tab1 is a 2x2 or a 2x2xk contingency table, typically treatment x outcome x covariate. Table tab1 receives twice the weight of tab2.

tab2

tab2 is a 2x2 or a 2x2xk contingency table, typically treatment x outcome x covariate. Table tab1 receives twice the weight of tab2.

Gamma

Gamma>=1 is the sensitivity parameter, where Gamma=1 yields a randomization test.

Value

pval

Upper bound on the one-sided P-value.

WeightedMH

WeightedMH is the twice total count in the [1,1,j] cells of tab1 plus the total count of the [1,1,j] cells of tab2.

Note

The mhWeighted function uses the exact distribution of the WeightedMH statistic under the null hypothesis. In function adaptmh, this test statistic may be used as one of the two component tests by setting double=TRUE. The mhWeighted function makes the same test statistic available in a nonadaptive form.

References

Abbas, S. et al. (2008) Serum 25-hydroxyvitamin D and risk of post-menopausal breast cancer – results in a large case-control study. Carcinogenesis 29, 93-99.

Birch, M. W. (1964). The detection of partial association, I: The 2 x 2 case. Journal of the Royal Statistical Society. Series B (Methodological), 313-324.

Cochran, W. G. (1954). Some methods for strengthening the common chi-squared tests. Biometrics, 10, 417-451.

Fu, Zhenming, Martha J. Shrubsole, Walter E. Smalley, Huiyun Wu, Zhi Chen, Yu Shyr, Reid M. Ness, and Wei Zheng (2012). Lifestyle factors and their combined impact on the risk of colorectal polyps. American Journal of Epidemiology 176, 766-776.

Mantel, N. and Haenszel, W. (1959). Statistical aspects of the analysis of data from retrospective studies. Journal of the National Cancer Institute 22, 719-748.

Rosenbaum, P. R. (1995). Quantiles in nonrandom samples and observational studies. Journal of the American Statistical Association, 90, 1424-1431.

Rosenbaum, P. R. (2002) Observational Studies (2nd edition). New York: Springer.

Rosenbaum, P. R. and Small, D. S. (2015) An adaptive Mantel-Haenszel test for sensitivity analysis in observational studies. Manuscript.

Satagopan, J. M., Offit, K., Foulkes, W., Robson, M. E. Wacholder, S., Eng, C. M., Karp, S. E. and Begg, C. B. (2001). The lifetime risks of breast cancer in Ashkenazi Jewish carriers of brca1 and brca2 mutations. Cancer Epidemology, Biomarkers and Prevention, 10, 467-473.

Examples

# The first example is from Satagopan, et al. (2001),
# Table 2. It is a case-control study of breast
# cancer and BRCA1+ mutations for women aged <40
# and women aged >=40.
ageLT40<-matrix(c(18,51,11,673),2,2)
ageGE40<-matrix(c(39,652,21,2699),2,2)
rownames(ageLT40)<-c("BRCA1+","Negative")
rownames(ageGE40)<-c("BRCA1+","Negative")
colnames(ageLT40)<-c("Case","Control")
colnames(ageGE40)<-c("Case","Control")
names(dimnames(ageLT40))<-c("Mutation","Breast Cancer")
names(dimnames(ageGE40))<-c("Mutation","Breast Cancer")
both<-array(c(18,51,11,673,39,652,21,2699),c(2,2,2))
dimnames(both)<-list(c("BRCA1+","Negative"),
      c("Case","Control"),c("LT40","GE40"))
names(dimnames(both))<-c("Mutation","Breast Cancer","Age")

#This is an unweighted Cochran-Mantel-Haenszel-Birch
#test for the 2x2x2 table:
mh(both,Gamma=7.2)

#This is the weighted test giving double
#weight to the first table.
mhWeighted(ageLT40,ageGE40,Gamma=7.2)
mhWeighted(ageLT40,ageGE40,Gamma=8.3)

#Compare: adaptmh(ageLT40,ageGE40,Gamma=10,double=TRUE)

#The second example is from Table II of
#Abbas, S. et al. (2008).  The table started as a 5x2
# crossclassification of doses of vitamin D
#in blood serum (25(OH)D in nM), and became
#two 2x2 tables, an outer table of extreme doses
#and an inner table of moderate doses.
#Compare with the discussion of the crosscut
#test in Rosenbaum (2015) and the corresponding example
#in the documentation for adaptmh.

tab1<-matrix(c(345,209,218,294),2,2)
tab2<-matrix(c(354,186,327,218),2,2)
colnames(tab2)<-c("cases","controls")
colnames(tab1)<-c("cases","controls")
rownames(tab1)<-c("<30",">=70")
rownames(tab2)<-c("30-45","60-75")
names(dimnames(tab1))<-c("Vitamin D","Breast Cancer")
names(dimnames(tab2))<-c("Vitamin D","Breast Cancer")

mhWeighted(tab1,tab2,Gamma=1.58)

# Compare with an unweighted test
mh(array(c(tab1,tab2),c(2,2,2)),Gamma=1.58)
mh(array(c(tab1,tab2),c(2,2,2)),Gamma=1.46)

# Compare: adaptmh(tab1,tab2,Gamma=2,inc=0.25,double=TRUE)

# Both examples are discussed in Rosenbaum and Small (2015).