[R] Problems on testing moderating effect (or interactive effect).
Jonathan Baron
baron at psych.upenn.edu
Tue Jul 4 13:09:06 CEST 2006
On 07/04/06 11:38, Guo Wei-Wei wrote:
> Hi everyone,
>
> I want to do test on moderating effect. I have three factors, A, B,
> and C. A has influence on B, and C moderating the influence. The
> relationship looks like this:
>
> A -----> B
> ^
> |
> C
>
> A, B, and C are all scale variables. I think I can test the moderating
> effect by adding a interactive variable between A and C. But I'm not
> sure how to do.
>
> Is there a default way to do it in package sem?
>
> I'm also thinking about create a interaction variable of A and C, but
> I don't know how to it. A has n (n = 27) items and p (p = 288) cases
> and C has m (m = 16) iterms and p (p = 288) cases.
Moderation is usually tested with an interaction. You would use
lm() not sem. For example,
summary(lm(B ~ A*C))
which will report the main effects of A and C as well as their
interaction. (Of course, main effects may be meaningless if
there is an interaction.) See the help page for formula.
So far I'm assuming that you are interested in individual
differences (cases). So A, B, and C would be the means of each
case. If, for example, A is actually a matrix in which each row
is a case, you would use something like rowMeans(A), etc., for
each variable, so you could say
summary(lm(rowMeans(B) ~ rowMeans(A)*rowMeans(C)))
(or else compute each of these first).
However, you may be interested in moderation WITHIN cases, across
items.
If you look up moderation on Google, you find
http://davidakenny.net/cm/moderation.htm
which cites
Judd, C. M., Kenny, D. A., & McClelland, G. H. (2001). Estimating
and testing mediation and moderation in within-participant
designs. Psychological Methods, 6, 115-134.
I have not read this article, but other articles by the same
authors are both clear and well reasoned.
--
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
Editor: Judgment and Decision Making (http://journal.sjdm.org)
More information about the R-help
mailing list