Home > Priors > Constructing a prior in a 2 x 2 table

## Constructing a prior in a 2 x 2 table

\begin{table}[ht]
\begin{center}
\begin{tabular}{rrr}
\hline
& (0,21] & (21,100] \\
\hline
(0,3] & 711 & 310 \\
(3,10] & 783 & 745 \\
\hline
\end{tabular}
\end{center}
\end{table}

At BGSU, all freshmen take a mathematics placement test and the results of the test, together with some other information, is used to advise students on the appropriate first math class to take.

The other information consists of the student’s score on the ACT Math exam and his/her high school grade point average, or GPA.  We are interested in examining the relationship between the GPA and the ACT Math score.

For the student taking Form B of the math placement exam, 63% of the students have a GPA over 3.0.    Suppose you categorize these students into two groups, those who have scored  21 or less on the ACT exam, and those who have scored over 21 on the ACT.

GPA <= 3.0  GPA > 3.0
ACT <=21      p1                  1 – p1
ACT > 21        p2                  1 – p2

How do we construct a prior on the proportions p1 and p2?    Let’s step through the process.

1.  Here it doesn’t make any sense to assign p1 and p2 independent distributions.  If I thought that if student probability of getting a low GPA is 0.37 and then you told me that the student scored low on the ACT exam, then I would think it is more likely that the student gets a low GPA.  That is, I would think the student’s chance of getting a  GPA <= 3.0 would be higher than 0.37.  Clearly, p1 and p2 should have a dependent prior.

2.  A popular way of expressing the relationship between p1 and p2 is by use of a log odds-ratio.  Let T1 = log (p1/(1-p1)) be the log odds of  p1, and let T2 = log(p2/(1-p2)) be the log odds of p2.  A log odds converts a proportion (between 0 and 1) to a real-valued quantity.  A proportion of 0.5 corresponds to a log odds of 0, a probability less than 0.5 corresponds to a negative odds ratio, and so on.  Then one compares the proportions by means of the difference in log odds, or the log odds ratio

$\theta_1 = \log \frac{p_1}{1-p_1} - \log \frac{p_2}{1-p_2} = \log \frac{p_1/(1-p_1)}{p_2/(1-p_2)}$.

3.  Suppose we transform the proportions $p_1$ and $p_2$ to the log odds ratio $\theta_1$ and the sum of log odds (or logits)

$\theta_2= \log \frac{p_1}{1-p_1} + \log \frac{p_2}{1-p_2}$,

and place independent priors on $\theta_1$ and $\theta_2$.

4.  Let’s illustrate using this prior.  I assume $\theta_1$ and $\theta_2$ are independent with

$\theta_1 \sim N(0.5, 0.3)$, $\theta_2 \sim N(0, 2)$.

The prior says that (1) I don’t know much about the sizes of the proportions (a vague prior placed on $\theta_2$), but (2) I believe that a larger proportion of the “low ACT” students will have low GPAs than the “high ACT students” (an informative prior placed on $\theta_1$).

5.  This prior induces a dependent prior on $p_1$ and $p_2$.  This is easy to illustrate using R.  First I’ll simulate 1000 draws from the posterior of $\theta_1$ and $\theta_2$ and transform these values back to the proportions $p_1$ and $p_2$.  I construct a scatterplot of ($p_1, p_2$) and put the line $p_2 = p_1$ on top.  This clearly shows the dependence in the prior and it reflects the belief that $p_1 > p_2$.

theta1=rnorm(1000,0.5,.3)
theta2=rnorm(1000,0,2)
logitp1 = (theta1 + theta2)/2
logitp2 = (theta2 – theta1)/2
p1=exp(logitp1)/(1+exp(logitp1))
p2=exp(logitp2)/(1+exp(logitp2))
plot(p1,p2,pch=19,col=”red”)
abline(0,1,lwd=3)