David A. Kenny

December 6, 2010

 

Moderation Macro

 

This moderation macro, called ModText, was written by David A. Kenny, Department of Psychology, University of Connecticut (please email me).   This is Version 1c, completed on December 5, 2010.  This marco almost certainly contains errors and will certainly be revised, and so it is advisable to return for updates.  Because of these errors, you should carefully check your output.

 

Thank You!

I thank my good friend Bob Calsyn for the sample data.  Thanks to Amanda Snook, Stefano Livi, and Brian Connolly for advice.

 

Download:

ModText.SPS (You need SPSS to open this and the next 3 files.)

Sample Data File

Macro Call

SPSS Output

Macro Output (You do not need SPSS to open this file. But if you do not use wordwrap it will look ugly.) 

 

To understand how to run a macro return to the DataToText page. The macro takes a few minutes to run and so be patient.  Make sure to backup the raw data file, as sometimes an error in the macro can alter the data file.

 

PLEASE READ THIS: Note that the output (the text file you name) cannot be viewed in SPSS and is not written to the SPSS output file. You need to view it in text reader (e.g., Notepad). When viewing the file, make sure to use wordwrap and Courier or New Courier font.

 

The Macro Call

 

This is the statement for the sample data:

 

ModText x = treatment/y = stable_hous/m = hous_conts

/xn ='Treatment' yn ='Days Housed'

mn='Housing Contacts' alpha =.05

ofile= 'C:\modtext.txt' clist='' directory='C:\'.

 

The defaults are as follows:

x = X

y = Y

m = M

xn ='Causal Variable'

yn ='Outcome'

mn ='Moderator' 

alpha =.05

ofile ='modtext.txt'

clist =

directory ='C:\'

That is, if you just say "ModText." the program will assume that are variables in the SPSS data file with variables named X, Y, and M.

 

The data file should be open; if either the causal variable or moderator is dichotomous, values should be given for both levels of the variable in the SPSS file; and labels should be given for the causal variable and the moderator.

 

ModText was written on SPSS 16 and 18, and there is no guarantee that it work on earlier or later versions of SPSS. It appears that the three tables at the end of the file are incorrect if SPSS 15 or earlier is run.

 

ModText does recognize that the Causal Variable and the Moderator are dichotomies and alters the outcome accordingly. For a dichotomous variables, predicted means are given for the two levels of that variable; otherwise predicted means are given for +1 and -1 standard deviation above the mean.  For dichotomies, the output is clearer if there are meaningful labels in the data file.

 

The macro:

allows for only a single causal variable, moderator, and outcome (however, if there are either multiple moderators or causal variables, they could be treated as covariates and pairs of causal variables and moderators could be examined one at a time),

presumes that the moderation is linear and not non-linear (e.g., quadratic) but ModText does test for nonlinearity

presumes that the outcome variable is measured on an interval scale, and

uses listwise deletion.

 

Variables in the macro:

 

   x = name of the causal variable in the SPSS data set (do not use quotes)

   y = name of the outcome variable in the SPSS data set

   m = name of the moderating variable in the SPSS data set

   xn = name of the causal variable in the text output (use quotes; spaces are allowed)

   yn = name of the outcome variable in the text output (use quotes; spaces are allowed)

   mn = name of the moderating variable in the text output  (use quotes; spaces are allowed)

(For the above three variables, it is advised to use English names and not SPSS acronyms. Also it is advised to capitalize the first letter of each word.  Avoid using more than 15 characters.)

   alpha  = significance level (defaults to .05)

   ofile = the name of the output file (use quotes); this is where you go to find the text

   clist = the SPSS names of the covariates separated by spaces

   directory = the name of the directory where temporary files are written (use quotes); this must be a directory you are allowed to write on; ModText may leave some files on this directory when it is done.

 

It is safest to give arguments for all macro variables.  Note carefully what terms have quotes and what do not and where the slashes are where they are not.

 

There is no guarantee for accuracy.  Examine not only DataToText output file, but also the SPSS output file.  The user needs to edit the ModText output in research reports. Please cite this ModText webpage if you do use it.  Moreover, you need a footnote that says: “Some of the material here was produced by the macro ModText (Kenny, 2010).”  It is also strongly encouraged that if you use essentially the same material as generated by Modtext, that you put such material in quotations.

 

If a non-English version of SPSS is being used, ModText changes the language to English. It does not currently change the language back to the original language.

 

Warnings

 

ModText provides 8 possible warnings. The user needs to pay careful attention to them.

 

1. The outcome variable is dichotomous and logistic regression, not multiple regression, should be used. The output from ModText in this case is wrong! One might consider the Andrew Hayes macro ModProbe.

 

2. Because zero is not a possible value for the causal variable, grand-mean centering that variable should be considered.

 

3. Because zero is not a possible value for the moderator, grand-mean centering that variable should be considered.

 

4. One standard deviation below (above) the mean for the causal variable is below (above) its minimum (maximum) value. This occurs for the example (see below). The lowest possible and observed score is zero, but minus 1 sd is a negative value.

 

5. One or more of the predicted means is either lower than its minimum value or larger than its maximum value. If there are covariates make sure they are centered. There might be inappropriate assumption about the level of measurement of the outcome or a floor or ceiling effect for that measure.

    

6. There are outliers in the dataset. Examine the output to see what cases are considered to be outliers. ModText uses an the SPSS definition of plus or minus three and one half standard deviations to determine if a case is an outlier. It should be noted that this procedure is very conservative and not a very robust way of determining outliers.

 

7. The causal variable and the moderator are highly correlated and this colinearity reduces the precision in the estimation of moderation parameters. ModText use .5 as the cutoff for high colinearity.

 

