library(SimplyAgree) #library(tidyverse) library(dplyr) library(tidyr) library(ggplot2) library(magrittr) data("temps") = tempsdf_temps
In the study by Ravanelli and Jay (2020), they attempted to estimate the effect of varying the time of day (AM or PM) on the measurement of thermoregulatory variables (e.g., rectal and esophageal temperature). In total, participants completed 6 separate trials wherein these variables were measured. While this is a robust study of these variables the analyses focused on ANOVAs and t-tests to determine whether or not the time-of-day (AM or PM). This poses a problem because 1) they were trying to test for equivalence and 2) this is a study of agreement not differences (See Lin (1989)). Due to the latter point, the use of t-test or ANOVAs (F-tests) is rather inappropriate since they provide an answer to different, albeit related, question.
Instead, the authors could test their hypotheses by using tools that
estimate the absolute agreement between the AM and PM sessions
within each condition. This is rather complicated because we have
multiple measurement within each participant. However, between the tools
SimplyAgree1 I believe we can get closer to the right
In order to understand the underlying processes of these functions
and procedures I highly recommend reading the statistical literature
that documents methods within these functions. For the
cccrm package please see the work by Josep L. Carrasco and Jover (2003), Josep L. Carrasco, King, and Chinchilli (2009),
and Josep L. Carrasco et al. (2013). The
loa_lme function was inspired by the work of Parker et al. (2016) which documented how to
implement multi-level models and bootstrapping to estimate the limits of
An easy approach to measuring agreement between 2 conditions or measurement tools is through the concordance correlation coefficient (CCC). The CCC essentially provides a single coefficient (values between 0 and 1) that provides an estimate to how closely one measurement is to another. It is a type of intraclass correlation coefficient that takes into account the mean difference between two measurements. In other words, if we were to draw a line of identity on a graph and plot two measurements (X & Y), the closer those points are to the line of identity the higher the CCC (and vice versa).
qplot(1,1) + geom_abline(intercept = 0, slope = 1)
In the following sections, let us see how well esophageal and rectal temperature are in agreement after exercising in the heat for 1 hour at differing conditions.
We can visualize the concordance between the two different types of measurements and the respective time-of-day and conditions. From the plot we can see there is clear bias in the raw post exercise values (higher in the PM), but even when “correcting for baseline differences” by calculating the differences scores we can see a higher degree of disagreement between the two conditions.
#> Warning: Removed 3 row(s) containing missing values (geom_path).
loa_lme function can be used to calculate the
“limits of agreement”. Typically the 95% Limits of Agreement are
calculated which provide the difference between two measuring systems
for 95% of future measurements pairs. In order to do that we will need
the data in a “wide” format where each measurement (in this case AM and
PM) are their own column and then we can calculate a column that is the
difference score. Once we have the data in this “wide” format, we can
then use the
loa_lme function to calculate the average
difference (mean bias) and the variance (which determines the limits of
So we will calculate the limits of agreement using the
loa_lme function. We will need to identify the columns with
the right information using the
id arguments. We then select
the right data set using the
data argument. Lastly, we
specify the specifics of the conditions for how the limits are
calculated. For this specific analysis I decided to calculate 95% limits
of agreement with 95% confidence intervals, and I will use percentile
bootstrap confidence intervals.
= SimplyAgree::loa_lme(diff = "diff", rec.post_loa condition = "trial_condition", id = "id", avg = "Average", data = df_rec.post, conf.level = .95, agree.level = .95, replicates = 199, type = "perc")
When we create a table of the limits of agreement (LoA), at least for Trec post exercise, are providing the same conclusion (poor agreement).
::kable(rec.post_loa$loa, knitrcaption = "LoA: Trec Post Exercise")
Furthermore, we can visualize the results with a typical Bland-Altman plot of the LoA.
Now, when we look at the Delta values for Trec we find that there is much closer agreement (maybe even acceptable agreement) when we look at LoA. However, we cannot say that the average difference would be less than 0.25 which may not be acceptable for some researchers.
::kable(rec.delta_loa$loa, knitrcaption = "LoA: Delta Trec")
We can repeat the process for esophageal temperature. Overall, the results are fairly similar, and while there is better agreement on the delta (change scores), it is still fairly difficult to determine that there is “good” agreement between the AM and PM measurements.
= SimplyAgree::loa_mixed(diff = "diff", eso.post_loa condition = "trial_condition", id = "id", data = df_eso.post, conf.level = .95, agree.level = .95, replicates = 199, type = "bca")
::kable(eso.post_loa$loa, knitrcaption = "LoA: Teso Post Exercise")
::kable(eso.delta_loa$loa, knitrcaption = "LoA: Delta Teso")
Josep Lluis Carrasco and Martinez (2020) is another package to check out↩︎