multiRR: Inference on relative risk under multinomial logistic...

Description Usage Arguments Value Author(s) Examples

View source: R/multiRR.R

Description

Inference on relative risk under multinomial logistic regression

Usage

1
2
multiRR(formula, basecov = 0, fixcov = NULL, data, boot = FALSE,
  n.boot = 100)

Arguments

formula

a formula term that is passed into multinom() where response should be a factor having K different levels. Every term appearing in the formula should be well-defined as a column of data. Reference response should be specified as the first level.

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 the exposure variable of interest, fixcov = NULL; if fixcov is missing for existing covariates, they are all set to 0 (for numerical covariates) or to the first level (for factor covariates).

data

a data frame containing response variable and all the terms used in formula.

boot

a logical value whether bootstrap samples are generated or not. Defaults to FALSE.

n.boot

if boot = TRUE, the number of bootstrap samples. Defaults to 100.

Value

fit

an object of class multinom.

RRR

(adjusted) relative risk ratio of K different responses compared to reference response under exposure at baseline (basecov) and basecov + 1.

RR

(adjusted) relative risk of K different responses under exposure at baseline (basecov) and basecov + 1.

delta.var

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

boot.rr

if boot = TRUE, a vector of RR's using bootstrap samples.

boot.rrr

if boot = TRUE, a vector of relative risk ratio (RRR)'s using bootstrap samples.

boot.var

estimated sampled variance using bootstraps if boot = TRUE.

fix.cov

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

Author(s)

Youjin Lee

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 <- multiRR(W ~ X + Y, basecov = 0, data = dat, boot = TRUE, n.boot = 100)
print(apply(result$boot.rr, 2, sd)) # estimated standard errors using Delta method
print(sqrt(result$delta.var)) # estimated standard errors using bootstrap

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