# Correlation test for $x$ and $y$ values of a list

If I have the following data:

data={{-7.10543*10^-15, 3.29215}, {-7.10543*10^-15, 2.94365}, {-9.03439,
2.4954}, {-8.8538, 3.33308}, {-10.0876, 3.1443}, {-2.49194,
2.00957}, {-2.98661, 3.35066}, {-6.39488*10^-14,
3.29215}, {2.84217*10^-14, 2.73316}, {8.67852, 2.05735}, {2.85633,
3.04537}, {11.1115, 2.49008}, {2.74509, 3.11135}, {13.5305,
2.20002}};


How can I calculate in Mathematica if the x-values and the y-values are correlated with each other using the t-test?. I am trying something simple as TTest[data, Automatic, "TestDataTable"] but I do not know if the given table has to do with a correlation between the x and y values. Would the table given by Mathematica mean that there is a strong correlation between both the x and y values? or is there any other way to do this in Mathematica?

• ‘PairedTTest’ ? – JimB May 5 at 2:38
• @JimB THE PairedTTest gives me the exactly same table than TTest[data, Automatic, "TestDataTable"] and I am unsure if the p value given 8.16...E-11 means that the x and y value are correlated (increasing x, decreases y, for example) or not – John May 5 at 2:48
• Sorry about that. I shouldn't have made a comment from my iPhone. It turns out that you need to Transpose your data to get it to work: PairedTTest[Transpose[data], 0, "TestDataTable"]. – JimB May 5 at 3:45
• @JimB thank you! I get a p-value of 0.22. Would that mean that the x and y values correlate between each other or the opposite? – John May 5 at 4:31
• What that suggests is that if there really is no difference in the means, the probability of getting at least as large an absolute difference as observed, is 0.22. Technically, that's all that tells you. What many do is treat that as no evidence of a difference in a mean. That's an improper inference but that is better discussed at CrossValidated (the Statistics StackExchange site). If you want to estimate the correlation between $x$ and $y$, use Correlation. – JimB May 5 at 5:07

CorrelationTest[data, Automatic, "TestDataTable"]

The $$p$$-value indicates that, were you to pick the standard 5% risk level, you would not have grounds to reject the (null-) hypothesis that there is no correlation between your $$x$$ and $$y$$ variables. The graphic tells you that you are close, and that further investigation (i.e. more data) would be wise. If there is a correlation it is likely to be negative. The $$t$$-test will do something entirely different: tell you if the means of $$x$$ and $$y$$ are equal of different.