Chi-squared statistic of a two-by-two report table with expected counts from its margins

Compares each observed report count with the count expected if drug and event were independent, taken from the table as row total times column total over the grand total, and adds the squared gaps scaled by the expected counts. The summation has the form of HE-FM-CHISQ-007, whose E_j are model predictions for calibration targets (HE-VR-CHISQ-022), while E here comes from the margins of the table. The table has one degree of freedom (derived), which links the statistic to HE-FM-CHISQ-005. X2_Y is the Yates-corrected form, which takes 0.5 off the absolute gap in each cell, floored at zero; the absolute gap is the same in all four cells, so one Y serves them all. Both forms appear in published accounts of the signal criteria, so a reported value names the form used.

Signature

N = a + b + c + d; E_a = (a + b) * (a + c) / N; E_b = (a + b) * (b + d) / N; E_c = (c + d) * (a + c) / N; E_d = (c + d) * (b + d) / N; X2 = (a - E_a)^2 / E_a + (b - E_b)^2 / E_b + (c - E_c)^2 / E_c + (d - E_d)^2 / E_d; Y = max(0, abs(a - E_a) - 0.5); X2_Y = Y^2 / E_a + Y^2 / E_b + Y^2 / E_c + Y^2 / E_d
Inputs
InputsDefinitionUnit
aNumber of reports of the event of interest for the drugreports
bNumber of all other reports for the drugreports
cNumber of reports of the event of interest for all other drugsreports
dNumber of all other reports for all other drugsreports
Output
NTotal number of reports in the table, a + b + c + d, above zeroreports
E_aCount expected in cell a if drug and event were independent, (a + b)(a + c) / N, above zeroreports
E_bCount expected in cell b if drug and event were independent, (a + b)(b + d) / N, above zeroreports
E_cCount expected in cell c if drug and event were independent, (c + d)(a + c) / N, above zeroreports
E_dCount expected in cell d if drug and event were independent, (c + d)(b + d) / N, above zeroreports
X2Pearson statistic over the four cells of the report table, without a continuity correctionnone
YAbsolute gap between a and E_a less 0.5, floored at zeroreports
X2_YPearson statistic over the four cells with the continuity correction of 0.5 applied to each absolute gapnone

Function

Disproportionate reporting screen of one drug and event pair in a spontaneous report database

Maps the four report counts of a two-by-two table for one drug and one event to the proportional reporting ratio, a chi-squared statistic on the same table and a flag under the minimum criteria of Evans and colleagues. The ratio has the form of HE-FM-PR-001, whose counts are people in a cross-sectional sample, while these counts are reports with no count of the patients exposed, so the output shows where to look and gives no probability of harm. Event probabilities, costs and QALY losses for a model stay with HE-FN-AER-001 and need a source with a known denominator. The naive reporting rate in the article has the form P = n / N of HE-FM-AER-001, and its correction by a reporting fraction takes the form of HE-FM-CRV-001 with a equal to the rate, Sp equal to 1 and Se equal to the fraction (derived), so neither is restated. Notation follows the Adverse Event Reporting article.

Try this function

Implementations

  • Excel

    Chi-squared statistics of a report table from named cells

    With the counts in ChiCountEventDrug (a), ChiCountOtherDrug (b), ChiCountEventOthers (c) and ChiCountOtherOthers (d), the formulas go in cells named ReportsTotal, ExpectedEventDrug, ExpectedOtherDrug, ExpectedEventOthers, ExpectedOtherOthers, ChiSquaredReports, YatesGap and ChiSquaredYatesReports, in that order. A blank count is treated as 0. A row or column whose total is 0 makes an expected count 0, and ChiSquaredReports then returns #DIV/0!.

    =ChiCountEventDrug+ChiCountOtherDrug+ChiCountEventOthers+ChiCountOtherOthers; =(ChiCountEventDrug+ChiCountOtherDrug)*(ChiCountEventDrug+ChiCountEventOthers)/ReportsTotal; =(ChiCountEventDrug+ChiCountOtherDrug)*(ChiCountOtherDrug+ChiCountOtherOthers)/ReportsTotal; =(ChiCountEventOthers+ChiCountOtherOthers)*(ChiCountEventDrug+ChiCountEventOthers)/ReportsTotal; =(ChiCountEventOthers+ChiCountOtherOthers)*(ChiCountOtherDrug+ChiCountOtherOthers)/ReportsTotal; =(ChiCountEventDrug-ExpectedEventDrug)^2/ExpectedEventDrug+(ChiCountOtherDrug-ExpectedOtherDrug)^2/ExpectedOtherDrug+(ChiCountEventOthers-ExpectedEventOthers)^2/ExpectedEventOthers+(ChiCountOtherOthers-ExpectedOtherOthers)^2/ExpectedOtherOthers; =MAX(0,ABS(ChiCountEventDrug-ExpectedEventDrug)-0.5); =YatesGap^2*(1/ExpectedEventDrug+1/ExpectedOtherDrug+1/ExpectedEventOthers+1/ExpectedOtherOthers)

Assumptions

  • All four margins of the report table above zero

    Every row and column total is above zero, so that all four expected counts are above zero and the divisions can be done. The cells are the counts of HE-FM-AER2-001 from the same table.

  • Chi-squared approximation is inexact at low counts in a report table

    EMA 2008 footnote 3 calls the statistic an inexact test, says an exact test should be performed in certain situations, particularly when cell counts are low, and adds that distributional assumptions cannot be reliably adopted and checked for spontaneous report data. The statistic here is a screening quantity. Low expected counts, as in several examples below, do not stop the arithmetic, and they weaken any reading of the value as a tail probability.

