Package {malp}


Version: 1.1-0
Date: 2026-07-22
Title: Maximum Agreement Linear Prediction
Depends: R (≥ 4.0.0)
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>.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Imports: stats, sandwich, graphics, boot
BugReports: https://github.com/pchausse/malp/issues
NeedsCompilation: no
Packaged: 2026-07-23 15:36:26 UTC; pierrechausse
Author: Pierre Chausse [aut, cre], Taeho Kim [aut], Edsel A. Pena [aut], George Luta [ctb]
Maintainer: Pierre Chausse <pchausse@uwaterloo.ca>
Repository: CRAN
Date/Publication: 2026-08-03 18:00:20 UTC

Data on body fat

Description

Lists estimates of the percentage of body fat determined by underwater weighing and various body circumference measurements for 252 men.

Usage

data("bodyFat")

Format

A data frame with 252 observations on the following 15 variables.

BD

Density determined from underwater weighing

PBF

Percent body fat from Siri's (1956) equation

Age

Age (years)

WGT

Weight (lbs)

HGT

Height (inches)

NCK

Neck circumference (cm)

CST

Chest circumference (cm)

ABD

Abdomen 2 circumference (cm)

Hip

Hip circumference (cm)

TGH

Thigh circumference (cm)

KN

Knee circumference (cm)

ANK

Ankle circumference (cm)

BCP

Biceps (extended) circumference (cm)

FA

Forearm circumference (cm)

WRT

Wrist circumference (cm)

Source

Statlib.

https://lib.stat.cmu.edu/datasets/bodyfat


Concordance correlation coefficient

Description

This is a measure of agreement, which evaluates how close the linear relationship between two random variables is from the 45 degree line.

Usage

ccc(x, y, type="Lin")

Arguments

x

A vector of observations.

y

A vector of observations with the same length as x

type

The type of coefficient. The only option for now is the coefficient introduced by Lin (1989)

Value

A numeric vector of length 1.

References

Lin, L. (1989). A concordance correlation coefficient to evaluate reproducibility. Biometrics, 45, 255–268.

Examples

## 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)


Data on Optical Coherence Tomography (OCT)

Description

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.

Usage

data("eye")

Format

A data frame with 56 observations on the following 3 variables.

Eye

OD for right eye and OS for left eye.

Stratus

time-domain Stratus OCT.

Cirrus

spectral-domain Cirrus OCT

References

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.


K-fold cross-validation for Maximum Agreement Linear Predictor

Description

It returns some goodness of fit measures using the k-fold cross-validation method.

Usage


kFoldMalp(obj, k=5, repeated=1)

Arguments

obj

An object of class "malp"

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.

Value

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).

References

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

Examples


## 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)


Maximum Agreement Linear Predictor

Description

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.

Usage

malp(formula, data, obj=TRUE)

Arguments

formula

A formula for the linear model

data

A data.frame containing all variables included in the formula

obj

If set to FALSE, the function only returns the coefficients. It saves a little bit of time for large models if all we need is the coefficients (e.g. in simulation studies).

Value

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 lm.

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 NULL if the dataset does not contain missing values.

The print method for this object is like the method for objects of class "lm". It prints the call and coefficient estimates.

References

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

Examples


## 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


Plot method for objects of class "malp"

Description

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.

Usage

## S3 method for class 'malp'
plot(x, y=NULL, which=c("MALP", "LSLP", "Both"),
                       pch=21:22, col=2:3, bg=2:3, ...)

Arguments

x

An object of class malp

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.

...

Other graphical parameters

Value

No value is returned. This method is called for producing a plot. It invisibly returns NULL.

References

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

Examples


## 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")



Predict method for objects of class "malp"

Description

The function predicts the dependent variable using models estimated by the maximum agreement method.

Usage

## 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, ...) 

Arguments

object

An object of class "malp".

newdata

An optional data.frame that contains new covariates used for the prediction. If not provided, the prediction is performed using the data used for the estimation.

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 TRUE, a bootstrap condifence interval is computed.

bootIntType

This is the type of bootstrap confidence interval. See boot for details.

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 boot.

...

Argument for other type of objects.

Details

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.

Value

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.

References

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

Examples


## 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

Summary for objects of class "malp"

Description

The method computes a coefficient matrix similar to the summary method for "lm" objects.

Usage

## S3 method for class 'malp'
summary(object,
                       vcovMet=c("Asymptotic", "Normal", "Boot", "Jackknife"),
                       se=TRUE, LSdfCorr=FALSE, ...)

Arguments

object

An object of class "malp"

vcovMet

Method to compute the covariance matrix of the coefficients. See the details in vcov.

se

Should the standard error of the coefficients be computed? This argument was included when "Boot" was the default method. It is no longer needed, but we keep it for now.

LSdfCorr

Should we apply the least squares degrees of freedom correction?

...

Argument to pass to vcov.

Value

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.

References

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

Examples


## 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)


Covariance estimation method for objects of class malp

Description

It returns the covariance matrix of the coefficients obtained using the maximum agreement method.

Usage

## S3 method for class 'malp'
vcov(object, method=c("Asymptotic", "Normal", "Boot", "Jackknife"),
                    B=400, LSdfCorr=FALSE, ...)

Arguments

object

An object of class malp

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.

Details

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).

Value

It returns the variance covariance matrix of the coefficient

References

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

Examples


## Stratus VS Cirrus OCT (optimal coherence tomography)

# Left eye
data(eye)
fitL <- malp(Stratus~Cirrus, data=subset(eye, Eye=="OS"))
vcov(fitL)