Interaction between two continuous variables

From PsychWiki - A Collaborative Psychology Wiki

(Difference between revisions)
Jump to: navigation, search
Jchristie (Talk | contribs)
Jchristie (Talk | contribs)
(R commands)
 
Line 69: Line 69:
==R commands==
==R commands==
-
*Assuming you have your data in a comma delimited text file called 'myGreatData.csv' with the first line (header) labels the three columns 'y, x1, x2', the following command will generate your regression.  Note that these commands are the minimum and assume the same things are true as are true in the SPSS example above (centering, assumptions of the regression are met, etc.).
+
*Assuming you have your data in a comma delimited text file called 'myGreatData.csv' and the first line (header) labels the three columns 'y, x1, x2', the following command will generate your regression.  Note that these commands are the minimum and assume the same things are true as are true in the SPSS example above (centering, assumptions of the regression are met, etc.).
*#setwd( 'dataDir' ) #Set the working director to the path to your data file.  You could skip this step and just enter the full path into the next step.
*#setwd( 'dataDir' ) #Set the working director to the path to your data file.  You could skip this step and just enter the full path into the next step.
*#dat <- read.csv( 'myGreatData.csv', header = TRUE ) #load your data file into the variable 'dat'
*#dat <- read.csv( 'myGreatData.csv', header = TRUE ) #load your data file into the variable 'dat'

Latest revision as of 16:49, 5 August 2011

Statistical programs, like SPSS, do not always have "point-and-click" commands for every possible statistical test. This page is a description of how to test the interaction between two continuous variables. Three approaches are described below:
(1) three steps to conduct the interaction using commands within SPSS, and
(2) Interaction! software by Daniel S. Soper that performs statistical analysis and graphics for interactions between dichotomous, categorical, and continuous variables.
(3) R commands for executing the analysis.

*For a description of what is an interaction and main effects, please see the accompanying page about What is an Interaction?.


Contents


Three Steps using SPSS

There are three steps involved to calculate the interaction between two continuous variables.

Center the two continuous variables


Create the interaction term


Conduct Regression



Interaction! software

R commands


◄ Back to Analyzing Data page

Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox