## Background

Simple slopes analysis is a useful technique commonly seen in the social sciences to examine and visualise how one variable moderates the association between two variables (James & Brett, 1984). The term moderate is used here in its strict statistical sense. In simple slope plots, we visualise the effect of one variable on the dependent variable of interest at specific levels of another variable.

There have been a number of requests to document a tutorial on how to conduct a simple slope analysis. This post provides a worked example of how to go about this using the following journal article as a data source. The table of descriptive statistics inside the article is used as input to generate a simulated (raw) data set using Monte Carlo estimation techniques. Note that this is interesting in itself as potentially any piece of research with an adequate set of published descriptive statistics can be reproduced and, moreover, re-analysed, and re-interpreted.

Chatzisarantis, N. L. D., & Hagger, M. S. (2007). Mindfulness and the intention-behavior relationship within the theory of planned behavior. Personality & social psychology bulletin, 33(5), 663–76. doi:10.1177/0146167206297401

## Summary

It is recommended to take a moment to read the article and consider for example how the authors establish how “Mindfulness moderates the Intention/Behaviour relationship”:

http://www.selfdeterminationtheory.org/SDT/documents/2007_ChatHagger_PSPB.pdf

In a nutshell, the published sample size, means and covariances of the observed variables in the article are used to generate a simulated data set using Monte Carlo analysis techniques. This data set is then analysed using structured equation modelling techniques to reproduce the originally published results and simple slopes analyses. In addition, the simulated data set enables additional analyses to be explored and other visualisations, e.g. 3D plots.

The following slide deck summarises the techniques and results produced. Step through this now, then return to it again after reviewing the content that follows. In particular, note the simple slope slides in which original graphs snipped from the article are compared side by side with the slopes calculated from the simulated data set. Inside the deck you will also find analyses not published in the original article, e.g. 3D plots and corresponding R code, scattergrams and also additional simple slope plots.

## Technique

### 0. Prepare Descriptive Statics

The MPlus Monte Carlo simulation routine will generate a simulated data set based on the model as represented in the MPlus Model section. The MPlus Model section expected the variables to be described in terms of covariances and variances and therefore the Descriptive Statistics section of the article needs to be coalesced into this format. This can be done using Excel as per this example:

https://github.com/StefanoPicozzi/SimpleSlopesAnalysis/blob/master/SimpleSlopes.xlsx

### 1. Monte Carlo Simulation

The simulated data sets are generated using Monte Carlo methods. The MPlus statistical package was used to create these data sets and the .inp instructions files used can be downloaded as per below. Note that all independent variables are set to N(0,1). Upon running these scripts in MPlus, the .out files show the generated output showing agreement with the model parameters and residuals as per the original journal article. An area for improvement could be to estimate interaction term correlations.

https://github.com/StefanoPicozzi/SimpleSlopesAnalysis/blob/master/montecarlo.zip

### 2. Trials

Various statistical analyses can be performed on the .dat simulated datasets and the .inp MPlus instruction files for these are downloadable below. There are three in all corresponding to Study 1, figure 1 and Study 2 figures 2a and 2b. The 3 scripts labeled *_Figure*.inp are used to reproduce the Simple Slope figures in the article.

https://github.com/StefanoPicozzi/SimpleSlopesAnalysis/blob/master/trials.zip

3. MPlus Plots

The exploratory data analysis plots using Mplus are zipped below. Each plot shows the model estimated dependent variable against the model estimated independent variable by group. Group is defined as very mindful vs less mindful coded as MNDPLUS and MNDMINUS indicating + or – 1 SD from mean. The “Fixed” extension indicates that the parameters were fixed to those as reported in the article, otherwise they are freely estimated.

https://github.com/StefanoPicozzi/SimpleSlopesAnalysis/blob/master/plots.zip

4. Excel Plots

These plots using Excel reproduce the Simple Slope plots of Figures 1, 2a and 2b in the article but using the simulated data as per Monte Carlo scripts. The Mplus output is copied across to Excel for graph generation as per below.