Worked examples

  • Chi-squared cell sum reproducing the EMA static table

    With the counts of EMA 2008 Table 3 the expected counts are 3.7770, 2,426.2230, 250.2230 and 160,736.7770 and the cell components 0.1598, 0.0002, 0.0024 and 0.0000, as printed there, summing to 0.1625. The uncorrected form reproduces the table; the Yates form gives about 0.0206, which shows that the table is uncorrected (derived).

    a = 3; b = 2427; c = 251; d = 160736; N = 163417; E_a = 3.7770; E_b = 2426.2230; E_c = 250.2230; E_d = 160736.7770; X2 = 0.1625; Y = 0.2770; X2_Y = 0.0206
  • Chi-squared statistic for the EMA example with a ratio of 3

    For the counts of EMA 2008 Example 2 the expected count in cell a is about 5.01 against 15 observed, and the statistic is about 20.99 uncorrected and 18.94 corrected (computed here; EMA prints no statistic for this example).

    a = 15; b = 85; c = 5000; d = 95000; N = 100100; E_a = 5.01; E_b = 94.99; E_c = 5009.99; E_d = 94990.01; X2 = 20.99; Y = 9.49; X2_Y = 18.94
  • Illustrative report table where the Yates correction crosses a value of 4

    An illustrative table with 3 of 50 reports for the drug and 2,000 of 100,000 for other drugs has an expected count of about 1.00 in cell a. The uncorrected statistic is about 4.08 and the corrected one about 2.29, on opposite sides of 4.

    a = 3; b = 47; c = 2000; d = 98000; N = 100050; E_a = 1.001; E_b = 48.999; E_c = 2001.999; E_d = 97998.001; X2 = 4.08; Y = 1.499; X2_Y = 2.29
  • Chi-squared statistic of zero when the report shares are equal

    For the counts of EMA 2008 Example 1 the shares are equal, every observed count equals its expected count and both forms return 0. The floor in Y holds the corrected form at 0, which checks an implementation at this limiting case.

    a = 5; b = 95; c = 5000; d = 95000; N = 100100; E_a = 5; E_b = 95; E_c = 5000; E_d = 95000; X2 = 0; Y = 0; X2_Y = 0

Common errors

  • Comparing uncorrected and Yates-corrected chi-squared values with one threshold

    The two forms can fall on opposite sides of a threshold. In the illustrative table with 3, 47, 2,000 and 98,000 reports the uncorrected value is about 4.08 and the corrected value about 2.29, so the same pair passes a threshold of 4 on one form and fails on the other. Results from two systems are compared only after checking which form each uses.

  • Reading the chi-squared value of a report table as the size of the disproportion

    The statistic grows with the counts while the ratio does not. A table with 3, 37, 3,000 and 97,000 reports and one with 6, 74, 6,000 and 194,000 both have a PRR of 2.5, and the statistic doubles from about 2.78 to about 5.56 (derived; multiplying all four cells by a constant multiplies the uncorrected statistic by that constant). The value measures how far the counts are from independence given their size, and the PRR measures the size of the gap in shares.

  • Reading a chi-squared value of 4 as a formal five per cent test

    On one degree of freedom a value of 4 has a tail probability of about 0.0455 under the chi-square distribution (derived with HE-FM-CHISQ-005). EMA 2008 section 4.5 says disproportionality analysis is not an inferential exercise. If the approximation held, about 46 of 1,000 illustrative pairs with no association would reach 4 by chance (derived), so a value at the threshold is a prompt to look and carries no significance claim.

Sources

  • EMA 2008 on the chi-square statistic and its cell components

    European Medicines Agency. Guideline on the use of statistical signal detection methods in the EudraVigilance data analysis system. Doc. Ref. EMEA/106464/2006 rev. 1. London; 26 June 2008. Section 4.4 and its footnote 3 (a test of independence of categorical variables, inexact at low cell counts); section 5.2.2 Table 3 (the static table prints CHI^2 for each cell, their total of 0.1625 and the expected counts of cells A to D; the printed values reproduce as uncorrected Pearson components, checked here); section 4.5 (the analysis is not an inferential exercise).

    View source →

  • Oracle Empirica documentation on the chi-squared forms for a report table

    Oracle. Empirica documentation, release 9.2.2.1, user guide. PRR computations. Prints the expected counts as row total times column total over the grand total, the default chi-square as the sum over the four cells, and the Yates correction as the square of the absolute gap less 0.5, floored at zero, in each cell, with the note that the absolute gap is the same in all four cells. Its cells a, b, c and d are laid out differently from the article, and the records use the article's layout.

    View source →

  • Cutroneo and colleagues on the chi-square form with Yates's correction

    Cutroneo PM, Sartori D, Tuccori M, Crisafulli S, Battini V, Carnovale C, Rafaniello C, Capuano A, Poluzzi E, Moretti U, Raschi E. Conducting and interpreting disproportionality analyses derived from spontaneous reporting systems. Frontiers in Drug Safety and Regulation. 2024;3:1323057. Box 1, which lists the two-by-two table and, as a condition for a signal of disproportionate reporting, the chi-square statistic with Yates's correction with PRR at least 2, chi-square at least 4 and at least 3 reports.

    View source →

Canonical Identity

This formula is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).

Author: Dr Darrin Baines · Publisher: Intelligent Parameters Ltd · Identifier: https://healtheconomics.wiki/formula/chi-squared-statistic-of-a-two-by-two-report-table-with-expected-counts-from-its-margins