class: center, middle, inverse, title-slide .title[ # Stratified categorical data ] .author[ ### Yue Jiang ] .date[ ### Duke University ] --- ### Severe sepsis + septic shock <img src="img/ipd.jpg" width="80%" style="display: block; margin: auto;" /> --- ### Severe sepsis + septic shock | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 23 | 58 | 81 | | Untreated | 25 | 55 | 80 | | **Total** | 48 | 113 | 161 | .question[ Is there an association between treatment and mortality? ] --- ### Chi-square tests `\(H_0\)`: There is no association between treatment and mortality `\(H_1\)`: There is an association between treatment and mortality Under `\(H_0\)`, we have independence between treatment and mortality, implying that joint probabilities should be equal to products of marginal distributions: | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 23 | 58 | 81 | | Untreated | 25 | 55 | 80 | | **Total** | 48 | 113 | 161 | .question[ What counts might we expect under `\(H_0\)`? ] --- ### Chi-square tests The .vocab[chi-square test] compares the observed frequencies in each cell to the expected count under `\(H_0\)`; if the total differences are large enough, we reject `\(H_0\)`: $$ \chi^2 =\sum_{i=1}^{r\times c} \frac{(O_i-E_i)^2}{E_i}, $$ which has a `\(\chi^2_{(r-1) \times (c-1)}\)` distribution (under `\(H_0\)`). --- ### Odds ratios | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 23 | 58 | 81 | | Untreated | 25 | 55 | 80 | | **Total** | 48 | 113 | 161 | `\begin{align*} OR &= \frac{23\times 55}{58\times 25} \approx 0.872\\ \log(OR) &= \log\left(\frac{23\times 55}{58\times 25} \right) \approx -0.136\\ SE(log(OR)) &= \sqrt{\frac{1}{23} + \frac{1}{58} + \frac{1}{25} + \frac{1}{55}} \approx 0.345. \end{align*}` (Taylor expansions again) --- ### Odds ratios | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 23 | 58 | 81 | | Untreated | 25 | 55 | 80 | | **Total** | 48 | 113 | 161 | A 95% CI for the odds ratio is given by: `\begin{align*} \left\{e^{log(OR) - z^\star\times SE(log(OR))}, e^{log(OR) + z^\star\times SE(log(OR))}\right\} \end{align*}` --- ### Aside: Fisher's exact test The chi-square test relies on asymptotic results, which might not be appropriate if we have small cell counts (common rules of thumb are >5 or >10 observed in each cell). .vocab[Fisher's exact test] calculates an exact p-value under a specific distributional assumption. | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 23 | 58 | 81 | | Untreated | 25 | 55 | 80 | | **Total** | 48 | 113 | 161 | --- ### Aside: Fisher's exact test Fisher's exact test relies on the .vocab[hypergeometric distribution]. | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 23 | 58 | 81 | | Untreated | 25 | 55 | 80 | | **Total** | 48 | 113 | 161 | Conditionally on the margins (assumed fixed), then each of the individual cells is distributed according to the hypergeometric distribution. We can thus calculate the exact probabilities of obtaining specific *tables*. --- ### Aside: Fisher's exact test Another "possible" table: | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 22 | 59 | 81 | | Untreated | 26 | 54 | 80 | | **Total** | 48 | 113 | 161 | He is another table with the same margins, but with some slightly different potential cell counts. Fisher's exact test relies on constructing *all possible* contingency tables with the same margins, and then summing up probabilities of all tables as extreme or more extreme than the observed data. .question[ What might "more extreme" mean in the context of contingency tables? ] --- ### Aside: "Holding the margins fixed" | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 23 | 58 | 81 | | Untreated | 25 | 55 | 80 | | **Total** | 48 | 113 | 161 | .question[ How reasonable is it **in terms of design** that we hold *both* of these margins "fixed"? What about designs with only one held fixed, or none? Think back to how these data were collected. Which of the three exact tests would be the most appropriate? ] --- ### Aside: "Exact tests" .question[ Do you expect any of the three "exact" tests to achieve exactly the nominal type I error rate? If so, which? If not, why not, and do you expect the type I error rate to be lower or higher than `\(\alpha\)`? ] --- ### (Aside-ish?): Stratum-specific odds ratios | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 9 | 51 | 60 | | Untreated | 6 | 43 | 49 | | **Total** | 15 | 94 | 109 | | | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 14 | 7 | 21 | | Untreated | 19 | 12 | 31 | | **Total** | 33 | 19 | 52 | .question[ What are the stratum-specific odds ratios? What's going on? ] --- ### Combining strata | Older adults | Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 9 | 51 | 60 | | Untreated | 6 | 43 | 49 | | **Total** | 15 | 94 | 109 | | Younger adults| Alive | Dead | Total | | ------------- | -----: | -----:| ----: | | Treated | 14 | 7 | 21 | | Untreated | 19 | 12 | 31 | | **Total** | 33 | 19 | 52 | .question[ How would *you* combine odds ratios across the two strata to find the common odds ratio? ...what, implicitly, did was assumed in the last question? ]