https://github.com/StefanoPicozzi/SimpleSlopesAnalysis/blob/master/SimpleSlopes.xlsx

#### Study 1 Data Dictionary

PHY ! Physical activity

INT ! Intentions

BCT ! Perceived behavioral control

ATT ! Attitudes

SUB ! Subjective norms

HAB ! Habit

MND ! Mindfulness

HABINT

MNDINT;

#### Study 2 Data Dictionary

PHY ! Physical activity

INT ! Intentions

BCT ! Perceived behavioral control

ATT ! Attitudes

SUB ! Subjective norms

HAB ! Habit

MND ! Mindfulness

BNG ! Habitual binge-drinking

BNT ! Binge-drinking intentions

HABINT

MNDINT

MNDBNT

MNDBNG;

Note that BNG and BNT are coded such that higher values would likely more negatively impact physical exercise intentions, e.g. high BNG suggests higher binge drinking.

## Step by Step Example

### Variances.xlsx

This is downloadable above and shows how to prepare the variables statistics in a form necessary for MPlus modelling, i.e. variances and covariances rather than standard deviations and correlations.

### Study-Model-MC.inp

This script is located in the montecarlo.zip download. Run this script inside MPlus to create a Monte Carlo simulated data set for Study1 based on the model represented in Step 4 of the article. The script will create an output file Study1-MC.dat

### Study1-Model-Plot.inp

This script is located in the trials.zip download. Run this script inside MPlus to create the exploratory data plots and scattergrams as appear in the slide deck above. The script will create a number of plot output files.

### Study1-Figure1.inp

This script is located in the trials.zip download. Run this script inside MPlus to create the simple slope plot as per Figure1 of the article. Simple slopes for two lines requires plotting 2 x 2 points in all. The script is reproduced below. The 4 points are calculated using MPlus constraints – ImMp, IpMp, ImMm, IpMm – and are reported in the “New/Additional Parameters” section on the MPlus model output. The intercept value (c = 0.008) was determined by running the script and inspecting and plugging back in the intercept reported in the model output.

### SimpleSlopes.xlsx

The coordinates are then plugged into the Excel spreadsheet for plotting as per link already reported above.

TITLE: Chatzisarantis, Hagger - 2007 - Mindfulness and the intention-behavior relationship within the theory of planned behavior Study 1 - Figure 1: The moderating effects of mindfulness on the intention-behavior relationship; DATA: FILE = Study1-Model-MC.dat; ! TYPE = MONTECARLO; VARIABLE: NAMES = PHY ! Physical activity INT ! Intentions BCT ! Perceived behavioral control ATT ! Attitudes SUB ! Subjective norms HAB ! Habit MND ! Mindfulness HABINT MNDINT; USEVARIABLES = PHY INT MND MNDINT; DEFINE: MNDINT2 = MND*INT; ANALYSIS: ESTIMATOR = ML; BOOTSTRAP = 1000; PROCESSORS = 3; MODEL: PHY ON INT (i1); PHY ON MND (m1); PHY ON MNDINT (m2); MODEL CONSTRAINT: NEW(ImMp, IpMp, ImMm, IpMm, c, Ip, Im, Mp, Mm); c = 0.008; Ip = 2; Im = -2; Mp = 2; Mm = -2; !Ip = 1.14; !Im = -1.14; !Mp = 1.74; !Mm = -1.74;ImMp = c + (i1*Im) + (m1*Mp) + (m2*Im*Mp); ! PHY = ImMp, INT = -1 IpMp = c + (i1*Ip) + (m1*Mp) + (m2*Ip*Mp); ! PHY = IpMp, INT = 1 ImMm = c + (i1*Im) + (m1*Mm) + (m2*Im*Mm); ! PHY = ImMm, INT = -1 IpMm = c + (i1*Ip) + (m1*Mm) + (m2*Ip*Mm); ! PHY = IpMm, INT = 1PLOT: TYPE = PLOT3; ! Computed values along with 95% CI OUTPUT: SAMPSTAT STANDARDIZED TECH1;

Hi,

Nice post & thank you for sharing………..