nifreeze.analysis.measure_agreement module

Measure agreement computation.

class nifreeze.analysis.measure_agreement.BASalientEntity(self, *args, **kwds)[source]

Bases: Enum

LEFT_INDICES = 'left_indices'
LEFT_MASK = 'left_mask'
RELIABILITY_INDICES = 'reliability_indices'
RELIABILITY_MASK = 'reliability_mask'
RIGHT_INDICES = 'right_indices'
RIGHT_MASK = 'right_mask'
nifreeze.analysis.measure_agreement.compute_bland_altman_features(data1: ndarray, data2: ndarray, ci: float) tuple[ndarray, ndarray, float, float, float, float, float, float][source]

Compute quantities of interest for the Bland-Altman plot.

Parameters:
Returns:

  • diff (numpy.ndarray) – Differences.

  • mean (numpy.ndarray) – Mean values (across both data arrays).

  • mean_diff (float) – Mean differences.

  • std_diff (float) – Standard deviation of differences.

  • loa_lower (float) – Lower limit of agreement.

  • loa_upper (float) – Upper limit of agreement.

  • ci_mean (float) – Confidence interval of mean values.

  • ci_loa (float) – Confidence interval of limits of agreement.

nifreeze.analysis.measure_agreement.compute_z_score(ci: float) float[source]

Compute the critical z-score for being outside a confidence interval.

Parameters:

ci (float) – Confidence interval size. Must be in the [0, 1] range.

Returns:

Z-score value.

Return type:

float

nifreeze.analysis.measure_agreement.get_reliability_mask(diff: ndarray, loa_lower: float, loa_upper: float) ndarray[source]

Get reliability mask as the data within the lower and upper limits of agreement.

Boundaries are inclusive.

Parameters:
  • diff (numpy.ndarray) – Differences data.

  • loa_lower (float) – Lower limit of agreement.

  • loa_upper (float) – Upper limit of agreement.

Returns:

Reliability mask.

Return type:

numpy.ndarray

nifreeze.analysis.measure_agreement.identify_bland_altman_salient_data(data1: ndarray, data2: ndarray, ci: float, top_n: int, percentile: float = 0.75) dict[source]

Identify the Bland-Altman (BA) plot salient data.

Given the Bland-Altman data arrays, identifies the left- and right-most top_n data points from the BA plot.

Once the left-most data points identified, the right-most percentile data points are considered from the remaining data points, and top_n data points are identified out of these.

Parameters:
  • data1 (numpy.ndarray) – Data array 1.

  • data2 (numpy.ndarray) – Data array 2.

  • ci (float) – Confidence interval.

  • top_n (float) – Number of top-N salient data points to identify.

  • percentile (float, optional) – Percentile of right-most salient data points to identify.

Returns:

Reliability, left- and right-most data point indices, and corresponding data masks as specified by the :obj:`~nifreeze.analysis.measure_agreement.BASalientEntity keys.

Return type:

dict