Re: [R] Problems on testing moderating effect (or interactive effect).

From: Guo Wei-Wei <>
Date: Tue 04 Jul 2006 - 21:51:02 EST

Thank you Jonathan,

Can I use the variance-covariance matrix as the input data? Just like what SEM does. My mentor told me to avoid sperate the operation into two step, that is to get the factors' means first and then to test the relationships. I'm used to use sem package. I'm not familiar with lm(). I trid summary(lm(B ~ A*C)) and failed to get any result.

Can sem deal with mediation? And could you tell me the command of generating a interaction item of A (nxp) and C (mxp)?

And you give a nice reference. Thank you very much!

2006/7/4, Jonathan Baron <>:
> 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
> 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:
> Editor: Judgment and Decision Making (
> mailing list PLEASE do read the posting guide! Received on Tue Jul 04 21:55:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 05 Jul 2006 - 00:16:17 EST.

Mailing list information is available at Please read the posting guide before posting to the list.