Description Usage Arguments Details Value Author(s) References See Also Examples
AFclogit
estimates the model-based adjusted attributable fraction from a conditional logistic regression model in form of a clogit
object. This model is model is commonly used for data from matched case-control sampling designs.
1 |
object |
a fitted conditional logistic regression model object of class " |
data |
an optional data frame, list or environment (or object coercible by |
exposure |
the name of the exposure variable as a string. The exposure must be binary (0/1) where unexposed is coded as 0. |
clusterid |
the name of the cluster identifier variable as a string. Because conditional logistic regression is only used for clustered data, this argument must be supplied. |
AFclogit
estimates the attributable fraction for a binary outcome Y
under the hypothetical scenario where a binary exposure X
is eliminated from the population.
The estimate is adjusted for confounders Z
by conditional logistic regression.
The estimation assumes that the outcome is rare so that the risk ratio can be approximated by the odds ratio, for details see Bruzzi et. al.
Let the AF be defined as
AF = 1 - Pr(Y0 = 1) / Pr(Y = 1)
where Pr(Y0 = 1) denotes the counterfactual probability of the outcome if
the exposure would have been eliminated from the population. If Z
is sufficient for confounding control then the probability Pr(Y0 = 1) can be expressed as
Pr(Y0=1) = E_z{Pr(Y = 1 | X = 0, Z)}.
Using Bayes' theorem this implies that the AF can be expressed as
AF = 1 - E_z{Pr( Y = 1 | X = 0, Z)} / Pr(Y = 1) = 1 - E_z{RR^{-X} (Z) | Y = 1}
where RR(Z) is the risk ratio
Pr(Y = 1 | X = 1,Z)/Pr(Y=1 | X = 0, Z).
Moreover, the risk ratio can be approximated by the odds ratio if the outcome is rare. Thus,
AF is approximately 1 - E_z{OR^{-X}(Z) | Y = 1}.
The odds ratio is estimated by conditional logistic regression.
The function gee
in the drgee
package is used to get the score contributions for each cluster and the hessian.
A clustered sandwich formula is used in the variance calculation.
AF.est |
estimated attributable fraction. |
AF.var |
estimated variance of |
log.or |
a vector of the estimated log odds ratio for every individual. logit {Pr(Y=1|X,Z)} = α + β X + γ Z then logit{Pr(Y=1|X,Z)} = α + β X +γ Z +ψ XZ then |
Elisabeth Dahlqwist, Arvid Sj<c3><b6>lander
Bruzzi, P., Green, S. B., Byar, D., Brinton, L. A., and Schairer, C. (1985). Estimating the population attributable risk for multiple risk factors using case-control data. American Journal of Epidemiology 122, 904-914.
clogit
used for fitting the conditional logistic regression model for matched case-control designs. For non-matched case-control designs see AFglm
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | expit <- function(x) 1 / (1 + exp( - x))
NN <- 1000000
n <- 500
# Example 1: matched case-control
# Duplicate observations in order to create a matched data sample
# Create an unobserved confounder U common for each pair of individuals
intercept <- -6
U <- rnorm(n = NN)
Z1 <- rnorm(n = NN)
Z2 <- rnorm(n = NN)
X1 <- rbinom(n = NN, size = 1, prob = expit(U + Z1))
X2 <- rbinom(n = NN, size = 1, prob = expit(U + Z2))
Y1 <- rbinom(n = NN, size = 1, prob = expit(intercept + U + Z1 + X1))
Y2 <- rbinom(n = NN, size = 1, prob = expit(intercept + U + Z2 + X2))
# Select discordant pairs
discordant <- which(Y1!=Y2)
id <- rep(1:n, 2)
# Sample from discordant pairs
incl <- sample(x = discordant, size = n, replace = TRUE)
data <- data.frame(id = id, Y = c(Y1[incl], Y2[incl]), X = c(X1[incl], X2[incl]),
Z = c(Z1[incl], Z2[incl]))
# Fit a clogit object
fit <- clogit(formula = Y ~ X + Z + X * Z + strata(id), data = data)
# Estimate the attributable fraction from the fitted conditional logistic regression
AFclogit_est <- AFclogit(fit, data, exposure = "X", clusterid="id")
summary(AFclogit_est)
|
Loading required package: survival
Loading required package: drgee
Loading required package: nleqslv
Loading required package: Rcpp
Loading required package: data.table
Loading required package: stdReg
Call:
clogit()
Estimated attributable fraction (AF) and untransformed 95% Wald CI:
AF Robust SE z value Pr(>|z|) Lower limit Upper limit
0.6554761 0.1003067 6.534718 6.372947e-11 0.4588785 0.8520736
Exposure : X
Outcome : Y
Observations Cases Clusters
1000 500 500
Method for confounder adjustment: Conditional logistic regression
Formula: Surv(rep(1, 1000), Y) ~ X + Z + X * Z + strata(id)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.