calculate_odds_ratio: Odds ratio Calculates the odds ratio for the posterior...

Description Usage Arguments Value Examples

View source: R/odds_ratio.R

Description

During Haldane zero-correction a value close to 0 is added to all cells (https://www.oxfordreference.com/view/10.1093/acref/9780199976720.001.0001/acref-9780199976720-e-1977). Most common is 0.5. This value eliminates the first order bias term.

Usage

1
2
3
4
5
6
7
8
9
calculate_odds_ratio(
  y_rep = NULL,
  y = NULL,
  zero_correction = "none",
  ci_method = "Woolf",
  ci_width = 0.89,
  nsim_ci = 1e+07,
  nsim_median = 1e+05
)

Arguments

y_rep

(pers) x (item) x (rep) array; replicated data (can handle response data as dataframe or lists of dataframes as well)

y

(pers) x (item) dataframe; response data

zero_correction

character; 'none', 'Haldane', or 'Bayes'

ci_method

character; 'Woolf', 'unconditional', 'compromise', 'BayesEqTails' or 'BayesHDI'

ci_width

double

nsim_ci

integer; number of draws used to get a distribution of the odds ratio value to calculate CIs

nsim_median

integer; number of draws used to get a distribution of the odds ratio value to calculate the median

Value

tibble

Examples

1
2
3
4
5
6
7
8
tibble::tribble(
~x, ~y,
0, 1,
1, 0,
1, 1,
0, 0,
1, 0
) %>% calculate_odds_ratio() # equals 0.5

Famondir/birtms documentation built on Feb. 18, 2022, 2:51 a.m.