Learning Objectives
By the end of this note, you will classify independence questions on categorical variables, compute expected counts $E_{ij}=R_{i}C_{j}/n$, compute $\chi^{2}=\sum (O-E)^{2}/E$ with $\text{df}=(r-1)(c-1)$, and decide association with a BS 2081 Nepal example.
Why Independence Testing Matters in Public Administration
Many PA questions compare counts, not means. Is ward location associated with service satisfaction. Is training status associated with performance rating. Is province associated with scheme uptake. Each question cross classifies $n$ cases by two categorical variables into a contingency table. The chi square test of independence asks whether the observed cell counts follow the pattern expected when the two classifications are unrelated. A large departure suggests association that can redirect outreach, staffing, or budget in FY 2081/82.
Grouped Framework: Conditions, Expected Counts, and $\chi^{2}$
Condition 1: Two categorical variables in a contingency table. Organize data as $r$ rows and $c$ columns with cell counts $O_{ij}$ and marginal totals $R_{i}$, $C_{j}$, and grand total $n$. Examples: location $2\times2$, department $3\times2$, education $3\times3$. This test does not compare means or proportions directly, it compares count patterns.
Condition 2: Random sampling with adequate expected counts. Observations are independent and randomly selected. Every expected frequency should satisfy $E_{ij}\ge 5$, with at most 20 percent of cells below 5. If many cells fail, combine categories where sensible or use Fisher exact test for $2\times2$.
Condition 3: Hypotheses of no association.
\[H_{0}: \text{the two variables are independent}\quad\text{vs}\quad H_{1}: \text{the two variables are associated}\]Independence means row classification does not change column proportions and vice versa. Rejection signals dependence, not causation and not which cell drives the result.
Expected frequency under $H_{0}$. When independent, each cell share equals row share times column share:
\[E_{ij}=\frac{R_{i}\times C_{j}}{n}\]Intuition: if 50 percent of the sample is urban and 55 percent supports a policy, then about 27.5 percent of $n$ should fall in urban support when independent.
Test statistic.
\[\chi^{2}=\sum_{i=1}^{r}\sum_{j=1}^{c}\frac{(O_{ij}-E_{ij})^{2}}{E_{ij}}\]Large gaps between $O$ and $E$ inflate $\chi^{2}$. The sum is over all $r\times c$ cells.
Degrees of freedom and decision.
\[\text{df}=(r-1)(c-1)\]Under $H_{0}$ and adequate $E_{ij}$, $\chi^{2}$ follows chi square with that df. Reject $H_{0}$ when $\chi^{2}>\chi^{2*}_{\alpha,\text{df}}$ or when $p<\alpha$. Report $\chi^{2}$, df, and $p$ plus row percentages for magnitude.
Shortcut for $2\times2$. For table $\begin{pmatrix}a&b\c&d\end{pmatrix}$ with $n=a+b+c+d$,
\[\chi^{2}=\frac{n(ad-bc)^{2}}{(a+b)(c+d)(a+c)(b+d)},\quad \text{df}=1\]This gives the same result as $\sum (O-E)^{2}/E$ for $2\times2$.
Effect size. Complement $\chi^{2}$ with row percentages and, when useful, Cramer $V=\sqrt{\chi^{2}/(n(\min(r,c)-1))}$ between 0 and 1. Significance alone does not measure strength.
Worked Example: Service Channel and Satisfaction in BS 2081
Context. In Kartik 2081, Lalitpur Metropolitan City surveys $n=200$ service users on channel and satisfaction to decide whether to expand online counters in FY 2081/82. The citizen charter promises equal quality across channels. The question is whether satisfaction is associated with channel. Reallocating NPR 600000 for help desk staff depends on whether the association is real or sampling noise. Data:
| Channel | Satisfied | Neutral | Dissatisfied | Total |
|---|---|---|---|---|
| Online | 48 | 22 | 10 | 80 |
| Counter | 52 | 38 | 30 | 120 |
| Total | 100 | 60 | 40 | 200 |
Test at $\alpha=0.05$.
Step 1: Hypotheses.
\[H_{0}: \text{channel and satisfaction are independent}\quad H_{1}: \text{they are associated}\]Step 2: Expected counts. $E_{ij}=R_{i}C_{j}/n$:
- Online Satisfied $80\times100/200=40.0$
- Online Neutral $80\times60/200=24.0$
- Online Dissatisfied $80\times40/200=16.0$
- Counter Satisfied $120\times100/200=60.0$
- Counter Neutral $120\times60/200=36.0$
- Counter Dissatisfied $120\times40/200=24.0$
All $E_{ij}\ge 5$, so the chi square approximation is trusted.
Step 3: $\chi^{2}$.
\[\chi^{2}=\frac{(48-40)^{2}}{40}+\frac{(22-24)^{2}}{24}+\frac{(10-16)^{2}}{16}+\frac{(52-60)^{2}}{60}+\frac{(38-36)^{2}}{36}+\frac{(30-24)^{2}}{24}\] \[= \frac{64}{40}+\frac{4}{24}+\frac{36}{16}+\frac{64}{60}+\frac{4}{36}+\frac{36}{24}\approx 1.600+0.167+2.250+1.067+0.111+1.500\approx 6.69\]Step 4: Critical value and decision. $\text{df}=(2-1)(3-1)=2$, $\chi^{2*}{0.05,2}=5.991$. Since $6.69>5.991$, reject $H{0}$. Software $p\approx 0.035$.
Step 5: Practical reading. Row percentages clarify magnitude: online satisfied $48/80=60.0$ percent versus counter $52/120\approx 43.3$ percent, a 16.7 point gap. Dissatisfied is $12.5$ percent online versus $25.0$ percent at counter. Cramer $V=\sqrt{6.69/(200\times1)}\approx0.18$, a weak association. For the NPR 600000 decision, the evidence supports a channel difference but not a causal claim that online service alone raises satisfaction, because users self select into channels and rural connectivity differs.
Self-check
Try this (calculable): In Bhadra 2081, a Palika tests whether urban and rural residence is associated with opinion on a new waste fee. Survey $n=200$:
| Support | Oppose | Total | |
|---|---|---|---|
| Urban | 60 | 40 | 100 |
| Rural | 45 | 55 | 100 |
| Total | 105 | 95 | 200 |
Test $H_{0}$: opinion independent of residence at $\alpha=0.05$ two sided in the chi square sense.
(a) Compute each $E_{ij}=R_{i}C_{j}/n$. Show all four equal $52.5$ or $47.5$ as appropriate. (b) Compute $\chi^{2}=\sum(O-E)^{2}/E$. Verify $\chi^{2}\approx4.51$. (c) With $\text{df}=1$, critical $\chi^{2*}_{0.05,1}=3.841$, decide and state the association in percentage terms. Check with the $2\times2$ shortcut $n(ad-bc)^{2}/((a+b)(c+d)(a+c)(b+d))$ using $a=60,b=40,c=45,d=55$.
Answer: (a) Urban Support $100\times105/200=52.5$, Urban Oppose $47.5$, Rural Support $52.5$, Rural Oppose $47.5$. (b) $\chi^{2}= (7.5^{2}/52.5)+(7.5^{2}/47.5)+(7.5^{2}/52.5)+(7.5^{2}/47.5)\approx1.071+1.184+1.071+1.184=4.51$. (c) $4.51>3.841$, reject $H_{0}$, $p\approx0.034$. Urban support $60$ percent versus rural $45$ percent suggests association. Shortcut gives $200(60\times55-40\times45)^{2}/(100\times100\times105\times95)=4.51$, matching.
Check: explain why expected counts depend only on margins and why concluding causation would require controlling for income and ward level factors.
Summary
Test independence when two categorical variables cross classify counts. Under $H_{0}$, $E_{ij}=R_{i}C_{j}/n$, statistic $\chi^{2}=\sum(O-E)^{2}/E$ on $\text{df}=(r-1)(c-1)$, reject when $\chi^{2}>\chi^{2*}$. Use the $2\times2$ shortcut when handy and check $E_{ij}\ge 5$. Always pair the decision with row percentages and Cramer $V$ to show practical size in the Nepal FY 2081/82 context.
Key Takeaways
- Verify table type: independence uses $r\times c$ with two variables, not a single distribution against fixed shares.
- Compute $E_{ij}=R_{i}C_{j}/n$ for every cell and sum $\chi^{2}=\sum(O-E)^{2}/E$.
- Use $\text{df}=(r-1)(c-1)$, not $rc-1$ or $n-1$, and recall critical $3.841$ for df $1$ at $0.05$ and $5.991$ for df $2$.
- Check $E_{ij}\ge 5$ and report association strength with percentages and Cramer $V$, not only significance.
- Treat rejection as evidence of association, not proof of causation or identification of the driving cell without residual inspection.
Discussion
- A team enters column percentages into $\chi^{2}$ instead of counts. Why does this misstate $\sum(O-E)^{2}/E$, and how would converting to counts with $n=200$ repair it.
- Your $3\times2$ table gives $\chi^{2}=6.0$ with df $2$. How do you decide at $\alpha=0.05$ versus $0.01$, and what cost does raising $\alpha$ impose on false alarms for the NPR 600000 reallocation.
- After rejecting $H_{0}$ in a $3\times3$ table, why should you inspect row percentages or standardized residuals before naming which education or party cell drives the result.
Exercises
- Gender and online preference $n=200$: Male $70,30$, Female $50,50$, totals Online $120$ Offline $80$. Compute $E$, $\chi^{2}\approx8.33$, df $1$, critical $3.841$, decision at $0.05$.
- Age $3\times2$ with $n=300$: Young $80,20$, Middle $60,40$, Senior $40,60$, total Adopted $180$ Not $120$. Each row expected $60,40$, $\chi^{2}\approx33.33$, df $2$, critical at $0.01$ is $9.210$, decision.
- Training $2\times3$ with $n=160$: Trained $30,40,10$, Untrained $15,25,40$, totals $45,65,50$. Expected per row $22.5,32.5,25$, $\chi^{2}\approx26.46$, df $2$, critical $5.991$, interpretation for HR budget in BS 2081.
- Derive why $E_{ij}=R_{i}C_{j}/n$ follows from independence $P(\text{row }i\text{ and col }j)=P(\text{row }i)P(\text{col }j)$ and multiplying by $n$.
- For the Kartik 2081 example, compute Cramer $V$ and explain why $V\approx0.18$ tempers a headline that online users are more satisfied despite $p=0.035$.