8. There is evidence that the effect of the moderator or the causal variable is nonlinear and either a data transformation or a nonlinear term might be advisable.

 

Again the user needs to pay special attention to these warnings and make the necessary modification.

 

Details on the Output

 

Some of the output might not be clear. If so, the user should consult Aiken and West and other sources cited at the end of the macro.

 

Effect sizes: For the interaction, unless both variables are dichotomous, ModText uses f squared. It represents the proportion of variance explained by the interaction not explained by other variables in the model. Almost certainly, the standards that Cohen gave for small, medium, and large effects are way too optimistic for test of interactions.

 

For main effects, the partial correlation coefficient is used unless the variable is a dichotomy and then d is used. If both the causal variable and the moderator are dichotomous, d is used as the effect size for the moderator effect.

 

Power analysis: ModText takes the sample size and the number of covariates and does a power analysis for a small and a medium effect size.

 

Tests of non-linearity: ModText does not report the quadratic main effects. The user would need to examine the output. Certainly, sometimes the finding of nonlinearity may just be a Type I error.

 

Regions of significance: Most readers will be unfamiliar with these procedures. Consult Aiken and West and other sources for more detail.

 

Links

 

My Moderation Page

 

Andrew Hayes Macro ModProbe (easier to use and allow for a dichotomous outcome)

 

DataToText Page

 

Macro Output

 

If Notepad is used make sure you use the wordwrap option in formal. Also for the tables to align use Courier font.

 

The output using sample data:

 

WARNING:  1.  One standard deviation below the mean for Housing Contacts or -.095 is below its minimum value of .000.

 

MODERATION MODEL

 

        The causal variable is Treatment, a dichotomy, 42.2% Controls and 57.8% Experimentals. the outcome variable is Days Housed, and the moderator variable is Housing Contacts.  The causal model is as follows: The variable Treatment is presumed to cause Days Housed linearly whose causal effect is presumed to be altered linearly by Housing Contacts.

 

RESULTS

 

Descriptives

 

        There are a total of 109 cases.  The power of the test of moderation assuming that f squared is .02 (a small effect size, but optimistic according to Aguinis (2004)) is .11, and the power of the test of moderation assuming that f squared is .15 (a moderate effect size) is .52.  The means and standard deviations are presented in Table 1.  The unexplained standard deviation in Days Housed is equal to 11.711, and the multiple correlation for the regression equation is .473.

 

Effects of Treatment and Housing Contacts                                           

 

        The results of the moderated regression analysis are summarized in Table 2.  The overall effect of Treatment on Days Housed, when Housing Contacts is equal to zero, is 2.482 (p = .441), with a small effect size (d = .212). The overall effect of Housing Contacts on Days Housed, when Treatment is equal to zero, is 4.792 (p = .005), with a small effect size (r = .269). The mean of Days Housed for the Controls is equal to 9.563 and the mean of Days Housed for the Experimentals is equal to 12.045.

 

Interaction Effects

 

        The interaction between Treatment and Housing Contacts is equal to 1.666 and is not statistically significant (p = .492), with a less than small effect size (f squared = .0045).  As the Housing Contacts increases, the causal effect of Treatment, though not statistically significant, is amplified or strengthened.  The effect of Treatment for persons who are one standard deviation below the mean on Housing Contacts (-.095) is equal to 2.323 (p = .492) with a less than small effect size (d = .198); the effect of Treatment for persons who are one standard deviation above the mean on Housing Contacts (1.826) is equal to 5.524 (p = .089), with a small effect size (d = .472).  (See Table 3 and the graph or table as the end of the SPSS output.)

 

Test of Nonlinearity                                                                

 

        The test of nonlinearity is as follows:  The quadratic interaction effect of Housing Contacts with Treatment is -3.041 and is not statistically significant (p = .084).

 

Regions of Statistical Significance                                                 

 

        Considered here are regions of Housing Contacts in which the effect of Treatment on Days Housed are statistically significant (Aiken & West, 1991).  The effect of Treatment is not statistically significant at all in the range of possible values of Housing Contacts.

 

 

                        Table 1: Descriptive Statistics

 

Variable                  Mean        Standard Deviation

--------------------------------------------------------

Treatment                 .422              .496

Housing Contacts          .865              .961

Days Housed             15.552            13.107

 

                  Table 2: Moderated Regression Coefficients

 

Predictor                        Estimate      Effect Size        p

-------------------------------------------------------------------

Intercept                          9.563                      <.001

Treatment                          2.482          .212         .441

Housing Contacts                   4.792          .269         .005

Treatment x Housing Contacts       1.666         .0045         .492

 

(Note that the effect size measure in Table 2 is d for Treatment, r for Housing Contacts, and f squared for the interaction.)

 

Table 3: Predicted Means for the Causal Variable and the Moderator (+1 and -1 sd)                                                                             

                             Housing Contacts

Treatment                   -.095          1.826

------------------------------------------------

          Controls          9.106         18.314

     Experimentals         11.428         23.839

 

                               References

 

      Aguinis, H. (2004). Moderated regression. New York: Guilford.

      Aiken, L. S., & West, S. G. (1991). Multiple regression: Testing and interpreting interactions. Thousand Oaks, CA: Sage.

      Baron, R. M., & Kenny, D. A. (1986).  The moderator-mediator variable distinction in social psychological research: Conceptual, strategic and statistical considerations. Journal of Personality and Social Psychology, 51, 1173-1182.

 

 

Bar graph from the SPSS output:

 

 

Line graph from the SPSS output:

 

Return to the Top of this Page

 

Return to the DataToText Page