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("scint", package = "MethComp")
scint_wide <- reshape(scint, v.names = "y", timevar = "meth", idvar = "item", direction = "wide")
## conditional method agreement tree
tr <- coat(y.DTPA + y.DMSA ~ age + sex, data = scint_wide)
## illustration of methods (including some customization)
## printing
print(tr)
print(tr, header = FALSE, footer = FALSE)
## extracting Bland-Altman parameters
coef(tr)
coef(tr, node = 1)
## visualization (via grid with node_baplot)
plot(tr)
plot(tr, ip_args = list(id = FALSE),
tp_args = list(col = "slategray", id = FALSE, digits = 3, pch = 19))
## visualization (via ggplot2 with ggparty)
library("ggplot2")
autoplot(tr)
autoplot(tr, digits = 3) + ggtitle("Conditional method agreement tree") +
theme(plot.title = element_text(hjust = 0.5))
Run the code above in your browser using DataLab