eradiate.test_tools.regression.PairedStudentTTest

class eradiate.test_tools.regression.PairedStudentTTest(name, value, reference=None, *, variable='brf_srf', threshold, archive_dir, plot, cov=0.0)[source]

Bases: AbstractStudentTTest

Paired Student’s T-test

This implementation of a Student’s T-test is following the assumption of paired samples within two groups that are tested. The mean of the bias between the paired values is assumed to be the result of chance under the null hypothesis. It is a two-tailed test.

The paired test allow to introduce a covariance factor between the pairs. By default, this covariance is equal to zero, thus assuming independence of the two variables.

Contrary to the independent Student’s T-test, this paired version of the test requires an equal degree of freedom of the two groups.

Parameters:
  • name (str) – Test case name.

  • value (xarray.Dataset) – Simulation result. Must be specified as a dataset.

  • reference (xarray.Dataset or path-like, optional, default: None) – Reference data. Can be specified as an xarray dataset, a path to a NetCDF file or a path to a resource.

  • variable (str, default: brf_srf) – Tested variable

  • threshold (float) – Test metric threshold

  • archive_dir (path-like) – Path to output artefact storage directory. Relative paths are interpreted with respect to the current working directory.

  • plot (bool) – Enable pyplot charts

  • cov (array-like or float) – Covariance between observation, defaults to zero

Fields:
  • name (str) – Test case name.

  • value (xarray.Dataset) – Simulation result.

  • reference (xarray.Dataset or None) – Reference data.

  • variable (str) – Tested variable.

  • threshold (float) – Test metric threshold.

  • archive_dir (pathlib.Path) – Path to output artefact storage directory.

  • plot (bool) – Enable pyplot charts.

  • cov (ndarray or float) – Covariance between observation, defaults to zero.

run(diagnostic=False)

This method controls the execution steps of the regression test:

  • handle missing reference data

  • catch errors during text evaluation

  • create the appropriate plots and data archives

Returns:

bool – Result of the test criterion comparison.