## Graphing a 3-way interaction

Occasional Contributor
Posts: 8

# Graphing a 3-way interaction

Hello,

My colleague has performed an APIM analysis in proc mixed, and obtained a significant three-way interaction. The outcome variable is continuous (satisfaction). Two predictors are continuous (perceptions and drinking) and one predictor is dichotomous (gender).

I would like to graph this 3-way interaction (perception*drinking*gender). Preferrably, I would like two windows, one displaying the 2-way interaction (perceptions and drinking) for males and one window for females.

Do anyone have any tips to help me graph this interaction?

Thank you!

Super Contributor
Posts: 297

## Graphing a 3-way interaction

proc gplot;

by gender; *for 2 graphs;

plot perception*drinking;

run;

plot perception*drinking=gender; *both on one graph;

run;

Occasional Contributor
Posts: 8

## Graphing a 3-way interaction

Hi Bill,

Thanks so much. However, those plots do not model the outcome variable (satisfaction). They just give a scatterplot of the data of two variables (by the third variable, gender). The interaction plot should give  us two lines that intercept each other. The plots outputted by the code would only give us one line (the relationship between perception and drinking).

Super Contributor
Posts: 297

## Graphing a 3-way interaction

Could you post a number of records for me to play with?

Super User
Posts: 10,787

## Graphing a 3-way interaction

Maybe you need this:

symbol i=j v=none r=200;

proc gplot;

by gender;

plot perception*drinking=idno;

run;

idno is number of patient.

r= is repeat 200 times which is 200 patients.

i.e. How many patients you have ,how many repeated times(200)

Ksharp

Discussion stats
• 4 replies
• 1795 views
• 0 likes
• 3 in conversation