pyomarker.models.test_retest.real.bland_altman
Tools for classical repeatability calculations
BlandAltman
between_subject_mean_squares(x1, x2)
staticmethod
Between subject, mean squares of paired measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
bsms. |
between_subject_standard_deviation(x1, x2)
staticmethod
Between subject standard deviation of paired measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The standard deviation. |
coefficient_of_repeatability(x1, x2, ci=0.9)
staticmethod
The coefficient of repeatability of paired baseline measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
ci
|
float
|
The confidence interval. Must be between 0 and 1. Defaults to 0.9. |
0.9
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The coefficient of repeatability. |
NDArray |
NDArray
|
The coefficient of repeatability confidence interval. Structure: (lower, upper). |
coefficient_of_variation(x1, x2)
staticmethod
The coefficient of variation on raw paired baseline measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The coefficient of variation. |
fit(x1, x2)
Fit the Bland-Altman model to data
Note: This class assumes that the data are from two timepoints only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BlandAltman |
BlandAltman
|
A reference to self. |
intraclass_correlation_coefficient(x1, x2, ci=0.9)
staticmethod
The intra-class correlation coefficient of paired baseline measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
ci
|
float
|
The confidence interval. Must be between 0 and 1. Defaults to 0.9. |
0.9
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The coefficient of repeatability. |
NDArray |
NDArray
|
The coefficient of repeatability confidence interval. Structure: (lower, upper). |
metrics()
Calculate summary of repeatability metrics.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: The metrics dictionary. |
population_mean(x1, x2)
staticmethod
Population mean of paired measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The population mean. |
ratio_coefficient_of_variation(x1, x2)
staticmethod
The coefficient of variation on log-transformed paired baseline measurements.
Definition
$$ CoVr = \sqrt{e^{\sigma_{w}^{2}} - 1} \times 100\% $$ where \(\sigma_{w}\) is the within subject standard deviation of the logarithm of paired baseline measurements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any elements of x1 or x2 are less than or equal to 0. |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The (ratio) coefficient of variation. |
ratio_limits_of_agreement(x1, x2, ci=0.9)
staticmethod
The limits of agreement derive from log-transformed paired baseline measurements.
Definition
$$ LoA = [\exp(±1.96\times \sqrt{2} \times s_{w}) - 1] \times 100\% $$ where \(\sigma_{w}\) is the within subject standard deviation of the logarithm of paired baseline measurements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
ci
|
float
|
The confidence interval. Must be between 0 and 1. Defaults to 0.9. |
0.9
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If any elements of x1 or x2 are less than or equal to 0. |
Returns:
| Name | Type | Description |
|---|---|---|
NDArray |
NDArray
|
The (ratio) limits of agreement. Structure: (negative, positive). |
NDArray |
NDArray
|
The (ratio) limits of agreement confidence interval. Structure: (negative/lower, negative/upper, positive/lower, positive/upper). |
within_subject_mean(x1, x2)
staticmethod
Per subject mean.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
NDArray |
NDArray
|
1D array within subject means. |
within_subject_mean_squares(x1, x2)
staticmethod
Within subject, mean squares of paired measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
wsms |
within_subject_standard_deviation(x1, x2, ci=0.9)
staticmethod
Within subject standard deviation of paired measurements.
Definition
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
NDArray
|
1D array of baseline measurements. |
required |
x2
|
NDArray
|
1D array of repeat baseline measurements. |
required |
ci
|
float
|
The confidence interval. Must be between 0 and 1. Defaults to 0.9. |
0.9
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The within subject standard deviation. |
NDArray |
NDArray
|
The within subject standard deviation confidence interval. Structure: (lower, upper). |