chest_nb: Assessing confounding effects using Negative Binomial...

View source: R/chest_nb.R

chest_nbR Documentation

Assessing confounding effects using Negative Binomial regression models

Description

It fits negative binomial regression models to present 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

chest_nb(
  crude,
  xlist,
  data,
  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.

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.

Value

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

See Also

'glm.nb' of 'MASS'

Examples

library(MASS)
df <- quine
results <- chest_nb("Days ~ Lrn", xlist = c("Sex", "Age", "Eth"), data = df)
results$data

chest documentation built on March 31, 2023, 10:02 p.m.