Moderation Analysis with a 2-factor grouping variable

Hi all,

I am trying to do a moderation analysis for an assignment and am struggling to find an answer from googling. I have tried tooling around with lm() but am not sure if I am doing so correctly.

Essentially, I have 4 variables that I am working with. The dependent variable (selfesteem) is numerical, and I have two numerical grouping variables (bodysatis AND importance) and grouping variable that is a factor with two levels (agegp: "old" and "young").

I am trying to work out if the strength of the relationship of the two numerical grouping variables to the dependent variable differ between the two age groups.

Is this how I would specify it?

lm0 <- lm(selfesteem ~ bodysatis * importance + agegp, data)

Or should I break them up and do

lm1 <- lm(selfesteem ~ bodysatis * agegp, data)
lm2 <- lm(selfesteem ~ importance * agegp, data)

and then compare the R2 strengths?

I could and should I go further still and break up each one individually and compare the results, as in

lm1 <- lm(selfesteem[agegp == "old"] ~ bodysatis[agegp == "old"] * agegp[agegp == "old"], data)
lm2 <- lm(selfesteem[agegp == "old"] ~ importance[agegp == "old"] * agegp[agegp == "old"], data)

And then the same for the younger group?

Or am I going about this the wrong way?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.