| h_odds_ratio | R Documentation | 
Functions to calculate odds ratios in estimate_odds_ratio().
or_glm(data, conf_level)
or_clogit(data, conf_level, method = "exact")
data | 
 (  | 
conf_level | 
 (  | 
method | 
 (  | 
A named list of elements or_ci and n_tot.
or_glm(): Estimates the odds ratio based on stats::glm(). Note that there must be
exactly 2 groups in data as specified by the grp variable.
or_clogit(): Estimates the odds ratio based on survival::clogit(). This is done for
the whole data set including all groups, since the results are not the same as when doing
pairwise comparisons between the groups.
odds_ratio
# Data with 2 groups.
data <- data.frame(
  rsp = as.logical(c(1, 1, 0, 1, 0, 0, 1, 1)),
  grp = letters[c(1, 1, 1, 2, 2, 2, 1, 2)],
  strata = letters[c(1, 2, 1, 2, 2, 2, 1, 2)],
  stringsAsFactors = TRUE
)
# Odds ratio based on glm.
or_glm(data, conf_level = 0.95)
# Data with 3 groups.
data <- data.frame(
  rsp = as.logical(c(1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0)),
  grp = letters[c(1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3)],
  strata = LETTERS[c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)],
  stringsAsFactors = TRUE
)
# Odds ratio based on stratified estimation by conditional logistic regression.
or_clogit(data, conf_level = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.