# 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

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

The Welch test is a modification of the Student *t*-test that 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.

ResourceFunction["WelchTest"] returns an association containing the following keys:

"PValue" | p-values |

"TestStatistic" | value of the t-statistic |

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

ResourceFunction["WelchTest"] takes the following option:

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

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

Use AlternativeHypothesis→"Greater" or AlternativeHypothesis→"Less" to perform a 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]= |

- 1.0.0 – 08 April 2022

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