tableOR {biostatUZH} | R Documentation |
Result table with odds ratios, 95%-CI, test statistics, and p-values from logistic regression models for binary or ordinal variables.
tableOR(model, caption="", label="", size="scriptsize", factorNames=NULL, table.placement = "ht", refLevels=NULL, lang="english", short=FALSE, latex=TRUE, rmStat=FALSE, Wald=FALSE)
model |
an object of class |
caption |
Table caption. |
label |
A string containing the LaTeX table reference label. |
size |
A string to set LaTeX font site, e.g. small, scriptsize, etc. |
factorNames |
A character vector of size k number of factors or regressor with custom factor labels. |
table.placement |
LaTeX table positioning. |
refLevels |
A character vector of size k number of regressors with custom reference level names. This option is designed when using |
lang |
Language of the confidence intervals term, "english"" (default) or "german". |
short |
A logical, if |
latex |
Logical, if |
rmStat |
Logical, if |
Wald |
Logical, if |
Depending on the value of the argument latex
, the function
either prints LaTeX code or returns a data frame.
Simon Schwab
dat = carData::TitanicSurvival dat$survived = relevel(dat$survived, ref = "yes") # relevel: baseline is survived yes. model = glm(survived ~ sex + age + passengerClass, data = dat, family = binomial()) labels = c("female", "1st") # reference levels of the two categorial variables tableOR(model, latex = FALSE, short = TRUE, refLevels = labels, caption = "Changes in odds for risk of death in the Titanic tragedy.") ## using log regression for ordinal data dat$passengerClass = factor(dat$passengerClass, ordered = TRUE) model = MASS::polr(passengerClass ~ sex + age, data = dat, Hess = TRUE) tableOR(model, latex = FALSE, short = TRUE, caption = "Changes in odds for being in a lower class, i.e. 2nd or 3rd class")