Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have three variables I'd like to analyze. Two of them are step values - one set ranges from 1-6 and the other ranges from 1-5. The third variable is not a step value but can have a relatively wide range of possible values. I'm trying to determine if my third variable is related/correlated to either of the two step values.

The step values represent differing pay grades and rankings while the non-step variable represents pay. How can I test if pay is related to pay grade and/or rankings? And is there a way to graph all three variables in one chart?

share|improve this question

migrated from Sep 18 '09 at 15:54

This question came from our site for professional and enthusiast programmers.

Why was this migrated from SO? – J. Polfer Sep 21 '09 at 13:07

Should be able to graph that with a 3-d surface graph or "forest graph"- the two step functions define the plane and the non-step value is the elevation.

To analyze the correlation, I'd define a combined step function over the thirty cells defined by the plane of the two existing step functions.

share|improve this answer

JHC - R Statistical is an open source statistics package that runs on all major platforms ( and does a very nice job of analysis. The following sample code would take copied data (columns of Rank, Grade and Pay) and give you the analysis you're looking for.

mydata <- read.table("clipboard",header=TRUE);



coplot(Rank ~ Grade | Pay, data = mydata);






(for more - search help using the following commands:) help(lm); help(anova); help(coplot);

share|improve this answer

Sorry JDB - I tried R and I'm just not understanding it. I can't get R to read in my data (heck I can't even figure out where R wants me to put the data).

From what I'm seeing in the code example though. you're suggesting using an ANOVA test? Is there any reason the cor function only looks at Rank and Grade?

share|improve this answer
@user11629: read.table("clipboard") will read in data from the clipboard in Windows (you have to have copied the data from another program/text editor/etc.) As far as the cor function - a simple correlation only looks at two variables. cor(mydata$Rank,mydata$Grade) could also be cor(mydata$Rank,mydata$Pay) or cor(mydata$Pay,mydata$Grade). Since the question was about graphing these variables and determining correlations, this would get the job done. However, the original asker does need to consider the statistics behind these analyses. – JDB Oct 20 '10 at 15:59

Your Answer


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