10.8 Estimating \(2\times 2\) Contingency Table
To estimate the table for attribute \(k\), we need to know \(P(\alpha_{ik}=a|\mathbf{y}_i)\) and \(I(\hat{\alpha}_{ik}=b|\mathbf{y}_i)\). Let us take student 8 as an example. Run the following code:
Code
## A1 A2 A3
## 0.0041 0.4801 0.9648
Recall that \[ \hat{p}_{00}=\frac{1}{n}\sum_{i=1}^nP(\alpha_{ik}=0|\mathbf{y}_i)I(\hat{\alpha}_{ik}=0|\mathbf{y}_i) \] Verify that for attribute 1 (i.e., \(k=1\)) and student 8 (i.e., \(i=8\)), \(I(\hat{\alpha}_{ik}=0|\mathbf{y}_i)=1\) and \(P(\alpha_{ik}=0|\mathbf{y}_i)=\) 0.9959
EXERCISES
- Write your code to estimate \(p_{00}\) and \(p_{11}\) for attribute 1.
- Compare the classification accuracy of attribute 1 from the analytic solution with the one from Monte Carlo approach.