GEEmediate {GEEmediate} | R Documentation |
Mediation Analysis for Generalized Linear Models Using the Difference Method
Description
Estimation of natural direct and indirect effects for generalized linear models. The function utilizes a data-duplication algorithm to fit marginal and conditional GLMs in a way that allow for consistent variance estimation. The function produces point estimates, confidence intervals and p-values for the natural indirect effect and the mediation proportion
Usage
GEEmediate(
formula,
exposure,
mediator,
df,
family = gaussian,
corstr = "independence",
conf.level = 0.95,
surv = F,
pres = "sep",
niealternative = "two-sided",
...
)
Arguments
formula |
A formula expression as for
other regression models, of the form response ~ predictors. See the documentation of |
exposure |
The exposure (string). |
mediator |
The mediator (string). |
df |
A name of a data frame where all variables mentioned in formula are stored. |
family |
A |
corstr |
|
conf.level |
Confidence level for all confidence intervals (default 0.95) |
surv |
Is the outcome survival (not supported) |
pres |
Presentation of the coefficient tables. "tog" for a single table, "sep" for two separated tables. |
niealternative |
Alternative hypothesis for testing that the nie=0. Either "two-sided" (default) or "one-sided" for alternative nie>0. |
... |
Further arguments for the |
Value
The output contains the following components:
call |
The call. |
GEE.fit |
Results of fitting the GEE for the duplicated data. |
nie |
The natural indirect effect estimate. NIE and NDE are reported on the coefficient scale |
nie.pval |
P-value for tesing mediation using the NIE. |
nde |
The natural direct effect estimate. |
nie.ci |
Confidence interval in for the NIE in confidence level conf.level. |
pm |
The mediation proportion estimate. |
pm.pval |
P-value for tesing one-sided mediation using the mediation proportion. |
pm.ci |
Confidence interval for the mediation proportion in confidence level conf.level. |
References
Nevo, Liao and Spiegelman, Estimation and infernece for the mediation proportion, International Journal of Biostatistics (2017+)
Examples
## Not run:
SimNormalData <- function(n,beta1.star = 1, p = 0.3, rho =0.4, inter = 0)
{
beta2 <- (p/rho)*beta1.star
beta1 <- (1-p)*beta1.star
XM <- MASS::mvrnorm(n, mu = c(0,0), Sigma = matrix(c(1,rho,rho,1),2,2))
X <- XM[,1]
M <- XM[,2]
beta <- c(inter, beta1, beta2)
print(beta)
Y <- cbind(rep(1,n),XM)%*%beta+rnorm(n,0,sd = 1)
return(data.frame(X = X, M = M, Y = Y))
}
set.seed(314)
df <- SimNormalData(500)
GEEmediate(Y ~ X + M, exposure = "X", mediator = "M", df = df)
## End(Not run)