-
Notifications
You must be signed in to change notification settings - Fork 0
/
_CompareProportions.Rmd
38 lines (22 loc) · 990 Bytes
/
_CompareProportions.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Compare Proportions
```
{r eval=FALSE, include=FALSE, echo=TRUE}
prop.test(numerator,denominator)
```
```
{r eval=FALSE, include=FALSE, echo=TRUE}
table(impetigo = scabies$impetigo_active, scabies = scabies$scabies_infestation)
# dependent ~ independent
```
```
{r eval=FALSE, include=FALSE, echo=TRUE}
#See that because 'no' is the 'base' level the table is laid out
# No Disease Has Disease
# Not-exposed
# Exposed
#This is dependent on how your data is coded so you need to check this before using epi.2by2
#If the table is laid out correctly then you can input straight into epi.2by2, otherwise you #need to recode or re-order the variables so that the table will be laid out correctly
#epi.2by2 wants the data with the exposed/disease group in top right corner
#So we just tell R to order the variables differently when we draw the table
epiR::epi.2by2(table(relevel(scabies$scabies_infestation, yes ), relevel(scabies$impetigo_active, yes )))
```