  Testing for mediation effects is empirically important and theoretically
interesting. It is important in psychology, medicine, economics, accountancy,
and marketing for instance, generating over 90,000 citations to a single key
paper in the field. It also leads to a statistically interesting and
long-standing problem that this paper solves. The no-mediation hypothesis,
expressed as $H_{0}:\theta_{1}\theta_{2}=0$, defines a manifold that is
non-regular in the origin where rejection probabilities of standard tests are
extremely low. We propose a general method for obtaining near similar tests
using a flexible $g$-function to bound the critical region. We prove that no
similar test exists for mediation, but using our new varying $g$-method obtain
a test that is all but similar and easy to use in practice. We derive tight
upper bounds to similar and nonsimilar power envelopes and derive an optimal
test. We extend the test to higher dimensions and illustrate the results in a
trade union sentiment application.
