Testing Independence based on Contingency Table Data

Testing Independence based on Contingency Table Data

To test the relationship between two categorical variables, we use a contingency table and a test of independence based on a chi-square distribution. The test statistic is calculated as follows:

$$
\chi^{2}=\sum_{i=1}^{m} \frac{\left(O_{i j}-E_{i j}\right)^{2}}{E_{i j}}
$$

Where :

\(E_{i j}=\frac{(\text { Total row } i) \times(\text { Total column } j)}{\text { Overall total }}\)

\(m\) = Number of cells in the table, the number of groups in the first class, multiplied by the number of groups in the second class.

\(O_{i j}\) = Number of observations in each cell of row i and column j (i.e., observed frequency).

\(E_{i j}\) = Expected number of observations in each cell of row i and column j, assuming independence (i.e., expected frequency).

The degrees of freedom is given by:

$$\text{Degrees of freedom} = (r-1)(c-1)$$

Where:

\(r\) = Number of rows.

\(c\) = Number of columns.

Example: Testing Independence Based on Contingency Table Data

The following contingency table shows the responses of two categories of investors (employed vs. retired) with regard to their primary investment objectives (growth, income, or both). The total sample size is 173.

$$
\begin{array}{l|c|c|c|c} 
{} & \textbf { Growth } & \textbf { Income } & \textbf { Both } & \textbf { Total } \\
\hline \text { Employed } & 52 & 25 & 10 & 87 \\
\hline \text { Retired } & 32 & 47 & 7 & 86 \\
\hline\textbf{ Total } & 84 & 72 & 17 & 173 \\
\end{array}
$$

Use a 95% significance level to test whether there is any significant difference between employed and retired investors with regard to primary investment objectives.   

Solution

\(H_0\): There is no significant difference between employed and retired investors with regard to primary investment objectives.

\(H_α\): There is a significant difference between employed and retired investors with regard to primary investment objectives.

Step 1: We calculate the expected frequency of investors by their category (employed vs. retired) and investment objective using the following formula:

$$ E_{i j}=\frac{(\text { Total row } i) \times(\text { Total column } j)}{\text { Overall total }} $$

$$\begin{array}{l|c|c|c}
{} & \textbf { Growth } & \textbf { Income } & \textbf { Both } \\
\hline \text { Employed } & \frac{\left(87\times 84\right)}{173}=42 & \frac{\left(87\times 72\right)}{ 173}=36 & \frac{\left(87\times 17\right)}{173}=9 \\
\hline \text { Retired } & \frac{\left(86\times 84\right)}{173}=42 & \frac{\left(86\times 72\right)}{173}=36 & \frac{\left(86\times 17\right)}{ 173}=8 \\ \hline \textbf { Total } & \mathbf{8 4} & \mathbf{7 2} & \mathbf{1 7} \\
 \end{array} $$

Step 2: We calculate the scaled squared deviation for each combination of investor category and investment objective as follows:

$$ \begin{array}{l|c|c|c}
 & \textbf { Growth } & \textbf { Income } & \textbf { Both } \\
\hline \text { Employed } & \frac{(52-42)^{2}}{ 42}=2.254 & \frac{(25-36)^ 2}{ 36}=0.469 & \frac{(10-9)^2}{9}=0.246 \\
\hline \text { Retired } & \frac{(32-42)^{2}}{42}=2.280 & \frac{(47-36)^2}{36}=3.510 & \frac{(7-8)^2}{8}=0.249\\
\hline \textbf { Total } & 4.534 & 6.979 & 0.495 \\
\end{array} $$

Step 3: We calculate the value of \(X^2  = 4.532 + 6.976 + 0.494 = 12.002\).

$$ \chi^2=4.534+6.979+0.495=12.008 $$ 

Step 4: The critical value of \(X^2\) is 5.99. It is determined using the following:

  • There are \((r − 1)(c − 1) = (2 − 1) × (3 − 1) = 2\) degrees of freedom.
  • It is a one-sided test with a 5% level of significance.

 

Decision rule: The calculated value of \(\chi^2 =12.008\) is greater than the critical value of 5.99. As such, there is sufficient evidence to support the conclusion that retired investors and employed investors have different primary investment objectives. 

Shop CFA® Exam Prep

Offered by AnalystPrep

Featured Shop FRM® Exam Prep Learn with Us

    Subscribe to our newsletter and keep up with the latest and greatest tips for success

    Shop Actuarial Exams Prep Shop Graduate Admission Exam Prep


    Sergio Torrico
    Sergio Torrico
    2021-07-23
    Excelente para el FRM 2 Escribo esta revisión en español para los hispanohablantes, soy de Bolivia, y utilicé AnalystPrep para dudas y consultas sobre mi preparación para el FRM nivel 2 (lo tomé una sola vez y aprobé muy bien), siempre tuve un soporte claro, directo y rápido, el material sale rápido cuando hay cambios en el temario de GARP, y los ejercicios y exámenes son muy útiles para practicar.
    diana
    diana
    2021-07-17
    So helpful. I have been using the videos to prepare for the CFA Level II exam. The videos signpost the reading contents, explain the concepts and provide additional context for specific concepts. The fun light-hearted analogies are also a welcome break to some very dry content. I usually watch the videos before going into more in-depth reading and they are a good way to avoid being overwhelmed by the sheer volume of content when you look at the readings.
    Kriti Dhawan
    Kriti Dhawan
    2021-07-16
    A great curriculum provider. James sir explains the concept so well that rather than memorising it, you tend to intuitively understand and absorb them. Thank you ! Grateful I saw this at the right time for my CFA prep.
    nikhil kumar
    nikhil kumar
    2021-06-28
    Very well explained and gives a great insight about topics in a very short time. Glad to have found Professor Forjan's lectures.
    Marwan
    Marwan
    2021-06-22
    Great support throughout the course by the team, did not feel neglected
    Benjamin anonymous
    Benjamin anonymous
    2021-05-10
    I loved using AnalystPrep for FRM. QBank is huge, videos are great. Would recommend to a friend
    Daniel Glyn
    Daniel Glyn
    2021-03-24
    I have finished my FRM1 thanks to AnalystPrep. And now using AnalystPrep for my FRM2 preparation. Professor Forjan is brilliant. He gives such good explanations and analogies. And more than anything makes learning fun. A big thank you to Analystprep and Professor Forjan. 5 stars all the way!
    michael walshe
    michael walshe
    2021-03-18
    Professor James' videos are excellent for understanding the underlying theories behind financial engineering / financial analysis. The AnalystPrep videos were better than any of the others that I searched through on YouTube for providing a clear explanation of some concepts, such as Portfolio theory, CAPM, and Arbitrage Pricing theory. Watching these cleared up many of the unclarities I had in my head. Highly recommended.