Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant ci_level argument in risk function. #5

Open
ekoraytascilar opened this issue Jan 22, 2020 · 0 comments
Open

Redundant ci_level argument in risk function. #5

ekoraytascilar opened this issue Jan 22, 2020 · 0 comments

Comments

@ekoraytascilar
Copy link

Using example data in package help

dat <- data.frame(
    exposure_var = c(rep(1, 8), rep(0, 5), rep(1, 98), rep(0, 115)),
  outcome_var = c(rep(1, 8), rep(1, 5), rep(0, 98), rep(0, 115)),
  stringsAsFactors = FALSE
) 

Output with default ci_level

> risk(data = dat, exposure = exposure_var, outcome = outcome_var)

## # A tibble: 2 x 10
##  exposure_var     n outcome  risk risk_ratio rr_lci rr_uci risk_diff rd_lci rd_uci
##         <dbl> <int>   <dbl> <dbl>      <dbl>  <dbl>  <dbl>     <dbl>  <dbl>  <dbl>
## 1            0   120       5  4.17       1     0.337   2.96      0     -6.20   6.20
## 2            1   106       8  7.55       1.81  0.611   5.37      3.38  -2.82   9.58

Output with ci_level set to 99

> risk(data = dat, exposure = exposure_var, outcome = outcome_var,ci_level = 99)
## # A tibble: 2 x 10
##   exposure_var     n outcome  risk risk_ratio rr_lci rr_uci risk_diff rd_lci rd_uci
##          <dbl> <int>   <dbl> <dbl>      <dbl>  <dbl>  <dbl>     <dbl>  <dbl>  <dbl>
## 1            0   120       5  4.17       1     0.337   2.96      0     -6.20   6.20
## 2            1   106       8  7.55       1.81  0.611   5.37      3.38  -2.82   9.58

I believe the line that reads z <- abs(qnorm(((100 - 95)/2)/100)) in the function should be z <- abs(qnorm(((100 - ci_level)/2)/100)). Editing the function as such produces different confidence limits when ci_level is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant