The code generated by this utility can be pasted directly into an R console window. R (a free, open-source statistical computing environment) may be obtained here: http://cran.r-project.org/.
This web page calculates simple intercepts and simple slopes, the region of significance, and computes specific values to facilitate the plotting of significant two-way interactions in ordinary least squares (OLS) regression. The interaction can be between two dichotomous variables, two continuous variables, or a dichotomous and a continuous variable. We assume that the user is sufficiently knowledgeable in the testing, probing, and interpretation of interactions in multiple regression (e.g., Aiken & West, 1991; Bauer & Curran, 2004; Cohen, Cohen, West & Aiken, 2003). A more extensive treatment of interaction effects can be found here.
For the purposes of this page, we define y to be the dependent variable, x to be the predictor variable, and z to be the moderator. The regression equation of interest is thus
where is the model implied value of y, x is the first predictor, z is the second predictor, and xz is the product between the two predictors. Further, 0 is the intercept of the equation, and 1, 2, and 3 are the respective regression parameters. This equation may be rearranged to highlight that the regression of y on x (denoted the focal predictor) can be understood as a function of z (denoted the moderator):
The parenthetical terms in Equation 2 are called the simple intercept and simple slope, respectively. Equation 2 can be rewritten as:
The values of 0 and 1 are compound coefficients, the calculation of which is our purpose here. In practice, if the interaction term 3 is found to be significant at a given alpha-level, the regression of y on x is typically "probed" across values of z to better understand the nature of the conditional relation. If other predictors are included in the model (e.g., demographic covariates, etc.), the simple intercepts will be calculated and tested conditioned on values of zero for these covariates. For interpretational purposes, it is thus essential that values of zero be within the bounds of the data. We recommend that continuous covariates be mean centered prior to analysis and that a useful reference group be chosen for categorical covariates. Note, however, that the computation and testing of simple slopes (often of most interest) do not depend on the scaling of other covariates in the model.
The table below provides three sets of output that allow for further probing of the xz interaction.
The first available output is the region of significance of the relation between y and x as a function of z. The region of significance defines the specific values of z at which the regression of y on x moves from non-significance to significance. There are lower and upper bounds to the region. In many cases, the regression of y on the focal predictor is significant at values of the moderator that are less than the lower bound and greater than the upper bound, and the regression is non-significant at values of the moderator falling within the region. However, there are some cases in which the opposite holds (e.g., the significant slopes fall within the region). Consequently, the output will explicitly denote how the region should be defined in terms of the significance and non-significance of the simple slopes. There are also instances in which the region cannot be mathematically obtained, and an error is displayed if this occurs for a given application. By default, the region is calculated at = .05, but this may be changed by the user. Finally, the point estimates and standard errors of both the simple intercepts and the simple slopes are automatically calculated precisely at the lower and upper bounds of the region. Calculation of these simple intercepts and slopes at any value of z is described below.
The second available output is the calculation of point estimates and standard errors for up to three simple intercepts (0) and simple slopes (1) of y on x at specific conditional values of z. A simple slope is defined as the regression of the outcome y on the predictor x at a specific value of the moderator z. In the table we refer to these specific values of z as conditional values (cvz1, cvz2, and cvz3). We can choose from a variety of potential conditional values of z for the computation of the simple intercepts and slopes. If z is dichotomous (e.g., z is coded either 0 or 1 to denote gender), we could select cvz1=0 and cvz2=1 to compute the regression of y on x for males and for females (and cvz3 is left blank). If z is continuous, we might select values of z that are one standard deviation above the mean of z, equal to the mean of z, and one standard deviation below the mean of z. Whatever the conditional values chosen, these specific values are entered in the section labeled "Conditional Values of Z," and this will provide the corresponding simple slopes of y on x at those values of z. The calculation of simple intercepts and simple slopes at specific values of z is optional; the user may leave any or all of cvz1, cvz2, and cvz3 blank.
Given the calculation of one or more simple slopes, it is common to plot these relations graphically to improve interpretability of effects. The final available output is the calculation of a lower and upper value associated with each of the simple slopes to aid in the graphing of these using any standard software package (e.g., Excel, SPSS, etc.). These are provided to simply aid in the graphing of effects; no inferential tests apply here. If desired, the user enters any two values of x in order to plot the regression line between y and x at specific values of z. Although any pair of moderator values can be used, we recommend using either the lower and upper observed values of z, the lower and upper possible values of z, or one sd below and above the mean of z. However, many other specific values can be chosen that may be more appropriate for a particular research application.
Simple intercepts and slopes, the region of significance, and points to plot can be obtained by following these five steps. Use as many significant digits as possible for optimal precision.
Once all of the necessary information is entered into the table, simply click "Calculate." The status box will identify any errors that might have been encountered. If no errors are found, the results will be presented in the output window. The results in the output window can be pasted into any word processor for printing.
Below the output window are two additional windows. If conditional values of x and z are entered, clicking on "Calculate" will also generate R code for producing a plot of the interaction effect (R is a statistical computing language). This R code can be submitted to a remote Rweb server by clicking on "Submit above to Rweb." A new window will open containing a plot of the interaction effect. The user may make any desired changes to the generated code before submitting, but changes are not necessary to obtain a basic plot. Indeed, this window can be used as an all-purpose interface for R.
Assuming enough information is entered into the interactive table, the second output window below the table will include R syntax for generating confidence bands, continuously plotted confidence intervals for simple slopes corresponding to all conditional values of the moderator. The x-axis of the resulting plot will represent conditional values of the moderator, and the y-axis represents values of the simple slope of y regressed on the focal predictor.
If the moderator is dichotomous, only two values along the x-axis (corresponding to the codes used for grouping) would be interpretable. Therefore, in cases where x is continuous and z is dichotomous, we suggest treating z as the moderator for the simple slopes plot (so that each line will represent the regression of y on x at conditional values of z) and treating x as the moderator for the confidence bands / regions of significance plot (so that the x-axis will represent values of the focal predictor x and the y-axis will represent the group difference in y at conditional values of x). This will require switching the roles of x and z in the interactive table, requiring the entry of some new values from the ACOV matrix and re-entering old values in new places.
Regardless of what variable is treated as the moderator, the user is expected to supply lower and upper values for the moderator z (-10 and +10 by default). As above, this R code can be submitted to a remote Rweb server by clicking on "Submit above to Rweb." A new window will open containing a plot of confidence bands.
Aiken, L. S., & West, S. G. (1991). Multiple regression: Testing and interpreting interactions. Thousand Oaks: Sage.
Bauer, D. J., & Curran, P. J. (2005). Probing interactions in fixed and multilevel regression: Inferential and graphical techniques. Multivariate Behavioral Research, 40, 373-400.
Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences, 3rd ed. Hillsdale: Erlbaum.
Preacher, K. J., Curran, P. J., & Bauer, D. J. (2006). Computational tools for probing interaction effects in multiple linear regression, multilevel modeling, and latent curve analysis. Journal of Educational and Behavioral Statistics, 31, 437-448.