printnRR {logisticRR}R Documentation

Print adjusted relative risk under nominal exposure variable.

Description

Print adjusted relative risk under nominal exposure variable.

Usage

printnRR(formula, basecov, comparecov, 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 the first level.

comparecov

a value of exposure variable for comparison. Defaults to the first level.

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 comparecov.

delta.var

estimated variance of relative risk (RR) using Delta method.

fix.cov

a data frame of fixed value for each of adjsuted confounders.

Author(s)

Youjin Lee

Examples

n <- 500
set.seed(1234)
W <- rbinom(n, 1, 0.3); W[sample(1:n, n/3)] = 2
dat <- as.data.frame(W)
dat$X <- sample( c("low", "medium", "high"), size = n, replace = TRUE)
dat$Y <- ifelse(dat$X == "low", rbinom(n, 1, plogis(W + 0.5)),
               ifelse(dat$X == "medium", rbinom(n, 1, plogis(W + 0.2)),
               rbinom(n, 1, plogis(W - 0.4)) ))
dat$X <- as.factor(dat$X)
result <- printnRR(Y ~ X + W, basecov = "high", comparecov = "low", data = dat)



[Package logisticRR version 0.3.0 Index]