tip_with_binary: Tip a result with a binary confounder.

Description Usage Arguments Details Examples

View source: R/tip.R

Description

Choose two of the following three to specify, and the third will be estimated:

Alternatively, specify all three and the function will return the number of unmeasured confounders specified needed to tip the analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
tip_with_binary(
  d,
  exposed_p = NULL,
  unexposed_p = NULL,
  outcome_association = NULL,
  verbose = TRUE,
  lb_name = "conf.low",
  ub_name = "conf.high"
)

tip_b(
  d,
  exposed_p = NULL,
  unexposed_p = NULL,
  outcome_association = NULL,
  verbose = TRUE,
  lb_name = "conf.low",
  ub_name = "conf.high"
)

Arguments

d

Data frame. A data frame with the observed effect(s). This should have at least two columns with the lower and upper confidence bounds. These columns are assumed to be called conf.low and conf.high. If this is not the case, the names can be changed using the lb_name and ub_name parameters.

exposed_p

Numeric between 0 and 1. Estimated prevalence of the unmeasured confounder in the exposed population

unexposed_p

Numeric between 0 and 1. Estimated prevalence of the unmeasured confounder in the unexposed population

outcome_association

Numeric positive value. estimated association between the unmeasured confounder and the outcome

verbose

Logical. Indicates whether to print informative message. Default: TRUE

lb_name

Character. Column name of d that holds the lower confidence bound. Default: conf.low based on broom defaults.

ub_name

Character. Column name of d that holds the upper confidence bound. Default: conf.high based on broom defaults.

Details

tip_b() is an alias for tip_with_binary().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
d <- data.frame(conf.low = 1.2, conf.high = 1.5)
## to estimate the association between an unmeasured confounder and outcome
## needed to tip analysis
tip_with_binary(d, exposed_p = 0.5, unexposed_p = 0)

## to estimate the number of unmeasured confounders specified needed to tip
## the analysis
tip_with_binary(d, exposed_p = 0.5, unexposed_p = 0, outcome_association = 1.1)

## Example with broom
if (requireNamespace("broom", quietly = TRUE) &&
    requireNamespace("dplyr", quietly = TRUE)) {
  glm(am ~ mpg, data = mtcars, family = "binomial") %>%
   broom::tidy(conf.int = TRUE, exponentiate = TRUE) %>%
   dplyr::filter(term == "mpg") %>%
   tip_with_binary(exposed_p = 1, outcome_association = 1.15)
}

tipr documentation built on Sept. 10, 2021, 9:06 a.m.