Package 'GEEmediate'

Title: Mediation Analysis for Generalized Linear Models Using the Difference Method
Description: Causal mediation analysis for a single exposure/treatment and a single mediator, both allowed to be either continuous or binary. The package implements the difference method and provides point and interval estimates as well as testing for the natural direct and indirect effects and the mediation proportion. Nevo, Xiao and Spiegelman (2017) <doi:10.1515/ijb-2017-0006>.
Authors: Daniel Nevo [aut, cre]
Maintainer: Daniel Nevo <[email protected]>
License: GPL (>= 3)
Version: 1.1.4
Built: 2024-11-21 03:04:01 UTC
Source: https://github.com/daniel258/geemediate

Help Index


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 lm and formula for details. predictors should include exposure/treatment and mediator.

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 family object to be used in gee: a list of functions and expressions for defining link and variance functions see the gee documentation. Default is gaussian. See also gee and glm.

corstr

A working correlation structure. See gee and glm.

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 gee call.

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)