| Title: | Maximum Agreement Linear Prediction |
|---|---|
| Description: | Provides tools for estimation and prediction using Maximum Agreement Linear Predictors (MALPs). MALPs provide an alternative to least squares linear predictors when agreement between predicted and observed values, as measured by Lin's Concordance Correlation Coefficient (CCC), is of primary interest. Applications include missing value imputation and calibration studies. The package includes functions for model estimation, prediction, statistical inference, cross-validation, and model diagnostics. The implemented methodology is described in Kim et al. (2026) <doi:10.1214/26-EJS2550>. |
| Authors: | Pierre Chausse [aut, cre], Taeho Kim [aut], Edsel A. Pena [aut], George Luta [ctb] |
| Maintainer: | Pierre Chausse <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.2 |
| Built: | 2026-11-05 19:13:09 UTC |
| Source: | https://codeberg.org/pchausse/malp |
Lists estimates of the percentage of body fat determined by underwater weighing and various body circumference measurements for 252 men.
data("bodyFat")data("bodyFat")
A data frame with 252 observations on the following 15 variables.
BDDensity determined from underwater weighing
PBFPercent body fat from Siri's (1956) equation
AgeAge (years)
WGTWeight (lbs)
HGTHeight (inches)
NCKNeck circumference (cm)
CSTChest circumference (cm)
ABDAbdomen 2 circumference (cm)
HipHip circumference (cm)
TGHThigh circumference (cm)
KNKnee circumference (cm)
ANKAnkle circumference (cm)
BCPBiceps (extended) circumference (cm)
FAForearm circumference (cm)
WRTWrist circumference (cm)
Statlib.
https://lib.stat.cmu.edu/datasets/bodyfat
This is a measure of agreement, which evaluates how close the linear relationship between two random variables is from the 45 degree line.
ccc(x, y, type="Lin")ccc(x, y, type="Lin")
x |
A vector of observations. |
y |
A vector of observations with the same length as |
type |
The type of coefficient. The only option for now is the coefficient introduced by Lin (1989) |
A numeric vector of length 1.
Lin, L. (1989). A concordance correlation coefficient to evaluate reproducibility. Biometrics, 45, 255–268.
## High concordance: almost y=x set.seed(112233) x <- rnorm(100) u <- rnorm(100, sd=0.1) y1 <- x + u ccc(x,y1) ## Lower concordance: almost y=1+x y2 <- 1+x+u ccc(x,y2) ## But same Pearson correlation cor(x,y2)## High concordance: almost y=x set.seed(112233) x <- rnorm(100) u <- rnorm(100, sd=0.1) y1 <- x + u ccc(x,y1) ## Lower concordance: almost y=1+x y2 <- 1+x+u ccc(x,y2) ## But same Pearson correlation cor(x,y2)
Eye measurements used in Abedi et al. (2011). The original dataset contains two type of measurement for 46 individuals (1 measurement per eye). The data is then filtered to include only observations for which the signal strength is greater or equal to 6 for both measurement methods.
data("eye")data("eye")
A data frame with 56 observations on the following 3 variables.
EyeOD for right eye and OS for left eye.
Stratustime-domain Stratus OCT.
Cirrusspectral-domain Cirrus OCT
Abedi, G. and Patal, P. and Doros, G. and Subramanian, M.L. (2011). Transitioning from stratus OCT to cirrus OCT: a comparison and a proposed equation to convert central subfield macular thickness measurements in healthy subjects. Graefe's Archive for Clinical and Experimental Ophthalmology, 249, 1353–1357.
It imputes the missing values of a dependent variable in a linear model using the maximum agreement linear predictor. To compare its performence, some alternative methods of imputation are also included in the function.
impute(formula, data, type = c("MALP", "LSLP", "Mean", "SReg"))impute(formula, data, type = c("MALP", "LSLP", "Mean", "SReg"))
formula |
A formula for the linear model |
data |
A |
type |
The imputation method. The default is based on the maximum
agreement predictor, |
The main purpose of this function is to implement the MALP imputation method, not to implement all methods that exist in the literature. A few alternative methods are included for illustration.
Since this method is based on a linear model, only the missing dependent
variables associated with the non missing regressors are imputed. This
is also true for the method type="Mean", even if it allows all
missing values to be imputed.
impute returns an object of class "impute" which
inherits from class "data.frame". All specifications associated
with the imputation are stored in the attribute
"imputeSpec". This attribute is a list with the following
elements:
imputed |
The observation numbers that have been imputed. |
missing |
All observation numbers missing from the dependent
variable. It may differ from |
imputedName |
The name of the dependent variable. |
type |
The imputation method. |
allMiss |
All observation numbers that contain at least one missing variable. |
corr |
A list with the elements |
The print method for this object prints the imputation method
used, the number of missing values and the number of imputed observations.
Kim, T. & Chausse, P & Matteo Bottai & Doros, G. & Giurcanu, M. & Luta, G. & Pena, E.A. (2026). “Maximum Agreement Linear Predictors.” Electronic Journal of Statistics, 20(2), 2892–2942. doi:10.1214/26-EJS2550
van Buuren S (2018). Flexible imputation of missing data. CRC press.
obj <- impute(Ozone~Solar.R, airquality) obj ## Regression with the imputed data ## The object inherits from class data.frame lm(Ozone~Solar.R, obj) ## Trying to impute a data set ## with no missing values that can be imputed impute(Ozone~Solar.R, obj)obj <- impute(Ozone~Solar.R, airquality) obj ## Regression with the imputed data ## The object inherits from class data.frame lm(Ozone~Solar.R, obj) ## Trying to impute a data set ## with no missing values that can be imputed impute(Ozone~Solar.R, obj)
It returns some goodness of fit measures using the k-fold cross-validation method.
kFoldMalp(obj, k=5, repeated=1)kFoldMalp(obj, k=5, repeated=1)
obj |
An object of class |
k |
The number of folds. |
repeated |
The number of times the k-fold method is repeated. If it is greater than 1, the function returns the average accuracy measures. |
A numeric named vector with three goodness of fit measures: the Pearson correlation (PCC) and the concordance correlation (CCC) coefficients between the predictions and observed observations, and the mean squared error (MSE).
Kim, T. & Chausse, P & Matteo Bottai & Doros, G. & Giurcanu, M. & Luta, G. & Pena, E.A. (2026). “Maximum Agreement Linear Predictors.” Electronic Journal of Statistics, 20(2), 2892–2942. doi:10.1214/26-EJS2550
## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) kFoldMalp(fitL) # Right eye fitR <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OD")) kFoldMalp(fitR)## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) kFoldMalp(fitL) # Right eye fitR <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OD")) kFoldMalp(fitR)
This is the main function to estimate the maximum agreement linear
predictor. Instead of estimating the predictor directly, as in Kim et
al. (2026), the coefficients are estimated like linear models fitted
by lm and saved in the "malp" object created
by this function.
malp(formula, data, obj=TRUE)malp(formula, data, obj=TRUE)
formula |
A formula for the linear model |
data |
A |
obj |
If set to |
malp returns an object of class "malp", with the following components:
coefficients |
Coefficient estimates. |
gamma |
Correlation between the dependent variable and the least squares fitted values. |
lm |
Least squares object fitted by |
varY |
Estimated variance of the dependent variable. |
muY |
Sample mean of the dependent variable. |
call |
The original function call. |
data |
The data set used for the estimation. The missing values are therefore omitted. |
na.action |
A vector indicating the rows that were omitted from
the dataset due to missing values. It is |
The print method for this object is like the method for objects
of class "lm". It prints the call and coefficient estimates.
Kim, T. & Chausse, P & Matteo Bottai & Doros, G. & Giurcanu, M. & Luta, G. & Pena, E.A. (2026). “Maximum Agreement Linear Predictors.” Electronic Journal of Statistics, 20(2), 2892–2942. doi:10.1214/26-EJS2550
## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) fitL # Right eye fitR <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OD")) fitR ## Body fat data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) fit## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) fitL # Right eye fitR <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OD")) fitR ## Body fat data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) fit
"malp" and "impute"
For objects of class "malp", the function plots the dependent
variable against the fitted values from the maximum agreement
method. The purpose is to compare the fit with the 45 degree line
representing the absolute agreement. For objects of class
"impute", it plots the histogram of the dependent variable with
and without the imputed observations to compare their distributions.
## S3 method for class 'malp' plot(x, y=NULL, which=c("MALP", "LSLP", "Both"), pch=21:22, col=2:3, bg=2:3, ...) ## S3 method for class 'impute' plot(x, y = NULL, title = NULL, xlab = NULL, col_obs = rgb(0, 0, 1, 0.3), col_imp = rgb(1, 0, 0, 0.3), legendPos = "topright", breaks = NULL, ...)## S3 method for class 'malp' plot(x, y=NULL, which=c("MALP", "LSLP", "Both"), pch=21:22, col=2:3, bg=2:3, ...) ## S3 method for class 'impute' plot(x, y = NULL, title = NULL, xlab = NULL, col_obs = rgb(0, 0, 1, 0.3), col_imp = rgb(1, 0, 0, 0.3), legendPos = "topright", breaks = NULL, ...)
x |
An object of class |
y |
Not used at the moment. |
which |
Should we plot the fitted from MALP, LSLP or both? |
pch |
The type of points for the MALP and LS predictions. |
col |
The colour of points for the MALP and LS predictions. |
bg |
The bachground colour of points for the MALP and LS predictions. |
title, xlab
|
Optional title and x-label. |
col_obs, col_imp
|
The colour of the bars for the observed and imputed observations. |
legendPos |
The position of the legend. |
breaks |
Option arguments for histogram breaks. See |
... |
Other graphical parameters |
No value is returned. This method is called for producing a
plot. It invisibly returns NULL.
Kim, T. & Chausse, P & Matteo Bottai & Doros, G. & Giurcanu, M. & Luta, G. & Pena, E.A. (2026). “Maximum Agreement Linear Predictors.” Electronic Journal of Statistics, 20(2), 2892–2942. doi:10.1214/26-EJS2550
van Buuren S (2018). Flexible imputation of missing data. CRC press.
## Eye data example (see reference) data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) plot(fitL, which="Both") ## Body fat (see reference) data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) plot(fit, which="Both") ## Imputation obj <- impute(Ozone~Solar.R, airquality) plot(obj)## Eye data example (see reference) data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) plot(fitL, which="Both") ## Body fat (see reference) data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) plot(fit, which="Both") ## Imputation obj <- impute(Ozone~Solar.R, airquality) plot(obj)
"malp"
The function predicts the dependent variable using models estimated by the maximum agreement method.
## S3 method for class 'malp' predict(object, newdata = NULL, se.fit = FALSE, interval = c("none", "confidence", "prediction"), level = 0.95, includeLS = FALSE, LSdfCorr = FALSE, vcovMet = c("Asymptotic", "Normal", "Boot", "Jackknife"), bootInterval=FALSE, bootIntType=c("all", "norm", "basic", "stud", "perc", "bca"), Bse.=100, B.=300, parallel = c("no", "multicore", "snow"), ncpus = getOption("boot.ncpus", 1L), cl = NULL, ...)## S3 method for class 'malp' predict(object, newdata = NULL, se.fit = FALSE, interval = c("none", "confidence", "prediction"), level = 0.95, includeLS = FALSE, LSdfCorr = FALSE, vcovMet = c("Asymptotic", "Normal", "Boot", "Jackknife"), bootInterval=FALSE, bootIntType=c("all", "norm", "basic", "stud", "perc", "bca"), Bse.=100, B.=300, parallel = c("no", "multicore", "snow"), ncpus = getOption("boot.ncpus", 1L), cl = NULL, ...)
object |
An object of class |
newdata |
An optional |
se.fit |
Should the function return the standard errors? |
interval |
If set to "confidence", the confidence interval is returned and if set to "predict", it returns the prediction intervals. |
level |
The level of the confidence interval. |
includeLS |
Should the method include the least squares prediction? |
LSdfCorr |
Should we correct for the degrees of freedom? |
vcovMet |
Method to compute the standard error of the prediction. |
bootInterval |
If set to |
bootIntType |
This is the type of bootstrap confidence
interval. See |
Bse. |
The number of bootstrap samples to compute the standard errors. |
B. |
The number of bootstrap sample to compute the confidence intervals. |
parallel, ncpus, cl
|
These arguments are passed to
|
... |
Argument for other type of objects. |
By default, standard errors are computed using the Delta Method, which relies on a linear approximation of the solution. This approach is asymptotically valid under weak regularity conditions. However, its accuracy may be poor in small samples, in which case simulation-based methods may provide more reliable standard error estimates.
If you are willing to assume joint normality, you can set vcovMet
to "Normal", in which case the exact expression for the standard
error of the predictor is used. This method is valid only under the
joint normality assumption.
The following applies to all types of prediction. If includeLS is
set to TRUE, the returned value is a list with components
LS (least squares) and MALP (maximum agreement), each
containing the prediction object described below. Otherwise, the
prediction object itself is returned.
If interval = "none" and se.fit = FALSE, the prediction
object is a numeric vector of predictions.
If interval = "none" and se.fit = TRUE, the prediction
object is a list with components fit, containing the numeric
vector of predictions, and se.fit, containing the corresponding
estimated standard errors.
If interval is set to either "confidence" or
"predict", the prediction object is a numeric matrix whose first
column contains the predictions, the second the lower bound of the
confidence or prediction interval, and the third the upper bound.
Thus, for each type of prediction, the return value follows the same
conventions as predict.lm.
Kim, T. & Chausse, P & Matteo Bottai & Doros, G. & Giurcanu, M. & Luta, G. & Pena, E.A. (2026). “Maximum Agreement Linear Predictors.” Electronic Journal of Statistics, 20(2), 2892–2942. doi:10.1214/26-EJS2550
## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) newd <- data.frame(Cirrus=200:205) pr <- predict(fitL, newdata=newd, interval="confidence", includeLS=TRUE) pr ## Body fat data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) newd <- data.frame(Age=20:25, ABD=85, WGT=155, FA=27, WRT=17, TGH=60, NCK=40, Hip=100) pr <- predict(fit, newdata=newd, se.fit=TRUE) pr## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) newd <- data.frame(Cirrus=200:205) pr <- predict(fitL, newdata=newd, interval="confidence", includeLS=TRUE) pr ## Body fat data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) newd <- data.frame(Age=20:25, ABD=85, WGT=155, FA=27, WRT=17, TGH=60, NCK=40, Hip=100) pr <- predict(fit, newdata=newd, se.fit=TRUE) pr
"malp" or "impute"
For objects of class "malp", the method computes a coefficient
matrix similar to the summary method for "lm" objects. For
objects of class "impute", it returns a matrix that contains some
summary statistics of the dependent variables before and after the
imputation of the missing values.
## S3 method for class 'malp' summary(object, vcovMet=c("Asymptotic", "Normal", "Boot", "Jackknife"), se=TRUE, LSdfCorr=FALSE, ...) ## S3 method for class 'impute' summary(object, ...)## S3 method for class 'malp' summary(object, vcovMet=c("Asymptotic", "Normal", "Boot", "Jackknife"), se=TRUE, LSdfCorr=FALSE, ...) ## S3 method for class 'impute' summary(object, ...)
object |
An object of class |
vcovMet |
Method to compute the covariance matrix of the
coefficients. See the details in |
se |
Should the standard error of the coefficients be computed?
This argument was included when |
LSdfCorr |
Should we apply the least squares degrees of freedom correction? |
... |
Argument to pass to |
symmary.malp returns an object of class "summary.malp",
with the following components:
coefficients |
The coefficient matrix with estimates, standard errors, t-ratios and p-values. |
fitMALP |
Measures of goodness of fit for maximum agreement predictors. |
fitLSLP |
Measures of goodness of fit for least squares predictors. |
call |
The original function call. |
A print method is also available for this class of objects.
summary.impute returns an object of class
"summary.impute". It is also a matrix that contains the sample
mean, the sample standard deviation, the correlation between the fitted
values and the dependent variable and the sample size, before imputation
in the first column and after in the second.
The "+.summary.impute" operator allows to combine two summary
tables into one, without repeating the first column. See the example
below.
Kim, T. & Chausse, P & Matteo Bottai & Doros, G. & Giurcanu, M. & Luta, G. & Pena, E.A. (2026). “Maximum Agreement Linear Predictors.” Electronic Journal of Statistics, 20(2), 2892–2942. doi:10.1214/26-EJS2550
van Buuren S (2018). Flexible imputation of missing data. CRC press.
## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) summary(fitL) # Right eye fitR <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OD")) summary(fitR) ## Body fat data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) summary(fit) ## Imputation obj1 <- summary(impute(Ozone~Solar.R, airquality)) obj2 <- summary(impute(Ozone~Solar.R, airquality, "LSLP")) obj3 <- summary(impute(Ozone~Solar.R, airquality, "Mean")) obj1+obj2+obj3## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) summary(fitL) # Right eye fitR <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OD")) summary(fitR) ## Body fat data(bodyFat) fit <- malp(PBF~ABD+WGT+FA+WRT+Age+TGH+NCK+Hip, bodyFat) summary(fit) ## Imputation obj1 <- summary(impute(Ozone~Solar.R, airquality)) obj2 <- summary(impute(Ozone~Solar.R, airquality, "LSLP")) obj3 <- summary(impute(Ozone~Solar.R, airquality, "Mean")) obj1+obj2+obj3
It returns the covariance matrix of the coefficients obtained using the maximum agreement method.
## S3 method for class 'malp' vcov(object, method=c("Asymptotic", "Normal", "Boot", "Jackknife"), B=400, LSdfCorr=FALSE, ...)## S3 method for class 'malp' vcov(object, method=c("Asymptotic", "Normal", "Boot", "Jackknife"), B=400, LSdfCorr=FALSE, ...)
object |
An object of class |
method |
Method to compute the covariance matrix of the coefficients. See details. |
LSdfCorr |
Should we apply the least squares degrees of freedom correction? |
B |
The number of replications for the bootstrap method. |
... |
Argument for other type of objects. |
Kim et al. (2026) derive expressions for the standard errors of the
predictor directly, rather than for the covariance matrix of the
estimated coefficients. The different methods available for estimating
these standard errors are described in the Details section of
predict.
The covariance matrix of the estimated coefficients is obtained by deriving an expression from the predictor variance formula presented in Kim et al. (2026).
It returns the variance covariance matrix of the coefficient
Kim, T. & Chausse, P & Matteo Bottai & Doros, G. & Giurcanu, M. & Luta, G. & Pena, E.A. (2026). “Maximum Agreement Linear Predictors.” Electronic Journal of Statistics, 20(2), 2892–2942. doi:10.1214/26-EJS2550
## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) vcov(fitL)## Stratus VS Cirrus OCT (optimal coherence tomography) # Left eye data(eye) fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS")) vcov(fitL)