PROJECTENGRAM

CONTINGENCY TABLE

Tags: #◇Computer Science #◇STT101A #◇Conceptual #◇Contingency Table


◇Overview

A Contingency Table (two-way cross-tabulation table) organizes bivariate categorical counts or probabilities across rr rows (levels of variable AA) and cc columns (levels of variable BB). It allows immediate extraction of joint, marginal, and conditional probabilities.

◇Key Definitions

  • Joint Probability (P(Ai∩Bj)P(A_i \cap B_j)): Probability in interior cell (i,j)(i, j), computed as nijN\frac{n_{ij}}{N} where NN is the grand total.
  • Marginal Probability (P(Ai)P(A_i) or P(Bj)P(B_j)): Row total ni⋅N=∑jP(Ai∩Bj)\frac{n_{i\cdot}}{N} = \sum_j P(A_i \cap B_j) or column total n⋅jN=∑iP(Ai∩Bj)\frac{n_{\cdot j}}{N} = \sum_i P(A_i \cap B_j) along the margins.
  • Conditional Probability (P(Ai∣Bj)P(A_i \mid B_j)): Interior cell divided by its corresponding column (or row) marginal total: P(Ai∣Bj)=nijn⋅j=P(Ai∩Bj)P(Bj)P(A_i \mid B_j) = \frac{n_{ij}}{n_{\cdot j}} = \frac{P(A_i \cap B_j)}{P(B_j)}.

◇Worked Example

Traffic TypeFlagged (FF)Passed (FcF^c)Row Total
Malicious (MM)90901010100100
Benign (McM^c)6060840840900900
Column Total15015085085010001000
  • Joint: P(M∩F)=901000=0.09P(M \cap F) = \frac{90}{1000} = 0.09.
  • Marginal: P(F)=1501000=0.15P(F) = \frac{150}{1000} = 0.15.
  • Conditional: P(M∣F)=90150=0.60P(M \mid F) = \frac{90}{150} = 0.60.

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

In a contingency table with grand total NN, how is a joint probability P(Ai∩Bj)P(A_i \cap B_j) calculated?

Q2

Using the worked example table (N=1000N = 1000), what is the conditional probability P(F∣Mc)P(F \mid M^c) that a benign packet is flagged?

Q3

Why are the row and column totals in a two-way table called marginal distributions?

Q4

How can you test whether row event AiA_i and column event BjB_j are statistically independent directly from a contingency table of counts?

Q5

Using the worked example table (N=1000N = 1000), what is P(M∪F)P(M \cup F)?