matched_or.table: Matched pairs odds ratio from a table

Description Usage Arguments Value Examples

Description

Create odds ratio and confidence interval from matched pairs data.

Usage

1
2
3
## S3 method for class 'table'
matched_or(df, alpha = 0.05, rev = c("neither", "rows",
  "columns", "both"), ...)

Arguments

df

a dataframe with binary variables x and y or a 2 x 2 frequency table/matrix.

alpha

level of significance for confidence interval.

rev

reverse order of cells. Options are "row", "columns", "both", and "neither" (default).

...

further arguments passed to or from other methods.

Value

a list with class "matched_or" with the following components:

tab

2x2 table using for calculating risk difference

or

dataframe with columns corresponding to matched-pairs OR, lower bound, and upper bound of CI

conf.level

specified confidence level

Examples

1
2
3
4
5
6
7
gene <- data.frame(pair = seq(1:35),
                   ulcer = rbinom(35, 1, .7),
                   healthy = rbinom(35, 1, .4))

gene_tab <- xtabs(~ ulcer + healthy, data = gene)

gene_tab %>% matched_or()

Example output

Frequency table: 

     healthy
ulcer  0  1
    0  5  7
    1 17  6

---------------------------------------- 

Confidence level: 95% 
  odds_ratio lower_bound upper_bound
1     0.4118      0.1708      0.9929

catfun documentation built on June 14, 2019, 5:04 p.m.