UCBAdmissions 問題是經典的統計學問題，清楚說明何謂 Simpson's Paradox 。這 dataset 是柏克萊大學 73 年的入學統計，是男女申請人的取錄比率。

```# Chainsaw Riot http://www.chainsawriot.com k22 problem
# pooled 2x2 table and pooled odds ratio
apply(UCBAdmissions, c(2, 1), sum)
fisher.test(apply(UCBAdmissions, c(2, 1), sum))

# stratum-specific odds ratio
apply(UCBAdmissions, 3, function(x) fisher.test(x)\$estimate)
# stratum-specific admission rate and gender prevalence
# meta-analysis using metafor
require(metafor)
meta.obj <- rma.mh(ai = UCBAdmissions[1, 1, ], bi = UCBAdmissions[1, 2, ], ci = UCBAdmissions[2, 1, ],
di = UCBAdmissions[2, 2, ], slab = letters[1:6])
meta.obj
plot(meta.obj)
#loglinear model
require(MASS) #built-in
summary(fm.loglm) # Dept * Admit * Gender are significant in some cases
```

```        Admit
Male       1198     1493
Female      557     1278
```

```        A         B         C         D         E         F
0.3495628 0.8028124 1.1329004 0.9213798 1.2211852 0.8280944
```

```          Dept
Admit              A         B         C         D         E          F
Admitted 0.6441586 0.4030501 0.5513699 0.2883173 0.1601307 0.07876712
Rejected 0.5675214 0.2714646 0.8347339 0.8940171 0.5517677 0.93557423

Dept
Gender           A          B         C         D         E         F
Male   0.8842444 0.61002179 0.5565068 0.4469453 0.2080610 0.6386986
Female 0.1846154 0.03156566 0.8305322 0.6410256 0.4962121 0.4775910

```