printRR: Print adjusted relative risk under binary or ordinal exposure... In youjin1207/logisticRR: Adjusted Relative Risk from Logistic Regression

Description

Print adjusted relative risk under binary or ordinal exposure variable.

Usage

 `1` ```printRR(formula, basecov = 0, fixcov = NULL, data) ```

Arguments

 `formula` a formula term that is passed into `glm()` having a form of `response ~ terms` where `response` is binary response vector and `terms` is a collection of terms connected by `'+'`. The first term of predictors will be used as a predictor of interest to calculate relative risks with respect to response variable. `basecov` a baseline value of exposure variable. Defaults to `0`. `fixcov` a data frame of fixed value for each of adjusted confounders. If there is no confounder other than an exposure variable of interest, `fixcov` = `NULL`; if `fixcov` is missing for covariates, they are all set to `0` (for numerical covariates) or first levels (for factor covariates). `data` a data frame containing response variable and all the terms used in `formula`.

Value

 `fit` an object of class `glm`. `RR` (adjusted) relative risk in response under exposure at baseline (`basecov`) and `basecov + 1`. `delta.var` estimated variance of relative risk (`RR`) using Delta method. `fix.cov` a data frame of fixed value for each of adjsuted confounders.

Examples

 ```1 2 3 4 5 6 7 8``` ```n <- 500 set.seed(1234) X <- rbinom(n, 1, 0.3) W <- rbinom(n, 1, 0.3) W[sample(1:n, n/3)] = 2 Y <- rbinom(n, 1, plogis(X - W)) dat <- as.data.frame(cbind(Y, X, W)) result <- printRR(Y ~ X + W, basecov = 0, data = dat) ```

youjin1207/logisticRR documentation built on March 16, 2020, 3:37 a.m.