mediate_pcma {hdmed}R Documentation

Principal Component Mediation Analysis for High-dimensional Mediators

Description

mediate_pcma applies principal component mediation analysis (Huang and Pan, 2013) to mediation settings in which the mediators are high-dimensional.

Usage

mediate_pcma(
  A,
  M,
  Y,
  var_per = 0.8,
  n_pc = NULL,
  sims = 1000,
  boot_ci_type = "bca",
  ci_level = 0.95,
  seed = 1
)

Arguments

A

length n numeric vector containing exposure variable

M

n x p numeric matrix of high-dimensional mediators.

Y

length n numeric vector containing continuous outcome variable.

var_per

a numeric variable with the desired proportion of variance explained. Default is 0.8.

n_pc

optional numeric variable with the desired number of PCs, in which case var_per is ignored. Default is NULL and the number of PCs is determined based on the desired proportion of variance explained.

sims

number of Monte Carlo draws for nonparametric bootstrap or quasi-Bayesian approximation (see mediation::mediate()). Default is 1000.

boot_ci_type

a character string indicating the type of bootstrap confidence intervals for when boot = TRUE. If "bca", bias-corrected and accelerated (BCa) confidence intervals will be estimated. If "perc", percentile confidence intervals will be estimated (see mediation::mediate()). Default is "bca".

ci_level

the desired confidence level. Default is 0.95.

seed

seed used for fitting single-mediator models after PCA

Details

Principal component mediation analysis (PCMA) is a method for estimating mediation effects when the mediators are high-dimensional. The first step is to compute the residuals of mediator models (M|A), then perform PCA on those residuals to reduce them to a smaller number of mediators that efficiently explain the residual variance. Then, since those mediators are linearly independent conditional on A, one can trivially perform single-mediator mediation analysis for each PC on its own, in this case by using the mediation::mediate() function. The global mediation effect is estimated by summing the mediation effects of the individual PCs.

Value

A list containing:

Source

https://rdrr.io/github/zhaoyi1026/spcma

References

Huang, Y.-T. & Pan, W.-C. Hypothesis test of mediation effect in causal mediation model with high-dimensional continuous mediators. Biometrics 72, 402-413 (2016).

Examples

A <- med_dat$A
M <- med_dat$M
Y <- med_dat$Y
# Fit PCMA with 3 principal components and print the effects. In practice one
# should choose n_pc (or var_per) and the number sims to be larger
out <- mediate_pcma(A, M, Y, n_pc = 3, sims = 10)
out$effects




[Package hdmed version 1.0.1 Index]