Description Usage Arguments Details Author(s) References See Also Examples
tabodds
generates cross-tabulation between two variables and
display odds of failure var_case
against a categorical
explanatory variable var_exp
. It is used with cross-sectional
data.
1 2 3 4 5 6 7 8 9 |
var_exp |
Exposure variable. |
var_case |
Case or outcome variable should be binary vector. |
data |
a data frame object (Optional) |
na.rm |
A logical value to specify missing values, <NA> in the table |
rnd |
specify rounding of numbers. See |
plot |
logical value to display plots of rates across a categorical variable |
print.table |
logical value to display formatted outputs |
The variable var_case
should coded 1 for case and 0 for non-case.
A simple table illustrating cases and controls as well as odds for each
category is generated.
Calculating Odds
OR = d1 x h0 / d0 x h1
Error Factor (EF)
EF = exp(1.96 x SE(log odds))
SE(log odds) = √{1/d + 1/h}
Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)
1. Essential Medical Statistics, Betty R. Kirwood, Second Edition
2. Statistics Notes: The odds ratio; J Martin Bland, Douglas G Altman BMJ 2000;320:1468
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 32 33 34 35 36 37 38 39 | ## Not run:
## Asthma Example (page 160, Essential Medical Statistics)
asthma <- expandTables(c(81, 995, 57, 867),
exp_name = "Sex",
exp_lvl = c("Women", "Man"),
case_name = "Asthma",
case_lvl = c("Yes", "No"))
## labelling
asthma <- labelData(asthma, "Hypothetical Data of Asthma Prevalence")
asthma <- labelVars(asthma,
c(Sex, Asthma), c("Man or Woman", "Asthma or No Asthma"))
## Checking codebook
codebook(asthma)
## Odds
tabodds(Sex, Asthma, asthma)
## Odds ratios
mhodds(Sex, Asthma, asthma)
## The odds ratio, J Martin Bland, Douglas G Altman, BMJ 2000;320:1468
hay <- expandTables(c(141, 420, 928, 13525),
exp_name = "eczema",
exp_lvl = c("Yes", "No"),
case_name = "hayFever",
case_lvl = c("Yes", "No"))
hay <- labelData(hay, "hay fever and eczema in 11 year old children")
hay <- labelVars(hay,
c(eczema, hayFever),
c("prevalence of eczema", "prevalence of hay fever"))
tabodds(eczema, hayFever, hay)
mhodds(eczema, hayFever, hay, "Yes")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.