Welch's t-test: Difference between revisions

Content added Content deleted
m (→‎{{header|R}}: removed semicolons)
(Added description, made minor modifications to C code)
Line 2: Line 2:


Given two lists of data, calculate the [[wp:p-value|p-Value]] used for null hypothesis testing.
Given two lists of data, calculate the [[wp:p-value|p-Value]] used for null hypothesis testing.

P-values are significance tests to gauge the probability that the difference in means between two data sets is significant, or due to chance. A threshold level, alpha, is usually chosen, 0.01 or 0.05, where p-values below alpha are worth further investigation and p-values about alpha are considered not significant. The p-value is not considered a final test of significance, only whether the given variable should be given further consideration.


This uses [[wp:Welch's_t_test|Welch's t-test]], which assumes that the variances between the two sets are not equal. Welch's t-test statistic can be computed thus:
This uses [[wp:Welch's_t_test|Welch's t-test]], which assumes that the variances between the two sets are not equal. Welch's t-test statistic can be computed thus:
Line 39: Line 41:
<math> p = 1-\frac{1}{2}\times\frac{\int_0^\frac{\nu}{t^2+\nu} \frac{r^{\frac{\nu}{2}-1}}{\sqrt{1-r}}\,\mathrm{d}r}{ \exp((\ln(\Gamma(\frac{\nu}{2})) + \ln(\Gamma(0.5)) - \ln(\Gamma(\frac{\nu}{2}+0.5))) }</math>
<math> p = 1-\frac{1}{2}\times\frac{\int_0^\frac{\nu}{t^2+\nu} \frac{r^{\frac{\nu}{2}-1}}{\sqrt{1-r}}\,\mathrm{d}r}{ \exp((\ln(\Gamma(\frac{\nu}{2})) + \ln(\Gamma(0.5)) - \ln(\Gamma(\frac{\nu}{2}+0.5))) }</math>


for a 1-tail p-value. The 2-tail p-value is simply twice the 1-tail value.
=={{header|C}}==
=={{header|C}}==
{{works with|C99}}
{{works with|C99}}