PQStat PQStat User Guide Polski pqstat.pl

The Mantel-Haenszel method for several \(2\)x\(2\) tables

When to use:

The Mantel-Haenszel method for \(2\times2\) tables, proposed by Mantel and Haenszel (1959)[114] and later extended by Mantel (1963)[115] (a broader review of the development of these methods was carried out by, among others, Newman (2001)[128]), can be used, among other things, to analyse \(2\times2\) tables occurring in several (\(w\geq2\)) strata formed by a so-called confounding variable. For successive strata (\(s=1,...,w\)), \(2\times2\) contingency tables of observed frequencies are built:

Observed frequenciesphenomenon studied
stratum \(s\) \(\left(O_{ij}^{(s)}\right)\)occursdoes not occurTotal
risk factorpresent\(O_{11}^{(s)}\)\(O_{12}^{(s)}\)\(O_{11}^{(s)}+O_{12}^{(s)}\)
absent\(O_{21}^{(s)}\)\(O_{22}^{(s)}\)\(O_{21}^{(s)}+O_{22}^{(s)}\)
Total\(O_{11}^{(s)}+O_{21}^{(s)}\)\(O_{12}^{(s)}+O_{22}^{(s)}\)\(n^{(s)}=O_{11}^{(s)}+O_{12}^{(s)}+O_{21}^{(s)}+O_{22}^{(s)}\)

How to set up the analysis

The settings window for the Mantel-Haenszel OR/RR options is opened via the Statistics\(\to\)Stratified analysis\(\to\)Mantel-Haenszel OR/RR menu.

The Mantel-Haenszel odds ratio

When to use:

If all the tables (formed by the individual strata) are homogeneous, a pooled odds ratio, together with confidence intervals, can be determined on the basis of these tables. This odds ratio is a weighted mean of the odds ratios determined for the individual strata. Using the weighted method proposed by Mantel and Haenszel makes it possible to account for the contribution (weight) each stratum makes to the pooled odds ratio (the larger the stratum, the greater its influence on the resulting odds ratio).

Two significance tests accompany the odds ratio determined this way. The Mantel-Haenszel \(\chi^2\) test for \(OR_{MH}\) checks whether the pooled odds ratio differs significantly from 1, i.e. whether a relationship between the features studied exists at all once strata are accounted for. The \(\chi^2\) test of homogeneity for \(OR\), in turn, checks the assumption underlying the whole method – whether the odds ratio is indeed similar across all the strata, or whether the variable forming the strata significantly modifies the strength of the relationship (in which case pooling the strata into a single common odds ratio would not be justified).

Definitions of measures

The Mantel-Haenszel odds ratio – a weighted mean of the odds ratios determined for the individual strata, taking into account the size of each stratum.

Performing and interpreting the analysis

Example 1. (leptospirosis.pqs file)
The table shown presents hypothetical results of a survey conducted to detect risk factors for the occurrence of leptospirosis among rural and urban residents of the West Indies (where a rural area is treated as the exposure factor)[20]. The occurrence of leptospirosis antibodies is indirect evidence of infection.

Observed frequenciesleptospirosis antibodies
\(O_{ij}\)yesno
place of residencerural60140
urban60140

The odds of the occurrence of leptospirosis antibodies is the same for urban and rural residents (OR=1). We want to know what the odds of the occurrence of leptospirosis antibodies will be once we also take sex into account in the analysis. We will therefore split the sample into 2 strata by sex (these are stored in the file as a saved selection):

Observed frequenciesleptospirosis antibodies
for menyesno
place of residencerural3614
urban5050
Observed frequenciesleptospirosis antibodies
for womenyesno
place of residencerural24126
urban1090

Sex is associated with both factors (the occurrence of leptospirosis antibodies and place of residence in the West Indies). It is therefore a confounding factor, and ignoring it can lead to incorrect results.

\(OR_{MH}\)[95%CI]=2.13[1.24, 3.65], Mantel-Haenszel \(\chi^2\) test: \(p=0.005169\) (statistically significant, \(\alpha=0.05\))
The odds of the occurrence of leptospirosis antibodies is significantly higher for people living in rural areas.


