Plotting interaction terms in moderated regression

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Plotting interaction terms in moderated regression

R C Intrieri
Dear Listers,

Does anyone have a macro available to plot interaction in a moderated regression ala Aiken & West.

Thanks in Advance for your help.

Bob Intrieri

RC Intrieri, Ph.D.
Department of Psychology
1 University Circle
Western Illinois University
Macomb, IL  61455-1390
Office: 309-298-1336 Fax: 309-298-2179

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Plotting interaction terms in moderated regression

Alexander J. Shackman-2
check out the links @
http://psyphz.psych.wisc.edu/%7Eshackman/mediation_moderation_resources.htm#Resources_for_Mediation_and_Moderation_A

On Feb 1, 2008 9:10 AM, R C Intrieri <[hidden email]> wrote:

> Dear Listers,
>
> Does anyone have a macro available to plot interaction in a moderated
> regression ala Aiken & West.
>
> Thanks in Advance for your help.
>
> Bob Intrieri
>
> RC Intrieri, Ph.D.
> Department of Psychology
> 1 University Circle
> Western Illinois University
> Macomb, IL  61455-1390
> Office: 309-298-1336 Fax: 309-298-2179
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>



--
Alexander J. Shackman
Laboratory for Affective Neuroscience
Waisman Laboratory for Brain Imaging & Behavior
University of Wisconsin-Madison
1202 West Johnson Street
Madison, Wisconsin 53706

Telephone: +1 (608) 358-5025
FAX: +1 (608) 265-2875
EMAIL: [hidden email]
http://psyphz.psych.wisc.edu/~shackman
Calendar {still under construction}:
http://www.google.com/calendar/embed?src=ajshackman%40gmail.com

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Plotting interaction terms in moderated regression

msherman
In reply to this post by R C Intrieri
Bob: Down load Italassi at http://www.provalisresearch.com/ITALASSI/ITALdowload.html

It will allow you to import SPSS data files and then you will be able to view in 3-D a two way interaction as vectors.  martin


Martin F. Sherman, Ph.D.
Professor of Psychology
Director of Masters Education: Thesis Track
Loyola College
Psychology Department
222 B Beatty Hall
4501 North Charles Street
Baltimore, MD 21210

410 617-2417 (office)
410 617-5341 (fax)

[hidden email]


>>> R C Intrieri <[hidden email]> 2/1/2008 10:10 AM >>>
Dear Listers,

Does anyone have a macro available to plot interaction in a moderated regression ala Aiken & West.

Thanks in Advance for your help.

Bob Intrieri

RC Intrieri, Ph.D.
Department of Psychology
1 University Circle
Western Illinois University
Macomb, IL  61455-1390
Office: 309-298-1336 Fax: 309-298-2179

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Plotting interaction terms in moderated regression

Christopher Stride
In reply to this post by R C Intrieri
Hi Bob
the macro below does it for cont mod by cont pred vars where you also
have control var(s) too in the analysis - it's not particularly stylish
but it does all the regressions and standardisation too and works OK!
*'d lines document the process.
cheers
Chris




*** macros to investigate and plot 2-way interactions ***.
** wher we have continuous IV by continuous Moderating IV.

** WRITTEN BY CHRIS STRIDE - IWP, Uni of Sheffield - NOVEMBER 2007 **
* [hidden email] *.

* macro arguments: DV, control vars, IV, mod
* Process:
* i) converts to standardised scores
* ii) fits model
* iii) saves coefficients and sig levels using OMS - constant, IV, Mod,
interaction
* iv) outputs coeffs and sigf levels
* v) plots line!.

* Simply run the macro below and run as e.g.
* !contmod dv =      iv =     mod =    controls = .


define !contmod (dv !tokens(1) / iv !tokens(1) / mod !tokens(1) /
controls !cmdend).

* save data so it can be regot at the end for another analysis.
save outfile = 'c:/windows/temp/maindataA.sav'.

* compute scratch var to enable matching in of reg coeffs later.
compute x = 1.

* get mean and sd of iv and mod to enable standardisation, then
standardise these vars.
* and save data with them in.
AGGREGATE  /OUTFILE=*  MODE=ADDVARIABLES
  /BREAK = x  /ivmean modmean = MEAN(!iv !mod) /ivsd modsd = SD(!iv !mod).
compute zmod = (!mod - modmean)/modsd.
compute ziv = (!iv - ivmean)/ivsd.
compute zint = zmod*ziv.
save outfile = 'c:/windows/temp/maindataB.sav' /keep IDNO x zmod ziv zint.
exe.

* run regression saving r-squared stats to new file using OMS.
oms
 /select tables
 /if commands = ['Regression'] subtypes = ['Model Summary']
 /destination format=sav  outfile='c:/windows/temp/regoutputmod.sav'.
REGRESSION   /STATISTICS COEFF R CHA
  /DEPENDENT !dv
  /METHOD=ENTER !controls /METHOD=ENTER ziv zmod /METHOD=ENTER zint.
omsend.
exe.

* run regression saving coeffs to new file using OMS.
oms
 /select tables
 /if commands = ['Regression'] subtypes = ['Coefficients']
 /destination format=sav  outfile='c:/windows/temp/regoutputcoeff.sav'.
