Perform Rosner's generalized extreme Studentized deviate (ESD) test, which assumes that the distribution is normal (Gaussian), can be used when the number of outliers is unknown, and becomes more robust as the number of samples increases.

## Arguments

- x
(

`numeric`

)

vector of observations that can be the difference from Bland-Altman analysis. Normally the relative difference is preferred in IVD trials. Missing(NA) is allowed but will be removed. There must be at least 10 available observations in`x`

.- alpha
(

`numeric`

)

type-I-risk, \(\alpha\).- h
(

`integer`

)

the positive integer indicating the number of suspected outliers. The argument`h`

must be between 1 and`n-2`

where n denotes the number of available values in`x`

. The default value is`h = 5`

.

## Value

A list class containing the results of the ESD test.

`stat`

a data frame contains the several statistics about ESD test that includes the index(`i`

), Mean, SD, raw data(`x`

), the location(`Obs`

) in`x`

, ESD statistics(ESDi), Lambda and Outliers(`TRUE`

or`FALSE`

).`ord`

a vector with the order index of outliers that is equal to`Obs`

in the`stat`

data frame.

## Note

The algorithm for determining the number of outliers is as follows:

Compare ESDi with Lambda. If ESDi > Lambda then the observations will be regards as outliers.

The order index corresponds to the available

`x`

data that has been removed the missing (NA) value.As we should compare if the ESD(h) and ESD(h+1) are equal, the h+1 ESD values will be shown. If they are identical, both of them can not be regarded as outliers.

## Examples

```
data("platelet")
res <- blandAltman(x = platelet$Comparative, y = platelet$Candidate)
ESD_test(x = res@stat$relative_diff)
#> $stat
#> i Mean SD x Obs ESDi Lambda Outlier
#> 1 1 0.06356753 0.1447540 0.6666667 1 4.166372 3.445148 TRUE
#> 2 2 0.05849947 0.1342496 0.5783972 4 3.872621 3.442394 TRUE
#> 3 3 0.05409356 0.1258857 0.5321101 2 3.797226 3.439611 TRUE
#> 4 4 0.05000794 0.1183096 -0.4117647 10 3.903086 3.436800 TRUE
#> 5 5 0.05398874 0.1106738 -0.3132530 14 3.318236 3.433961 FALSE
#> 6 6 0.05718215 0.1056542 -0.2566372 23 2.970250 3.431092 FALSE
#>
#> $ord
#> [1] 1 4 2 10
#>
```