LoA: Limits of Agreement

View source: R/LoA.R

LoAR Documentation

Limits of Agreement

Description

Computes the limits of agreement between two measurements.

Usage

LoA(x, y, conf.level.CI = 0.95, conf.level.LoA = 0.95)

Arguments

x

[numeric vector] vector containing the first measurement, each value corresponding to an individual.

y

[numeric vector] vector containing the second measurement, each value corresponding to an individual (same as in x).

conf.level.CI

[numeric 0-1] confidence level of the confidence intervals.

conf.level.LoA

[numeric 0-1] confidence level for the limits of agreements.

Details

The bias is estimated as the average difference between y and x, i.e. bias = E[y-x]. The upper/lower limit of the limit of agreement are estimated as the bias plus/minus the LoA.multiplier times the standard deviation of y-x, i.e. E[y-x] +/- LoA.multiplier * sqrt(Var[y-x]).

The standard errors, confidence intervals, and p-values are computed for the limit of the limit of agreement are computed using a delta method.

Examples


set.seed(10)
X <- rnorm(100)
Y <- X + rnorm(100)

e.loa <- LoA(x = X, y = Y)
e.loa
autoplot(e.loa)

if(require(blandr)){ ## same results as blandr.statistics
 e.blandr <- blandr.statistics(method1 = Y, method2 = X)
 e.loa$LoA$estimate - c(e.blandr$bias, e.blandr$lowerLOA, e.blandr$upperLOA)
 e.loa$LoA$lower - c(e.blandr$biasLowerCI, e.blandr$lowerLOA_lowerCI, e.blandr$upperLOA_lowerCI)
 e.loa$LoA$upper - c(e.blandr$biasUpperCI, e.blandr$lowerLOA_upperCI, e.blandr$upperLOA_upperCI)
}

bozenne/butils documentation built on Oct. 14, 2023, 6:19 a.m.