REGRESSION   /STATISTICS COEFF R CHA
  /DEPENDENT !dv
  /METHOD=ENTER !controls /METHOD=ENTER ziv zmod /METHOD=ENTER zint.
omsend.
exe.

* get model summary file and list results.
get file = 'c:/windows/temp/regoutputmod.sav'.
rename vars (Var1 = Model).
list cases /vars = Model to Sig.FChange.

* save just results of main interest i.e. just third model.
* create scatch var for matching too.
select if Model = 3.
compute x = 1.
save outfile = 'c:/windows/temp/regoutrsq.sav' /keep x R to Sig.FChange.
exe.

* get coeffs file, select just output of interest i.e. from final (3rd)
model - so var1  = 3.
get file = 'c:/windows/temp/regoutputcoeff.sav'.
exe.
select if Var1 = 3.

* list results.
list cases /vars = Var2 B Std.Error Beta t Sig.

* reorder cases so that constant then key preds are in order.
if var2 = '(Constant)' PREDTYPE = 1.
if var2 = 'zmod' PREDTYPE = 2.
if var2 = 'ziv' PREDTYPE = 3.
if var2 = 'zint' PREDTYPE = 4.
recode PREDTYPE (1 thru 4 = copy)(else = 5).
sort cases by PREDTYPE.

* restructure so that each coeff is a variable, not a case, and note how
many pred vars.
* inc controls.
CASESTOVARS /ID = Var1 /GROUPBY = VARIABLE  /COUNT = PREDVARS.

* compute scratch var to enable matching in / delimiting end of key vars.
compute x = 1.

* match coeffs back in, keeping just coeffs of interest, and also match
in r-sq stats.
match files file = 'c:/windows/temp/maindataB.sav' /table = *  /by X
 /keep  x ziv zmod zint B.1 to B.4 Std.Error.1 to Std.Error.4 Beta.1 to
Beta.4 t.1 to t.4
        Sig.1 to Sig.4.
match files file = * /table = 'c:/windows/temp/regoutrsq.sav' /by x.
exe.

rename vars (ziv zmod zint B.1 B.2 B.3 B.4 Std.Error.1 Std.Error.2
Std.Error.3 Std.Error.4
  Beta.1 Beta.2 Beta.3 Beta.4 t.1 t.2 t.3 t.4 Sig.1 Sig.2 Sig.3 Sig.4
  R RSquare AdjustedRSquare Std.ErroroftheEstimate RSquareChange FChange
  df1 df2 Sig.FChange =
  IV MODERATOR INTERACT  B_CONST B_MODERATOR B_IV B_INTERACT
  SE_CONST SE_MODERATOR SE_IV SE_INTERACT  BETA_CONST BETA_MODERATOR
BETA_IV BETA_INTERACT
  T_CONST T_MODERATOR T_IV T_INTERACT  SIGF_CONST SIGF_MODERATOR SIGF_IV
SIGF_INTERACT
  R_MODEL RSQ_MODEL ADJRSQ_MODEL SEEST_MODEL RSQCHA_MODEL FCHA_MODEL
  DF1_MODEL DF2_MODEL SIGFFCHA_MODEL.

* compute lines.
compute LOW_MOD = B_CONST + IV*B_IV - B_MODERATOR - IV*B_INTERACT.
compute MED_MOD = B_CONST + IV*B_IV.
compute HI_MOD = B_CONST + IV*B_IV + B_MODERATOR + IV*B_INTERACT.
exe.

variable labels
 LOW_MOD "Low score on moderator (-1 SD)"
 MED_MOD "Medium score on moderator (Mean)"
 HI_MOD "High score on moderator (+1 SD)".
exe.

* plot graph - try to include subtext with % variance accounted for by
mod term.
GRAPH  /SCATTERPLOT(OVERLAY)=IV IV IV  WITH  LOW_MOD MED_MOD HI_MOD (PAIR)
 /TITLE= 'Predicting !dv by !iv moderated by !mod'
 /SUBTITLE = 'X' /MISSING=LISTWISE .

list cases = 1 /vars = R_MODEL RSQ_MODEL ADJRSQ_MODEL SEEST_MODEL
RSQCHA_MODEL FCHA_MODEL
  DF1_MODEL DF2_MODEL SIGFFCHA_MODEL.

list cases = 1 /vars = B_MODERATOR B_IV B_INTERACT
 T_MODERATOR T_IV T_INTERACT  SIGF_MODERATOR SIGF_IV SIGF_INTERACT.

get file = 'c:/windows/temp/maindataA.sav'.
exe.
!enddefine.





R C Intrieri wrote:

> Dear Listers,
>
> Does anyone have a macro available to plot interaction in a moderated regression ala Aiken & West.
>
> Thanks in Advance for your help.
>
> Bob Intrieri
>
> RC Intrieri, Ph.D.
> Department of Psychology
> 1 University Circle
> Western Illinois University
> Macomb, IL  61455-1390
> Office: 309-298-1336 Fax: 309-298-2179
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

--
[hidden email]

*** daytime: 0114 2223262 ***
***     FAX: 0114 2727206 ***


"Watford FC Supporters - South Yorkshire branch"

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD