Handout 15

Interaction Examples


Introduction

Presented below are some examples in R assessing data sets for interaction. The data set used is a variation of the diesel data set from Mendenhall. In the examples, performance is the dependent variable, and brand and fueltype are the independent variables. Dummy variables are created usings the R for and if statements.

The data sets used are as follows:

The complete R analysis file is available here. Note that I used the R interaction.plot procedure to create the plots with the averages. I've also performed the analysis in SAS (sas file here) with these results.

diesel1.dat
Analysis of Variance Table

Response: performance
           Df   Sum Sq  Mean Sq F value Pr(>F)
b1          1 0.000833 0.000833  0.0769 0.7908
f1          1 0.000417 0.000417  0.0385 0.8510
f2          1 0.011250 0.011250  1.0385 0.3475
I(b1 * f1)  1 0.000417 0.000417  0.0385 0.8510
I(b1 * f2)  1 0.011250 0.011250  1.0385 0.3475
Residuals   6 0.065000 0.010833               

Click plot to enlarge

diesel2.dat
Analysis of Variance Table

Response: performance
           Df  Sum Sq Mean Sq F value    Pr(>F)    
b1          1 0.65333 0.65333 49.0000 0.0004235 ***
f1          1 0.00375 0.00375  0.2812 0.6149275    
f2          1 0.01125 0.01125  0.8437 0.3937537    
I(b1 * f1)  1 0.00042 0.00042  0.0312 0.8655000    
I(b1 * f2)  1 0.01125 0.01125  0.8437 0.3937537    
Residuals   6 0.08000 0.01333                   

Click plot to enlarge
diesel3.dat

Analysis of Variance Table

Response: performance
           Df Sum Sq Mean Sq  F value    Pr(>F)    
b1          1 0.0008  0.0008   0.0769    0.7908    
f1          1 6.1004  6.1004 563.1154 3.676e-07 ***
f2          1 2.3113  2.3113 213.3462 6.463e-06 ***
I(b1 * f1)  1 0.0004  0.0004   0.0385    0.8510    
I(b1 * f2)  1 0.0113  0.0113   1.0385    0.3475    
Residuals   6 0.0650  0.0108         

Click plot to enlarge
diesel4.dat

Analysis of Variance Table

Response: performance
           Df  Sum Sq Mean Sq   F value    Pr(>F)    
b1          1  3.1008  3.1008  286.2308 2.726e-06 ***
f1          1 24.2004 24.2004 2233.8846 6.013e-09 ***
f2          1  8.6113  8.6113  794.8846 1.318e-07 ***
I(b1 * f1)  1  0.0004  0.0004    0.0385    0.8510    
I(b1 * f2)  1  0.0112  0.0112    1.0385    0.3475    
Residuals   6  0.0650  0.0108      

Click plot to enlarge
diesel5.dat

Analysis of Variance Table

Response: performance
           Df  Sum Sq Mean Sq   F value    Pr(>F)    
b1          1  0.0008  0.0008    0.0769  0.790819    
f1          1 13.6504 13.6504 1260.0385 3.332e-08 ***
f2          1  0.6613  0.6613   61.0385  0.000232 ***
I(b1 * f1)  1  1.4504  1.4504  133.8846 2.507e-05 ***
I(b1 * f2)  1  4.0613  4.0613  374.8846 1.229e-06 ***
Residuals   6  0.0650  0.0108                        

Click plot to enlarge