  To investigate causal mechanisms, causal mediation analysis decomposes the
total treatment effect into the natural direct and indirect effects. This paper
examines the estimation of the direct and indirect effects in a general
treatment effect model, where the treatment can be binary, multi-valued,
continuous, or a mixture. We propose generalized weighting estimators with
weights estimated by solving an expanding set of equations. Under some
sufficient conditions, we show that the proposed estimators are consistent and
asymptotically normal. Specifically, when the treatment is discrete, the
proposed estimators attain the semiparametric efficiency bounds. Meanwhile,
when the treatment is continuous, the convergence rates of the proposed
estimators are slower than $N^{-1/2}$; however, they are still more efficient
than that constructed from the true weighting function. A simulation study
reveals that our estimators exhibit a satisfactory finite-sample performance,
while an application shows their practical value
