Title: | Evaluating Bias and Precision in Method Comparison Studies |
---|---|
Description: | Evaluate bias and precision in method comparison studies. One provides measurements for each method and it takes care of the estimates. Multiple plots to evaluate bias, precision and compare methods. |
Authors: | Thomas Blomet [aut, cre], Mingkai Peng [aut], Patrick Taffé [aut], Tyler Williamson [aut] |
Maintainer: | Thomas Blomet <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.0 |
Built: | 2025-02-27 05:17:09 UTC |
Source: | https://github.com/uberlulu/methodcompare |
This function draws the "agreement plot" before recalibration, which is used
to visually appraise the degree of agreement between the new and reference
methods, before recalibration of the new method.
It is obtained by graphing a scatter plot of y1-y2
(difference of the methods)
versus the BLUP of the latent trait, x
, along with the bias and 95% limits
of agreement with their 95% simultaneous confidence bands.
The function adds a second scale on the right axis, showing the percentage
of agreement index.
agreement0(object, rarea = FALSE)
agreement0(object, rarea = FALSE)
object |
list returned by measure_compare function. |
rarea |
if |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the agreement without recalibration agreement0(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the agreement without recalibration agreement0(measure_model)
This function draws the "agreement plot" after recalibration, which is used
to visually appraise the degree of agreement between the new and reference
methods, before recalibration of the new method.
It is obtained by graphing a scatter plot of y1-y2
(difference of the methods)
versus the BLUP of the latent trait, x
, along with the bias and 95% limits
of agreement with their 95% simultaneous confidence bands.
The function adds a second scale on the right axis, showing the percentage
of agreement index.
agreement1(object, rarea = FALSE)
agreement1(object, rarea = FALSE)
object |
list returned by measure_compare function. |
rarea |
if |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the agreement after recalibration agreement0(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the agreement after recalibration agreement0(measure_model)
This function draws the "bias plot", which is used to visually assess the
bias of the new method relative to the reference method. It is obtained by
graphing a scatter plot of y1
(new method) and y2
(reference method) versus
the BLUP of the latent trait, x
, along with the two regression lines.
The function adds a second scale on the right axis, showing the relationship
between the estimated amount of bias and BLUP of the latent trait, x
.
bias_plot(object)
bias_plot(object)
object |
list returned by measure_compare function. |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the bias bias_plot(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the bias bias_plot(measure_model)
This function allows the visualization of the bias-corrected values (i.e. recalibrated values, variable y1_corr) of the new measurement method.
compare_plot(object)
compare_plot(object)
object |
list returned by measure_compare function. |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the bias compare_plot(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the bias compare_plot(measure_model)
In the simulated dataset 1, each subject has 1 to 3 measurement values from the new method and 10 to 20 measurement values from the reference method. Compared to the reference method, the new method has differential bias of 4 and proportional bias of 0.8. Variance of the new method is smaller than that for the reference method.
data1
data1
data1
An object of class data.frame
with 1468 rows and 3 columns
A data frame with 3 variables:
id
identification number for subjects
y1
values from the new measuremment method
y2
values from the reference method
Dataset 1 was created based on the following equations:
for and the number of repeated measurements for each
subject
from the reference standard was
and
for the new measurement method.
In the simulated dataset 2, each subject has 10 to 20 measurement values from the new method and 10 to 20 measurement values from the reference method. Compared to the reference method, the new method has differential bias of 4 and proportional bias of 0.8. Variance of the new method is smaller than that for the reference method.
data2
data2
data2
An object of class data.frame
with 1680 rows and 3 columns
A data frame with 3 variables:
id
identification number for subjects
y1
values from the new measuremment method
y2
values from the reference method
Dataset 1 was created based on the following equations:
for and the number of repeated measurements for each
subject
from the reference standard was
and
for the new measurement method.
In the simulated dataset 3, each subject has 10 to 20 measurement values from the new method and 10 to 20 measurement values from the reference method. Compared to the reference method, the new method has differential bias of 1 and proportional bias of 0.9. Variance of the new method is smaller than that for the reference method.
data3
data3
data3
An object of class data.frame
with 1682 rows and 3 columns
A data frame with 3 variables:
id
identification number for subjects
y1
values from the new measuremment method
y2
values from the reference method
Dataset 1 was created based on the following equations:
for and the number of repeated measurements for each
subject
from the reference standard was
and
for the new measurement method.
measure_compare()
implements the methodology reported in the paper:
Taffé P. Effective plots to assess bias and precision in method comparison
studies. Stat Methods Med Res 2018;27:1650-1660. Other relevant references:
Taffé P, Peng M, Stagg V, Williamson T. Biasplot: A package to effective
plots to assess bias and precision in method comparison studies.
Stata J 2017;17:208-221. Taffé P, Peng M, Stagg V, Williamson T.
MethodCompare: An R package to assess bias and precision in method
comparison studies. Stat Methods Med Res 2019;28:2557-2565.
Taffé P, Halfon P, Halfon M. A new statistical methodology to assess bias
and precision overcomes the defects of the Bland & Altman method.
J Clin Epidemiol 2020;124:1-7. Taffé P. Assessing bias, precision, and
agreement in method comparison studies. Stat Methods Med Res 2020;29:778-796.
Taffé P. When can the Bland-Altman limits of agreement method be used and
when it should not be used. J Clin Epidemiol 2021; 137:176-181.
measure_compare( data, new = "y1", ref = "y2", id = "id", nb_simul = 1000, if_value = NULL )
measure_compare( data, new = "y1", ref = "y2", id = "id", nb_simul = 1000, if_value = NULL )
data |
a required data frame containing the identification number of the
subject ( |
new |
an optional string. The column name containing the measurements of the new measurement method. |
ref |
an optional string. The column name containing the measurements of the reference method (at least two measurements per subject). |
id |
an optional string. The column name containing the subject identification numbers. |
nb_simul |
an optional number. The number of simulations used for simultaneous confidence bands. |
if_value |
an optional number. Restrict the study to observed
measurement greater than the provided value, i.e., |
The function returns a list with the following items:
models
: a list of models fitted in estimation procedure
data
: the original data frame with renamed columns and
additional computed data
sim_params
: estimated model coefficients used afterward
nb_simul
: the number of simulations used for confidence bands
simulations
bias
: differential and proportional biases for new method and the
associated 95 percent confidence intervals
methods
: a list of methods names provided by the user
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100)
This function draws the "MSE plot", which is used to compare the precision of
the two measurement methods without recalibrating the new method.
It is obtained by graphing the mean squared errors of y1
(new method) and y2
(reference
method) versus the BLUP of the latent trait, x
, along with their 95%
simultaneous confidence bands.
mse(object, rarea = FALSE)
mse(object, rarea = FALSE)
object |
list returned by measure_compare function. |
rarea |
if |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the mean squared errors mse(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the mean squared errors mse(measure_model)
This function draws the "percentage agreement plot" before recalibration,
which shows the amount of percentage agreement.
It is obtained by graphing the percentage agreement index before recalibration
versus the BLUP of the latent trait, x
, along with its 95% simultaneous
confidence bands.
pct_agreement0(object)
pct_agreement0(object)
object |
list returned by measure_compare function. |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the percentage agreement without recalibration pct_agreement0(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the percentage agreement without recalibration pct_agreement0(measure_model)
This function draws the "percentage agreement plot" after recalibration,
which shows the amount of percentage agreement.
It is obtained by graphing the percentage agreement index after recalibration
versus the BLUP of the latent trait, x
, along with its 95% simultaneous
confidence bands.
pct_agreement1(object)
pct_agreement1(object)
object |
list returned by measure_compare function. |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the percentage agreement after recalibration pct_agreement0(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the percentage agreement after recalibration pct_agreement0(measure_model)
This function draws the "precision plot", which allows the visual comparison
of the precision (i.e. standard deviation) of the new measurement method with
the reference standard by creating a scatter plot of the estimated standard
deviations, along with their 95% simultaneous confidence bands, against the
best linear prediction (BLUP) of the true latent trait, x
.
precision_plot(object, object2 = NULL, log = FALSE, rarea = FALSE)
precision_plot(object, object2 = NULL, log = FALSE, rarea = FALSE)
object |
list returned by measure_compare function. |
object2 |
(optional) returned by measure_compare function. If provided, will plot a second precision estimate. |
log |
if |
rarea |
if |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the precision of the two methods precision_plot(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the precision of the two methods precision_plot(measure_model)
This function draws the "sqrt(MSE) plot", which is used to compare the precision of
the two measurement methods without recalibrating the new method.
It is obtained by graphing the square root mean squared errors of y1
(new method) and y2
(reference
method) versus the BLUP of the latent trait, x
, along with their 95%
simultaneous confidence bands.
sqrt_mse(object, rarea = FALSE)
sqrt_mse(object, rarea = FALSE)
object |
list returned by measure_compare function. |
rarea |
if |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the square root mean squared errors sqrt_mse(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the square root mean squared errors sqrt_mse(measure_model)
This function draws the "total bias plot", which is used to visually assess
the amount of bias.
It is obtained by graphing the bias
versus the BLUP of the latent trait,
x
, along with the 95% simultaneous confidence bands.
total_bias_plot(object, object2 = NULL, rarea = FALSE)
total_bias_plot(object, object2 = NULL, rarea = FALSE)
object |
list returned by measure_compare function. |
object2 |
(optional) returned by measure_compare function. If provided, will plot a second total bias estimate. |
rarea |
if |
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the total bias total_bias_plot(measure_model)
### Load the data data(data1) ### Analysis measure_model <- measure_compare(data1, nb_simul=100) ### Plot the total bias total_bias_plot(measure_model)