Before we read off the pooled odds ratio, we check the \(\chi^2\) test of homogeneity for \(OR\) – the tables are homogeneous (\(p=0.465049\)), so pooling the strata into a single common odds ratio is justified. The odds of the occurrence of leptospirosis antibodies is higher for rural residents, both for women (OR[95%CI]=2.57[1.24, 5.34]) and for men (OR[95%CI]=1.71[0.78, 3.76]). The Mantel-Haenszel \(\chi^2\) test confirms that the pooled odds ratio determined this way is statistically significant.

FOR THOSE INTERESTED

Formulas:
Weights for each stratum are determined according to the formula:

\[ g^{(s)}=\frac{O_{21}^{(s)}\cdot O_{12}^{(s)}}{n^{(s)}}, \]

and the Mantel-Haenszel odds ratio:

\[ OR_{MH}=\frac{R}{S}, \]

where:
\(\displaystyle R=\sum_{s=1}^w\frac{O_{11}^{(s)}\cdot O_{22}^{(s)}}{n^{(s)}}\),
\(\displaystyle S=\sum_{s=1}^wg^{(s)}\).

The confidence interval for \(\log OR_{MH}\) is determined on the basis of the standard error (RBG – Robins-Breslow-Greenland[139][140]) calculated using the formula:

\[ SE_{MH}=\sqrt{\frac{T}{2R^2}+\frac{U+Y}{2RS}+\frac{W}{2S^2}}, \]

where:
\(\displaystyle T=\sum_{s=1}^wT^{(s)}\),  \(\displaystyle T^{(s)}=\frac{O_{11}^{(s)}\cdot O_{22}^{(s)}\cdot \left(O_{11}^{(s)}+O_{22}^{(s)}\right)}{\left(n^{(s)}\right)^2}\),
\(\displaystyle U=\sum_{s=1}^wU^{(s)}\),  \(\displaystyle U^{(s)}=\frac{O_{21}^{(s)}\cdot O_{12}^{(s)}\cdot \left(O_{11}^{(s)}+O_{22}^{(s)}\right)}{\left(n^{(s)}\right)^2}\),
\(\displaystyle Y=\sum_{s=1}^wY^{(s)}\),  \(\displaystyle Y^{(s)}=\frac{O_{11}^{(s)}\cdot O_{22}^{(s)}\cdot \left(O_{21}^{(s)}+O_{12}^{(s)}\right)}{\left(n^{(s)}\right)^2}\),
\(\displaystyle W=\sum_{s=1}^wW^{(s)}\),  \(\displaystyle W^{(s)}=\frac{O_{21}^{(s)}\cdot O_{12}^{(s)}\cdot \left(O_{21}^{(s)}+O_{12}^{(s)}\right)}{\left(n^{(s)}\right)^2}\).

The Mantel-Haenszel \(\chi^2\) test for \(OR_{MH}\)
The Mantel-Haenszel \(\chi^2\) test is used to verify the hypothesis of the significance of the calculated odds ratio (\(OR_{MH}\)), and should be calculated with large sample sizes, i.e. when both conditions of the so-called “rule of 5”are met:

  • \(\min(O_{11}^{(s)}+O_{12}^{(s)},O_{11}^{(s)}+O_{21}^{(s)})-\sum_{s=1}^wE_{11}^{(s)}\ge5\) for all strata \(s=1,2,...,w\),
  • \(\max(0,O_{11}^{(s)}-O_{22}^{(s)})\ge5\) for all strata \(s=1,2,...,w\).

When zero values are present in the table, a continuity correction (increasing the frequencies by 0.5) is applied to both the observed and the expected frequencies.

Hypotheses:

\(\begin{array}{cl} \mathcal{H}_0: & OR_{MH} = 1, \\ \mathcal{H}_1: & OR_{MH} \ne 1. \end{array}\)

Formulas:
The test statistic is defined by:

\[ \chi^2_{MH}=\frac{\left(\sum_{s=1}^wO_{11}^{(s)}-\sum_{s=1}^wE_{11}^{(s)}\right)^2}{V}, \]

where:
\(\displaystyle E_{11}^{(s)}=\frac{\left(O_{11}^{(s)}+O_{21}^{(s)}\right)\left(O_{11}^{(s)}+O_{12}^{(s)}\right)}{n^{(s)}}\) are the expected frequencies in the first cell of the contingency table, for the individual strata \(s=1,2,...,w\),
\(\displaystyle V=\sum_{s=1}^wV^{(s)}\),
\(\displaystyle V^{(s)}=\frac{\left(O_{11}^{(s)}+O_{12}^{(s)}\right)\left(O_{21}^{(s)}+O_{22}^{(s)}\right)\left(O_{11}^{(s)}+O_{21}^{(s)}\right)\left(O_{12}^{(s)}+O_{22}^{(s)}\right)}{\left(n^{(s)}\right)^2\left(n^{(s)}-1\right)}\).

