Learn R Programming

coat (version 0.2.0)

batest: Bland-Altman Test of Method Agreement

Description

Function to perform a Bland-Altman test of differences in method agreement. Additional functions are given for printing and plotting.

Usage

batest(formula, data, subset, na.action, weights, ...)

# S3 method for batest print(x, digits = 2, type = c("test", "model", "both"), ...)

# S3 method for batest plot(x, ...)

Value

Object of class batest with elements

test

result of the Bland-Altman test.

model

tree model used to perform the Bland-Altman test.

Arguments

formula

symbolic description of the model used to perform the Bland-Altman test of type y1 + y2 ~ x. The left-hand side should specify a pair of measurements (y1 and y2) to assess the agreement. The right-hand side should specify a factor with two levels indicating two independent groups or samples to be compared. Alternatively, multilevel factors or continuously scaled variables can be specified to perform a Bland-Altman test of association, followed by binary splitting into two subgroups.

data, subset, na.action

arguments controlling the formula processing via model.frame.

weights

optional numeric vector of weights (case/frequency weights, by default).

...

further control arguments, passed to ctree_control

x

an object as returned by batest.

digits

a numeric specifying the number of digits to display.

type

character string specifying whether "test" statistics (default), the "model" or "both" should be printed.

Methods (by generic)

  • print(batest): function to print the result of the Bland-Altman test.

  • plot(batest): function to plot the result of the Bland-Altman test.

Examples

Run this code
 if(!requireNamespace("MethComp")) {
  if(interactive() || is.na(Sys.getenv("_R_CHECK_PACKAGE_NAME_", NA))) {
    stop("the MethComp package is required for this example but is not installed")
  } else q() }

## package and data (reshaped to wide format)
library("coat")
data("VitCap", package = "MethComp")
VitCap_wide <- reshape(VitCap, v.names = "y", timevar = "instrument",
                       idvar = c("item", "user"), drop = "meth", direction = "wide")

## two-sample BA-test
testresult <- batest(y.St + y.Exp ~ user, data = VitCap_wide)

## display
testresult
print(testresult, digits = 1, type = "both")
plot(testresult)

Run the code above in your browser using DataLab