tableOR: Results table with odds ratios from logistic regression...

Description Usage Arguments Value Author(s) See Also Examples

Description

Result table with odds ratios, 95%-CI, test statistics, and p-values from logistic regression models for binary or ordinal variables.

Usage

1
2
tableOR(model, caption="", label="", size="scriptsize", factorNames=NULL,
                   table.placement = "ht", refLevels=NULL, lang="english", short=FALSE, latex=TRUE, rmStat=FALSE)

Arguments

model

an object of class "polr" or "glm", the latter has to be from the family binomial.

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 glm() which does not store the reference level labels internally.

lang

Language of the confidence intervals term, "english"" (default) or "german".

short

A logical, if TRUE factor names are removed from factor levels. Default is FALSE.

latex

Logical, if TRUE (default) LateX output is produced.

rmStat

Logical, if FALSE (default) output table inludes test statistics.

Value

Depending on the value of the argument latex, the function either prints LaTeX code or returns a data frame.

Author(s)

Simon Schwab

See Also

xtable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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")

biostatUZH documentation built on May 2, 2019, 6:06 p.m.