multinRR {logisticRR} | R Documentation |
Inference on relative risk under multinomial logistic regression
Description
Inference on relative risk under multinomial logistic regression
Usage
multinRR(
formula,
basecov,
comparecov,
fixcov = NULL,
data,
boot = FALSE,
n.boot = 100
)
Arguments
formula |
a formula term that is passed into |
basecov |
a baseline value of exposure variable. Defaults to |
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 the exposure variable of interest, |
data |
a data frame containing response variable and all the terms used in |
boot |
a logical value whether bootstrap samples are generated or not. Defaults to |
n.boot |
if |
Value
fit |
an object of class |
RRR |
(adjusted) relative risk ratio of |
RR |
(adjusted) relative risk of |
delta.var |
estimated variance of relative risk ( |
boot.rr |
if |
boot.rrr |
if |
boot.var |
estimated sampled variance using bootstraps if |
fix.cov |
a data frame of fixed value for each of adjsuted confounders. |
Author(s)
Youjin Lee
Examples
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))
multiY <- ifelse(X == 1 , rbinom(n, 1, 0.7) + Y, rbinom(n, 1, 0.2) + Y)
print(table(multiY))
dat <- as.data.frame(cbind(multiY, X, W))
dat$W <- as.factor(dat$W)
result <- multinRR(multiY ~ W + X, basecov = 0, comparecov = 1,
data = dat, boot = TRUE)
print(apply(result$boot.rr, 2, sd)) # estimated standard errors using Delta method
print(sqrt(result$delta.var)) # estimated standard errors using bootstrap