academic_home‎ > ‎Statistics‎ > ‎

SAS macros

Moderation (05/29/2006)
      Y-hat = b0 + b1X + b2Z + b3XZ, where Y, X, Z are continuous.

      e.g. %TestModeration(data=mydata,y=DV,x=IV,mod=moderator);
             %TestModeration(data=mydata,y=DV,x=IV,mod=moderator,plot=yes);
             %TestModeration(data=mydata,y=DV,x=IV,mod=moderator,plot=yes,plotline=3);
             %TestModeration(data=mydata,y=DV,x=IV,mod=moderator,TestSimpleSlope=yes);
             %TestModeration(data=mydata,y=DV,x=IV,mod=moderator,SimpleOutput=no);

      Want to retain the standard deviation of X and Z? Add SD_1=no, e.g.,
      %TestModeration(data=mydata,y=DV,x=IV,mod=moderator,SD_1=no);

      Want to add means of X and Z to the plot? Add AddMeanInPlot=yes, e.g.,
      %TestModeration(data=mydata,y=DV,x=IV,mod=moderator,AddMeanInPlot=yes);

      Want to plot a 3D graph (Behrens & Yu, 1994)? Add plot3D=yes, e.g.,
      %TestModeration(data=mydata,y=DV,x=IV,mod=moderator,plot=yes,plot3D=yes);

      Want to have a short output? Add the parameter verbose=no.
      Y-hat = b0 + b1X + b2Z + b3XZ
               = (b0 + b2Z) + (b1 + b3Z)X

      e.g. %SimpleSlope(data=mydata,y=DV,x=IV,z=conditional variable,zcv=1);
      where zcv means conditional value for the conditional variable
      Y-hat = b0 + b1X + b2Z + b3W + b4XZ + b5XW + b6ZW + b7XZW, where X, Y, Z, W are continuous.

      All parameters are the same as in %TestModeration, except mod1=, mod2=.
      e.g. %Test3wayMod(data=mydata,y=DV,x=IV,mod1=Z,mod2=W);
              %Test3wayMod(data=mydata,y=DV,x=IV,mod1=Z,mod2=W,plot=yes);

      Want to have a short output? Add the parameter verbose=no.

      Want to have separate graphs for W=low and high (Aiken & West, 1991), change the parameter plotcombine=no.

      Want to test for simple slope differences (Dawson & Richter, in press)? Add the paramter TestSimpleSlopeDiff=yes.
      Y-hat = b0 + b1X + b2Z + b3W + b4XZ + b5XW + b6ZW + b7XZW
               = (b0 + b3W) + (b1 + b5W)X + (b2 + b6W)Z + (b4 + b7W)XZ

      e.g. %ConditionalMod(data=mydata,y=DV,x=IV,z=moderator,w=conditional variable,wcv=1);
      where wcv means conditional value for the conditional variable
      Y-hat = b0 + b1X + b2X² + b3Z + b4XZ + b5X²Z

      All parameters are similar as in %TestModeration.
      e.g. %TestModeration2(data=mydata,y=DV,x=IV,mod=moderator,plot=yes);
      Y and X are continuous; moderator is nominal (Cohen, Cohen, West, & Aiken, 2003)
      The nominal variable has p levels and is represented by (p-1) dummy variables.
      When p=3, Y-hat = b0 + b1X + b2D1 + b3D2 + b4XD1 + b5XD2

      e.g. %TestNominalMod(data=mydata,y=DV,x=IV,mod=moderator);


Polyserial correlation (06/17/2006)

  • Estimate the polyserial correlation coefficients (ver 0.2)  Example output: n=1000, rho=.50.

    This SAS macro gives six estimations of the polyserial correlation, while providing everything you can think of for a polyserial correlation. The first three (Ad Hoc, Two-Step, ML) are based on Olsson, Drasgow, and Dorans (1982), the results of which would be highly similar to those computed by the polycor R package (Fox, 2004). The last three (Method 1, 5, 7) are based on Joreskog (1986); the result of Method 5 would be highly similar to that computed by PRELIS.

References
  • Moderation
    * Aiken, L. S., & West, S. G. (1991). Multiple Regression: Testing and interpreting interactions. Newbury Park, CA: Sage.
    * Behrens, J. T., & Yu, C. H. (1994, June). The visualization of multi-way interactions and high-order terms in multiple regression. Paper presented at the Annual Meeting of the Psychometric Society, Urbana-Champaign, IL.
    * Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences (3rd ed.). Mahwah, NJ: Lawrence Erlbaum.
    * Dawson, J. F., & Richter, A. W. (2006). Probing three-way interactions in moderated multiple regression: Development and application of a slope difference test. Journal of Applied Psychology.
  • Polyserial
    * Fox, J. (2004). Polycor: polychoric and polyserial correlations. R package version 0.7-0.
    * Joreskog, K.G. (1986). Estimation of the polyserial correlation from summary statistics. Research Report 86-2. Uppsala: University of Uppsala, Department of Statistics.
    * Olsson, U., Drasgow, F., & Dorans, N. J. (1982). The polyserial correlation coefficient. Psychometrika, 47(3), 337-347.
Comments