This statistic asymptotically (for large sample sizes) has the \(\chi^2\) distribution with one degree of freedom.

The \(p\) value, determined on the basis of the test statistic, is compared with the significance level \(\alpha\): if \(p \le \alpha\), we reject \(\mathcal{H}_0\) in favor of \(\mathcal{H}_1\); if \(p > \alpha\), there is no reason to reject \(\mathcal{H}_0\).

The \(\chi^2\) test of homogeneity for \(OR\)
The \(\chi^2\) test of homogeneity for \(OR\) is used to verify the hypothesis that the variable forming the strata is an effect modifier, i.e. that it affects the calculated odds ratio in such a way that it is significantly different across the individual strata.

Hypotheses:

\[\begin{array}{cl} \mathcal{H}_0: & OR_{MH} = OR^{(s)}, \text{ for all strata }s=1,2,...,w\text{,} \\ \mathcal{H}_1: & OR_{MH} \ne OR^{(s)}, \text{ for at least one stratum.} \end{array}\]

Formulas:
The test statistic (Breslow-Day (1980)[26], Tarone (1985)[27][162]) is defined by:

\[ \chi^2=\sum_{s=1}^w\frac{\left(O_{11}^{(s)}-E^{(s)}\right)^2}{Var^{(s)}}-\frac{\left(\sum_{s=1}^wO_{11}^{(s)}-\sum_{s=1}^wE^{(s)}\right)^2}{\sum_{s=1}^wVar^{(s)}} \]

where \(E^{(s)}\) is the solution of the quadratic equation:
\(\displaystyle\frac{E^{(s)}\left(O_{22}^{(s)}-O_{11}^{(s)}+E^{(s)}\right)}{\left(O_{11}^{(s)}+O_{21}^{(s)}-E^{(s)}\right)\left(O_{11}^{(s)}+O_{12}^{(s)}-E^{(s)}\right)}=OR_{MH}\),
\(Var^{(s)}=\left(\frac{1}{E^{(s)}}+\frac{1}{O_{22}^{(s)}-O_{11}^{(s)}+E^{(s)}}+\frac{1}{O_{11}^{(s)}+O_{21}^{(s)}-E^{(s)}}+\frac{1}{O_{11}^{(s)}+O_{12}^{(s)}-E^{(s)}}\right)^{-1}\).

This statistic asymptotically (for large sample sizes) has the \(\chi^2\) distribution with \(df=w-1\) degrees of freedom.

The \(p\) value, determined on the basis of the test statistic, is compared with the significance level \(\alpha\): if \(p \le \alpha\), we reject \(\mathcal{H}_0\) in favor of \(\mathcal{H}_1\); if \(p > \alpha\), there is no reason to reject \(\mathcal{H}_0\).

The Mantel-Haenszel relative risk

When to use:

If all the tables (formed by the individual strata) are homogeneous, a pooled relative risk, together with confidence intervals, can be determined on the basis of these tables. This relative risk is a weighted mean of the values of relative risk determined for the individual strata, taking into account the contribution (weight) each stratum makes to the pooled relative risk.

As with the odds ratio, two significance tests accompany the relative risk determined this way. The Mantel-Haenszel \(\chi^2\) test for \(RR_{MH}\) checks whether the pooled relative risk differs significantly from 1. The \(\chi^2\) test of homogeneity for \(RR\), in turn, checks whether the relative risk is similar across all the strata, or whether the variable forming the strata significantly modifies its value (in which case pooling the strata into a single common relative risk would not be justified).

Definitions of measures

The Mantel-Haenszel relative risk – a weighted mean of the values of relative risk determined for the individual strata, taking into account the size of each stratum.

Performing and interpreting the analysis

The performance and interpretation are analogous to the Mantel-Haenszel odds ratio – see Example 1 above: before reading off the pooled relative risk, we check the \(\chi^2\) test of homogeneity for \(RR\), and we confirm its statistical significance with the Mantel-Haenszel \(\chi^2\) test for \(RR_{MH}\).

FOR THOSE INTERESTED

