I want to conduct a paired test on two populations with ratio metrics in R. I'm really puzzled when I do a search in the web. Some tutorials suggest t-test or z-test and I am complete lost. I had the impression that t-test is used only with mean values while z-test on ratios, but the latter is also suggested with mean values.

I want to find the ideal hypothsis testing to compare the following. x = [0.14, 0.94, 0.82, 0.59, 0.55 , ..., 0.31] y = [0.24, 0.43, 0.71, 0.56, 0.53 , ..., 0.33] where both vectors share the same length.

  • $\begingroup$ It depends on the your sample size. For a large samples sizes (>30) the t-test become equivalent to the z-test $\endgroup$
    – Dave2e
    Feb 19, 2021 at 17:36
  • $\begingroup$ @Dave2e Thank you for clarifing this detail. So in general t-test can be used regardless of variable type, it can be either continuous like weight or temperature or ratio like click rate? Also I have seen that proportional samples like conversion rate can be tested via z-test. Is there any categorization based on variable types to have as reference? $\endgroup$ Feb 19, 2021 at 19:13
  • 1
    $\begingroup$ I think this is a good reference: rcompanion.org/handbook, there is a whole section on choosing a statistical test. $\endgroup$
    – Dave2e
    Feb 19, 2021 at 19:21

1 Answer 1


When you are comparing two continuous variables, the first step is to determine if the variables are approximately normally distributed. If they are, the t-test is appropriate. If not, then a rank-based method like the Wilcoxon rank-sum test are indicated.

The next question is when to use a paired versus an unpaired version of the test. Paired tests are used to compare the same group that was measured on two occasions (e.g. before and after measurements, repeated measures). The paired t-test has a rank-based equivalent called the Wilcoxon signed-rank test.

wilcox.test(x1, x2, alternative = 'two-sided', paired = T)

where x1 is your before and x2 is your after, for example.


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.