: [pval, z] = z_test_2 (x, y, v_x, v_y, alt)

For two samples x and y from normal distributions with unknown means and known variances v_x and v_y, perform a Z-test of the hypothesis of equal means.

Under the null, the test statistic z follows a standard normal distribution.

With the optional argument string alt, the alternative of interest can be selected. If alt is "!=" or "<>", the null is tested against the two-sided alternative mean (x) != mean (y). If alt is ">", the one-sided alternative mean (x) > mean (y) is used. Similarly for "<", the one-sided alternative mean (x) < mean (y) is used. The default is the two-sided case.

The p-value of the test is returned in pval.

If no output argument is given, the p-value of the test is displayed along with some information.

Package: statistics