Formulas:
Weights for each stratum are determined according to the formula:

\[ g^{(s)}=\frac{O_{21}^{(s)}\left(O_{11}^{(s)}+O_{12}^{(s)}\right)}{n^{(s)}}, \]

and the Mantel-Haenszel relative risk:

\[ RR_{MH}=\frac{R}{S}, \]

where:
\(\displaystyle R=\sum_{s=1}^w\frac{O_{11}^{(s)}\left(O_{21}^{(s)}+O_{22}^{(s)}\right)}{n^{(s)}}\),
\(\displaystyle S=\sum_{s=1}^wg^{(s)}\).

The confidence interval for \(\log RR_{MH}\) is determined on the basis of the standard error calculated using the formula:

\[ SE_{MH}=\sqrt{\frac{V}{RS}}, \]

where:
\(\displaystyle V=\sum_{s=1}^wV^{(s)}\),
\(\displaystyle V^{(s)}=\frac{\left(O_{11}^{(s)}+O_{12}^{(s)}\right)\left(O_{21}^{(s)}+O_{22}^{(s)}\right)\left(O_{11}^{(s)}+O_{21}^{(s)}\right)-\left(O_{11}^{(s)}*O_{21}^{(s)}*n^{(s)}\right)}{\left(n^{(s)}\right)^2}\).

The Mantel-Haenszel \(\chi^2\) test for \(RR_{MH}\)
The Mantel-Haenszel \(\chi^2\) test is used to verify the hypothesis of the significance of the calculated relative risk (\(RR_{MH}\)), and should be calculated with large sample sizes in the contingency table.

Hypotheses:

\(\begin{array}{cl} \mathcal{H}_0: & RR_{MH} = 1, \\ \mathcal{H}_1: & RR_{MH} \ne 1. \end{array}\)

Formulas:
The test statistic is defined by:

\[ \chi^2_{MH}=\frac{\left(\sum_{s=1}^wO_{11}^{(s)}-\sum_{s=1}^wE_{11}^{(s)}\right)^2}{V}, \]

where \(E_{11}^{(s)}=\frac{\left(O_{11}^{(s)}+O_{21}^{(s)}\right)\left(O_{11}^{(s)}+O_{12}^{(s)}\right)}{n^{(s)}}\) are the expected frequencies in the first cell of the contingency table, for the individual strata \(s=1,2,...,w\).

This statistic asymptotically (for large sample sizes) has the \(\chi^2\) distribution with one degree of freedom.

The \(p\) value, determined on the basis of the test statistic, is compared with the significance level \(\alpha\): if \(p \le \alpha\), we reject \(\mathcal{H}_0\) in favor of \(\mathcal{H}_1\); if \(p > \alpha\), there is no reason to reject \(\mathcal{H}_0\).

The \(\chi^2\) test of homogeneity for \(RR\)
The \(\chi^2\) test of homogeneity for \(RR\) is used to verify the hypothesis that the variable forming the strata is an effect modifier, i.e. that it affects the calculated relative risk in such a way that it is significantly different across the individual strata.

Hypotheses:

\[\begin{array}{cl} \mathcal{H}_0: & RR_{MH} = RR^{(s)}, \text{ for all strata }s=1,2,...,w\text{,} \\ \mathcal{H}_1: & RR_{MH} \ne RR^{(s)}, \text{ for at least one stratum.} \end{array}\]

Formulas:
The test statistic, based on the weighted least-squares method, is defined by:

\[ \chi^2=\sum_{s=1}^w v^{(s)}\left(\ln(RR^{(s)})-\ln(RR_{MH})\right)^2 \]

where:
\(v^{(s)}=\left(\frac{O_{12}^{(s)}}{O_{11}^{(s)}\left(O_{11}^{(s)}+O_{12}^{(s)}\right)}+\frac{O_{22}^{(s)}}{O_{21}^{(s)}\left(O_{21}^{(s)}+O_{22}^{(s)}\right)}\right)^{-1}\).

This statistic asymptotically (for large sample sizes) has the \(\chi^2\) distribution with \(df=w-1\) degrees of freedom.

The \(p\) value, determined on the basis of the test statistic, is compared with the significance level \(\alpha\): if \(p \le \alpha\), we reject \(\mathcal{H}_0\) in favor of \(\mathcal{H}_1\); if \(p > \alpha\), there is no reason to reject \(\mathcal{H}_0\).