Skip to contents

[Experimental]

Calculate the Bland-Altman related statistics with specific difference type, such as difference, limited of agreement and confidence interval. And the outlier detecting function and graphic function will get the difference result from this.

Usage

blandAltman(x, y, sid = NULL, type1 = 3, type2 = 5, conf.level = 0.95)

Arguments

x

(numeric)
reference method.

y

(numeric)
test method.

sid

(numeric or string) sample id.

type1

(integer)
specifying a specific difference for absolute difference, default is 3.

type2

(integer)
specifying a specific difference for relative difference, default is 5.

conf.level

(numeric)
significance level for two side, default is 0.95.

Value

A object with BAsummary class that contains the BlandAltman analysis.

  • data a data frame contains the raw data from the input.

  • stat a list contains the summary table (tab) of Bland-Altman analysis, vector (absolute_diff) of absolute difference and vector (relative_diff) of relative difference.

See also

h_difference() to see the type details.

Examples

data("platelet")
blandAltman(x = platelet$Comparative, y = platelet$Candidate)
#>  Call: blandAltman(x = platelet$Comparative, y = platelet$Candidate)
#> 
#>   Absolute difference type:  Y-X
#>   Relative difference type:  (Y-X)/(0.5*(X+Y))
#> 
#>                             Absolute.difference Relative.difference
#> N                                           120                 120
#> Mean (SD)                        7.330 (15.990)      0.064 ( 0.145)
#> Median                                    6.350               0.055
#> Q1, Q3                         ( 0.150, 15.750)    ( 0.001,  0.118)
#> Min, Max                      (-47.800, 42.100)    (-0.412,  0.667)
#> Limit of Agreement            (-24.011, 38.671)    (-0.220,  0.347)
#> Confidence Interval of Mean    ( 4.469, 10.191)    ( 0.038,  0.089)

# with sample id as input sid
blandAltman(x = platelet$Comparative, y = platelet$Candidate, sid = platelet$Sample)
#>  Call: blandAltman(x = platelet$Comparative, y = platelet$Candidate, 
#>     sid = platelet$Sample)
#> 
#>   Absolute difference type:  Y-X
#>   Relative difference type:  (Y-X)/(0.5*(X+Y))
#> 
#>                             Absolute.difference Relative.difference
#> N                                           120                 120
#> Mean (SD)                        7.330 (15.990)      0.064 ( 0.145)
#> Median                                    6.350               0.055
#> Q1, Q3                         ( 0.150, 15.750)    ( 0.001,  0.118)
#> Min, Max                      (-47.800, 42.100)    (-0.412,  0.667)
#> Limit of Agreement            (-24.011, 38.671)    (-0.220,  0.347)
#> Confidence Interval of Mean    ( 4.469, 10.191)    ( 0.038,  0.089)

# Specifiy the type for difference
blandAltman(x = platelet$Comparative, y = platelet$Candidate, type1 = 1, type2 = 4)
#>  Call: blandAltman(x = platelet$Comparative, y = platelet$Candidate, 
#>     type1 = 1, type2 = 4)
#> 
#>   Absolute difference type:  Y-X
#>   Relative difference type:  (Y-X)/X
#> 
#>                             Absolute.difference Relative.difference
#> N                                           120                 120
#> Mean (SD)                        7.330 (15.990)      0.078 ( 0.173)
#> Median                                    6.350               0.056
#> Q1, Q3                         ( 0.150, 15.750)    ( 0.001,  0.125)
#> Min, Max                      (-47.800, 42.100)    (-0.341,  1.000)
#> Limit of Agreement            (-24.011, 38.671)    (-0.261,  0.417)
#> Confidence Interval of Mean    ( 4.469, 10.191)    ( 0.047,  0.109)