Learn R Programming

tipr (version 0.4.1)

tip_coef: Tip a linear model coefficient with a continuous confounder.

Description

choose one of the following, and the other will be estimated:

  • smd

  • outcome_association

Usage

tip_coef(effect, smd = NULL, outcome_association = NULL, verbose = TRUE)

lm_tip(effect, smd, outcome_association, verbose = TRUE)

tip_coef_with_continuous( effect, smd = NULL, outcome_association = NULL, verbose = TRUE )

Value

Data frame.

Arguments

effect

Numeric. Observed exposure - outcome effect from a regression model. This can be the beta coefficient, the lower confidence bound of the beta coefficient, or the upper confidence bound of the beta coefficient.

smd

Numeric. Estimated scaled mean difference between the unmeasured confounder in the exposed population and 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

Examples

Run this code
## to estimate the association between an unmeasured confounder and outcome
## needed to tip analysis
tip_coef(1.2, smd = -2)

## to estimate the number of unmeasured confounders specified needed to tip
## the analysis
tip_coef(1.2, smd = -2, outcome_association = -0.05)

## Example with broom
if (requireNamespace("broom", quietly = TRUE) &&
    requireNamespace("dplyr", quietly = TRUE)) {
  lm(wt ~ mpg, data = mtcars) %>%
   broom::tidy(conf.int = TRUE) %>%
   dplyr::filter(term == "mpg") %>%
   dplyr::pull(conf.low) %>%
   tip_coef(outcome_association = 2.5)
}

Run the code above in your browser using DataLab