chest_glm: Assessing confounding effects using Generalized Linear...

Description Usage Arguments Value See Also Examples

View source: R/chest_glm.R

Description

Please note: There is a faster option: 'chest_speedglm'. 'chest_glm' is used to assess confounding effects using Generalized Linear Models, such as logistic regression and Poisson regression with 'glm'. It presents odds ratios or rate ratios for the association between exposure and outcome variables by adding other variables (potential confounders) to the model sequentially. The order of variables to be added is based on the magnitudes of the changes in effect estimates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
chest_glm(
  crude,
  xlist,
  data,
  family = "binomial",
  method = "glm.fit",
  na_omit = TRUE,
  indicate = FALSE,
  plus = "  + ",
  ...
)

Arguments

crude

An object of formula for initial model, generally crude model. However, any other variables can also be included here as the initial model.

xlist

A vector of characters with all variable names of potential confounders.

data

Data frame.

family

Description of the error distribution. Default is "binomial".

method

Method to detect for singularity.

na_omit

Remove all missing values, default: 'na_omit = TRUE'.

indicate

indicate progress.

plus

Change the + sign before variable names.

...

Further optional arguments for forestplot.

Value

A table with effect estimates and their changes at all steps.

See Also

'glm' 'stats'

Examples

1
2
3
4
chest_glm(
  crude = "Endpoint ~ Diabetes", xlist = c("Age", "Sex", "Married"),
  na_omit = TRUE, data = diab_df
)

Example output

  
$data
    variables      est       lb       ub     Change            p    n
1       Crude 2.307947 1.841000 2.913558         NA 8.839157e-13 2367
2       + Age 3.342051 2.506369 4.498958 44.8062080 5.899645e-16 2367
3   + Married 3.314066 2.484515 4.462517 -0.8373444 1.002763e-15 2367
4       + Sex 3.337314 2.500947 4.495835  0.7014981 7.521353e-16 2367

$fun
[1] "chest_glm"

$family
[1] "binomial"

chest documentation built on Jan. 19, 2021, 9:07 a.m.