# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Compare the means of two observational samples using the Welch test

Contributed by:
András Aszódi
| Andras Aszodi

ResourceFunction["WelchTest"][ tests whether the two lists of observations |

The Welch test is a modification of the Student t-test which does not require equality of variances.

The Welch test is used to compare the means of two groups of observations (samples) if the samples were drawn from (approximately) normal populations with unequal variances.

WelchTest returns an association containing the following keys:

"PValue" | p-values |

"TestStatistic" | value of the t-statistic |

“DegreesOfFreedom" | approximate (non-integer) degrees of freedom |

WelchTest takes the following option:

AlternativeHypothesis | "Unequal" | the inequality for the alternative hypothesis |

With the setting AlternativeHypothesis→"Unequal", WelchTest performs the two-sided Welch test.

Use AlternativeHypothesis→"Greater" or AlternativeHypothesis→"Less" to perform the one-sided Welch test.

Two samples with unequal length:

In[1]:= |

Perform the two-sided Welch test on the two samples:

In[2]:= |

Out[2]= |

Two samples with unequal length:

In[3]:= |

Test H_{0}:*μ*_{1}-*μ*_{2}≥0 versus H_{a}:*μ*_{1}-*μ*_{2}<0:

In[4]:= |

Out[4]= |

Test H_{0}:*μ*_{1}-*μ*_{2}<0 versus H_{a}:*μ*_{1}-*μ*_{2}≥0:

In[5]:= |

Out[5]= |

This work is licensed under a Creative Commons Attribution 4.0 International License