zTest#

swordfish.function.zTest()#

If Y is not specified, conduct a one-sample Z-test on X. If Y is specified, conduct a paired-sample Z-test on X and Y.

Parameters:
  • X (Constant) – A numeric vector indicating the sample for the Z-test.

  • Y (Constant, optional) – A numeric vector indicating the second sample for a paired-sample Z-test, by default DFLT

  • mu (Constant, optional) – A floating number, by default DFLT. If Y is not specified, mu is the mean value of X in the null hypothesis; if Y is specified, mu is the difference in the mean values of X and Y in the null hypothesis. It is optional and the default value is 0.

  • sigmaX (Constant, optional) – A floating number indicating the standard deviation of X, by default DFLT.

  • sigmaY (Constant, optional) – A floating number indicating the standard deviation of Y, by default DFLT.

  • confLevel (Constant, optional) – A floating number between 0 and 1 indicating the confidence level of the test, by default DFLT.

Returns:

A dictionary with the following keys:

  • stat: a table with p-value and confidence interval under 3 alternative hypotheses.

  • confLevel: confidence level

  • method: “One sample Z-test” if Y is not specified; “Two sample Z-test” if Y is specified.

  • zValue: Z-stat

Return type:

Constant