5
$\begingroup$

I have two Gamma random variables. I need a hypothesis test to detect a possible correlation between them.

$\endgroup$
2
  • $\begingroup$ Do you want linear correlation, or some more general association? You only mention the marginal distributions (gamma) -- do you have some joint distribution (or some conditional distribution) in mind? $\endgroup$
    – Glen_b
    Jan 6, 2015 at 7:06
  • 1
    $\begingroup$ I have 2 covariance matrix having wishart distribution knowing the fact that diagonal entries of wishart will be gamma variable I want to have a test by which I can detect the correlation between the diagonal entries of these two covariance matrix which is actually a gamma variable. SO I need a linear correlation $\endgroup$
    – undefined
    Jan 6, 2015 at 8:51

3 Answers 3

4
$\begingroup$

For non-normal data, the traditional hypothesis test of the Pearson correlation can result in slightly inflated Type I error rates and much lower power, at least relative to alternative hypothesis tests. In a Monte Carlo study, Bishara and Hittner (2012) compared several alternative hypothesis tests for non-normal data. The permutation test generally preserved the Type I error rate at the nominal alpha level, but was underpowered when n >= 20. For sample sizes of at least 20, the most effective approach was data transformation to approximate normality prior to the traditional t-test of the Pearson correlation.

In your case, if you know the parameters of your population gamma distributions, then you can transform your samples appropriately. If not, you can use a Rank-based Inverse Normal transformation, such as rankit, as an approximation. After transforming the data, simply do a hypothesis test of the Pearson correlation as usual.

References: Bishara, A. J., & Hittner, J. B. (2012). Testing the significance of a correlation with non-normal data: Comparison of Pearson, Spearman, transformation, and resampling approaches. Psychological Methods, 17, 399-417. doi:10.1037/a0028087

$\endgroup$
4
  • $\begingroup$ For my system model n is very small for now I am using n=2 to n=6. but for all these sample size should be minimum 20. $\endgroup$
    – undefined
    Jan 22, 2015 at 11:16
  • $\begingroup$ And How can I determine the threshold for null hypothesis and alternate hypothesis to check whether it is correlated and I and use or not. $\endgroup$
    – undefined
    Jan 22, 2015 at 11:23
  • $\begingroup$ I'm afraid I don't understand. If n=2, r will be +/- 1. Can you elaborate? $\endgroup$
    – Anthony
    Jan 22, 2015 at 14:40
  • $\begingroup$ Yes for n=2 it will be +/-1 but for n>1 it will give some value. I want to decide threshold which will determine that it is correlated suppose if r>0.75 we can consider it is correlated hence I need to find out this threshold value. $\endgroup$
    – undefined
    Jan 23, 2015 at 11:32
0
$\begingroup$

You can use distance correlation by Szekely. R Package is called 'energy'. It is distribution agnostic and gamma doesn't matter. You can get a p-value of the test as well.

$\endgroup$
0
$\begingroup$

You can use the regular, old Pearson's product-moment correlation for this. The fact that your data are distributed as Gamma doesn't matter (cf.: Pearson's or Spearman's correlation with non-normal data). Most statistical software that can compute $r$ for you can provide you with a test. By default, such tests assess the null hypothesis that $r=0$; thus, a significant result suggests (detects) a correlation. Should you need to do it by hand, formulas are listed on the Wikipedia page; using Fisher's transform is convenient and popular. Here is a quick demo in R:

set.seed(8864)             # this makes the example exactly reproducible
g1u = rgamma(50, shape=5)  # these variables are distributed as Gamma
g2u = rgamma(50, shape=8)  # they are uncorrelated
cor.test(g1u, g2u)
# 
#         Pearson's product-moment correlation
# 
# data:  g1u and g2u
# t = 0.3079, df = 48, p-value = 0.7595
# alternative hypothesis: true correlation is not equal to 0
# 95 percent confidence interval:
#  -0.2368827  0.3188006
# sample estimates:
#        cor 
# 0.04439207
g1c = sort(g1u)
g2c = sort(g2u)  # now they are correlated
cor.test(g1c, g2c)
# 
#         Pearson's product-moment correlation
# 
# data:  g1c and g2c
# t = 28.9317, df = 48, p-value < 2.2e-16
# alternative hypothesis: true correlation is not equal to 0
# 95 percent confidence interval:
#  0.9518055 0.9843849
# sample estimates:
#       cor 
# 0.9725047

Using the test of the correlation detected (suggested, really—it can certainly be wrong, but that's the nature of any hypothesis test) when the variables were correlated. The fact that the variables were distributed as Gamma had no noticeable effect.

$\endgroup$
10
  • $\begingroup$ This will give the correlation between them I need a test to detect correlation. $\endgroup$
    – undefined
    Jan 6, 2015 at 6:52
  • $\begingroup$ The test of the correlation will do that. $\endgroup$ Jan 6, 2015 at 6:53
  • $\begingroup$ Can you explain briefly actually my problem is I have 2 random variable (gamma distributed) I want to check how much equality is there. But as it is random variable I need to detect correlation. So I need a threshold by which I can say that it is more correlated or less so i need hypothesis test for this to determine threshold $\endgroup$
    – undefined
    Jan 6, 2015 at 6:56
  • 1
    $\begingroup$ I notice cor.test assumes the Fisher transformation is close to Normally distributed. It would be interesting to see how well that assumption holds up for Gamma variates. $\endgroup$
    – whuber
    Jan 6, 2015 at 16:44
  • 2
    $\begingroup$ I did some tests. The problem areas are small shape values (as one would expect) but extend to moderate sample sizes (into the hundreds). The sampling distribution of the Fisher transformation of the correlation coefficient is noticeably positively skewed and a little kurtotic. It will appreciably affect one-sided tests of correlation much more than two-sided tests (where the skewness effects almost cancel). The effect is greater than the typical difference between, say, a Z-test and a Student t-test, and so might be worth some attention. $\endgroup$
    – whuber
    Jan 6, 2015 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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