# Statistical testing of step variables

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?

-

## migrated from stackoverflow.comSep 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.

-

JHC - R Statistical is an open source statistics package that runs on all major platforms (http://www.r-project.org/) 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.

plot(response);

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

fit=lm(response);

afit=anova(fit);

afit;

plot(fit);