# mediation but not moderation analysis

Hi Gang,
I am interested in a voxel-wise searching for regions with an imaging measure (call it variable M, could be activation, connectivity, or gray matter volume…) mediating the association between behavioral variables of B1 and B2. Specifically, I want to do a “mediation analysis”, examining if the following 3 things are true:
(1) in model B1=a+bB2+error1, b is significant
(2) in model B1=c+d
M+error2, d is significant
(3) in model B1=e+fB2+gM+error3, g is significant; and f is significantly smaller than b
Based on descriptions in
https://en.wikipedia.org/wiki/Mediation_(statistics)
and
https://en.wikipedia.org/wiki/Sobel_test
Do you think that AFNI can easily handle this “mediation” analysis with a “Sobel test”? If so, how would you specifically approach it?

I did search on this message board on similar discussions such as these:
However, “mediation” and “moderation” were used interchangeably in these discussions, and all of your suggested solutions were for “moderation” (to examine the interaction term) but not for “mediation”. Here is a clarification of the difference between these concepts:
https://www.theanalysisfactor.com/to-moderate-or-to-mediate/

Thank you so much for your help as it has always been!

Happy New Year, Zhihao!

Let’s see if the following is what you’re looking for.

(1) in model B1=a+b*B2+error1, b is significant

You can do this yourself with any linear modeling program in R, Matlab, SAS, SPSS, etc.

(2) in model B1=c+d*M+error2, d is significant

First, create a 3D dataset for each subject with B1 with a command like:

3dcalc -prefix myB1 -a M-dataset -expr ‘b1’ (b1 is the B1-value for each subejct)

Then run model (2) with 3dttest++ by treating M as a covariate. You need to create a covariate file in a tabular format (read the 3dttest++ help for details).

(3) in model B1=e+fB2+gM+error3, g is significant; and f is significantly smaller than b

You can do (3) the same way as (2).

If you follow the above steps, the only dangling end is the last part (“f is significantly smaller than b”), which we can talk about once you reach there.

## Gang Wrote:

Happy New Year, Zhihao!

Let’s see if the following is what you’re looking
for.

(1) in model B1=a+b*B2+error1, b is significant

You can do this yourself with any linear modeling
program in R, Matlab, SAS, SPSS, etc.

(2) in model B1=c+d*M+error2, d is significant

First, create a 3D dataset for each subject with
B1 with a command like:

3dcalc -prefix myB1 -a M-dataset -expr ‘b1’ (b1
is the B1-value for each subejct)

Then run model (2) with 3dttest++ by treating M as
a covariate. You need to create a covariate file
in a tabular format (read the 3dttest++ help for
details).

(3) in model B1=e+fB2+gM+error3, g is
significant; and f is significantly smaller than b

You can do (3) the same way as (2).

If you follow the above steps, the only dangling
end is the last part (“f is significantly smaller
than b”), which we can talk about once you reach
there.

Greeting,

Apologies for reviving this old post but I am at the last step:

“If you follow the above steps, the only dangling
end is the last part (“f is significantly smaller
than b”), which we can talk about once you reach
there”

b is significant
d is significant
g is significant and f looks like it’s smaller now compared to b. Any thoughts on how to test the “f is significantly smaller
than b” hypothesis?

Any help will be appreciated,

Thank you,