Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I think my question is similar to this one: How do you plot an interaction between a factor and a continous covariate?

My IV and DV are both scales, and my interaction term has 3 levels. I am trying to look for associations between my IV and DV so I need to be using correlation coefficients rather than means... I think!

Basically, someone suggested to me doing a bar chart (because it would show the difference more clearly), with the three interaction levels on the x axis and the IV/DV r on the Y axis. I think that's what they were suggesting but it has completely baffled me! I have no idea how to use r in this way...

Any help would be great :)

EDIT: Just to clarify, I have done a regression to look for significance, and then also an ANCOVA because it was significant. But what i'm really asking is for a way to illustrate my findings in a figure.

share|improve this question
    
If you have three levels of you interaction term, it does not sound like a nominal(i.e. yes/no) but an ordinal or categorical term). I suggest editing you question ad/or title to clarify. –  Alexis May 13 at 12:37
    
Thanks for pointing that out, silly mistake of mine! –  ConfusedIndividual May 13 at 16:23
    
@Alexis "nominal" means two-level? I can't find any support for that definition. Is there a particular context for it? –  xan May 18 at 20:10
    
@xan I guess I interpret nominal as always implying dichotomous/binary representation, since multiple (not ordinal) categories are analytically represented with binary indicators. –  Alexis May 19 at 17:42
add comment

2 Answers 2

No, you will probably not look at correlations - the appropriate method is ANCOVA with an interaction term.

You will want to plot the DV against the IV separately per level of the factor. I don't really see how barplots can help here. Let's create some toy data in R:

set.seed(1)
ff <- factor(rep(LETTERS[1:3],10))
iv <- rnorm(length(ff))
dv <- rnorm(length(ff),as.numeric(ff)-as.numeric(ff)*iv)
foo <- data.frame(ff,iv,dv)

Now, there are at least two different ways of plotting this. You can create an interaction plot of the raw data like this:

plot(range(iv),range(dv),type="n",xlab="IV",ylab="DV")
for ( ii in seq_along(unique(ff)) ) {
    with(foo[foo$ff==unique(ff)[ii],],
      lines(sort(iv),dv[order(iv)],lty=ii,type="o",pch=19))
}
legend("topright",inset=.01,lty=seq_along(unique(ff)),legend=unique(ff))

interaction plot of raw data

Or you can fit a model and plot the fitted values:

model <- lm(dv~iv*ff,foo)
plot(range(iv),range(dv),type="n",xlab="IV",ylab="DV")
for ( ii in seq_along(unique(ff)) ) {
    newdata <- data.frame(ff=unique(ff)[ii],iv=range(iv[ff==unique(ff)[ii]]))
    lines(newdata$iv,predict(model,newdata),lty=ii)
}
legend("topright",inset=.01,lty=seq_along(unique(ff)),legend=unique(ff))

interaction plot of fitted values

This second alternative of course depends crucially on the model you assume. You can (really: should) refine it with confidence regions.

(You can also do something similar with the R interaction.plot() function, but I honestly don't like its output.)

share|improve this answer
    
ANCOVA is necessarily the appropriate method: regressions (whether OLS, nonlinear, nonparametric) are also appropriate. Nice answer though. –  Alexis May 13 at 12:46
    
Thanks. I assume you wanted to write that "ANCOVA is not necessarily the appropriate method"? (Which I agree with, but ANCOVA is usually a good first step - better than correlations, anyway.) –  Stephan Kolassa May 13 at 12:48
    
I'm pretty sure Alexis meant ANCOVA isn't necessarily the method. I'd carry this further. As soon as you put an interaction in then it isn't ANCOVA anymore. ANCOVA is about ignoring the covariate because you know it has no relationship to the other predictors. If you're assessing the covariate as a predictor it's not ANCOVA but regression analysis. –  John May 13 at 12:49
    
Oops. yep: "ANCOVA is not." –  Alexis May 13 at 12:53
add comment

Typically two continuous variables, one dependent, one independent are plotted with some kind of regression line (dependent variable on the y axis). With a nominal (or categorical) interaction term, you would simply plot two (or more) regression lines on the same graph, and label each line according to the values of the interaction term.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.