This report aims to present the capabilities of the package mcr.

The document contains a use-case of on the titanic_imputed data set described in Section real-world use-case of the article.

We did our best to show the entire range of the implemented explanations. Please note that the examples may be incomplete. If you think something is missing, feel free to make a pull request at the GitHub repository MI2DataLab/IML-tools

The document is a part of the paper “Landscape of R packages for ExplainableMachine Learning”, S. Maksymiuk, A. Gosiewska, and P. Biecek. The list of use-cases for all packages included in the article is here.

Load creatine data set.

data(creatinine,package="mcr")
x <- creatinine$serum.crea
y <- creatinine$plasma.crea

head(data.frame(x, y))
##      x    y
## 1 0.82 0.79
## 2 1.83 1.62
## 3 1.39 1.36
## 4 0.81 1.30
## 5 1.72 1.88
## 6 3.23 3.35
library(mcr)

set.seed(123)

Model diagnostics

model1 <- mcreg(x,y,error.ratio=1,method.reg="Deming", method.ci="analytical",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)
## Please note: 
## 2 of 110 observations contain missing values and have been removed.
## Number of data points in analysis is 108.
printSummary(model1)
## 
## 
## ------------------------------------------
## 
## Reference method: serum.crea
## Test method:     plasma.crea
## Number of data points: 108
## 
## ------------------------------------------
## 
## The confidence intervals are calculated with analytical method.
## Confidence level: 95%
## Error ratio: 1
## 
## ------------------------------------------
## 
## DEMING REGRESSION FIT:
## 
##                   EST         SE        LCI        UCI
## Intercept -0.05891341 0.04604315 -0.1501984 0.03237162
## Slope      1.05453934 0.03534361  0.9844672 1.12461148
## NULL
model1 <- mcreg(x,y,error.ratio=1,method.reg="Deming", method.ci="analytical",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)
## Please note: 
## 2 of 110 observations contain missing values and have been removed.
## Number of data points in analysis is 108.
plot(model1)

model1 <- mcreg(x,y,error.ratio=1,method.reg="Deming", method.ci="analytical",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)
## Please note: 
## 2 of 110 observations contain missing values and have been removed.
## Number of data points in analysis is 108.
plotBias(model1)

model1 <- mcreg(x,y,error.ratio=1,method.reg="Deming", method.ci="analytical",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)
## Please note: 
## 2 of 110 observations contain missing values and have been removed.
## Number of data points in analysis is 108.
plotResiduals(model1)

model1 <- mcreg(x,y,error.ratio=1,method.reg="Deming", method.ci="analytical",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)
## Please note: 
## 2 of 110 observations contain missing values and have been removed.
## Number of data points in analysis is 108.
plotDifference(model1)

Comparison of models.

model1 <- mcreg(x,y,error.ratio=1,method.reg="Deming", method.ci="analytical",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)
## Please note: 
## 2 of 110 observations contain missing values and have been removed.
## Number of data points in analysis is 108.
model2 <- mcreg(x,y,error.ratio=1,method.reg="Deming",
               method.ci="bootstrap", method.bootstrap.ci = "BCa",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)
## Please note: 
## 2 of 110 observations contain missing values and have been removed.
## Number of data points in analysis is 108.
compareFit(model1, model2)