2
$\begingroup$

I need to determine if there is any relationship between two count variables. I have 60+ observations for 4 variables and I want to see if any of the pairs of these variables are significantly correlated with one another.

Mostly I use R, so forgive me if you're not familiar.

I have been using the cor(...,method="pearson") and cor.test() functions to test each pair, but now I'm not so sure that this is the right approach/test. Would a non-linear regression like glm(...,family="poisson") be more appropriate?

I started thinking like this because when I looked at a histogram of the counts across my observations, I noticed that there seemed to be a slight tendency for the pink and green variables to go up and down to together.

I produced a scatter plot of each of the variables plotted against each of the other variables. I used the tests mention above to try and quantify this relationship and to test weather it was real or just noise.

enter image description here enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Do you have any thoughts about what kind of relationships might exist? Do you think these are a function of something? Eg, do you think var1 might be caused by var2, or some factor outside of these 4 vars? Do you think they might all serve as measures of the same underlying construct? One thing to bear in mind is that since they are counts, they should be distributed as Poisson; so, eg, taking logs may be appropriate. $\endgroup$ Commented Mar 18, 2012 at 14:54
  • $\begingroup$ No thoughts as to what might be there. I will add some images to the above post to show why I started thinking this way. Perhaps that might help. $\endgroup$ Commented Mar 18, 2012 at 15:02
  • $\begingroup$ also for the scatter plots I removed the massive outlier in YY1. $\endgroup$ Commented Mar 18, 2012 at 15:11
  • $\begingroup$ It strikes me that you could look at the correlation matrix of the four variables. You can do this by putting all the data into one data.frame, and then run cor(). For a simple test to see if correlations EXIST, you could use something like cortest.bartlett(my.correlation.matrix, n=60), but that doesn't help you find out what the relationships are. If you follow @gung 's answer below, you could look at the correlation matrix to gather intuition about what relationships might exist, and then run a new study to investigate those suspected relationships. $\endgroup$
    – Oliver
    Commented Mar 18, 2012 at 17:34

2 Answers 2

8
$\begingroup$

What you are doing is exploratory data analysis. Because you looked at your data first, and then decided to test something specific based on what you just saw, sample statistics (like r-scores) are going to be biased, and inferential statistics (like p-values) would not mean what they are purported to mean. (If that doesn't make sense, you may want to read my answer to a different question here, which should make the underlying ideas more understandable, although the ideas are applied in a different context.) To be clear, I have nothing against exploratory data analysis--I'm quite fond of it, it's just important to realize which game you're playing and what that means for how you think about what you're doing and what you find. With that in mind, I would take the log of all your counts (looking at your numbers, I would probably use log base-2, then each unit would be interpretable as a doubling of the underlying count). Then I would simply make a scatterplot matrix overlaid with loess lines. In R, in the car package, scatterplot.matrix() will do this for you and make it pretty. I would then just use my judgment to assess the situation because of the bias issues noted above. If you want a formal model and hypothesis tests, I would figure out what I thought might be true (and if it were interesting & important, etc.) and then gather a new dataset specifically to test that hypothesis.

$\endgroup$
2
  • $\begingroup$ +1 for reminding people of assumptions. Of course, with p-values, most people interpret them incorrectly even when the assumptions are met, but that's a different issue. $\endgroup$
    – Peter Flom
    Commented Mar 18, 2012 at 19:20
  • $\begingroup$ Very clear, thoughtful, useful. Which is no surprise :-) $\endgroup$
    – rolando2
    Commented Mar 18, 2012 at 20:42
0
$\begingroup$

If you have no assumptions whatsoever and you simply want to see if any of the variables are correlated with the outcome then just use

regress1<-lm(y~x1+x2+x3+x4)

and don't complicate your life ;) ... just look if the t-statistic is >2 for any of the explanatory variables and you've got some correlations that are statistically significant.

However, if you want to fit the best model possible then you'd have to provide more input about what sort of data you have.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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