knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
knitr::opts_chunk$set(echo = TRUE, tidy = FALSE) options(width = 80) library(knitr) library(rmarkdown) library(rmcorr) library(psych) library(cocor)
In versions of rmcorr prior to 0.5.4, confidence intervals (CIs) were incorrectly calculated using the error degrees of freedom instead of using the effective sample size (error df + 2). Generally, the difference is slight, with the previous incorrect CIs tending to be a bit too broad (conservative). However, when both the number of participants and repeated measures are small, the prior incorrect confidence intervals were substantially too wide. In other words, a difference of 2 in the df has diminishing impact on the width of CIs as the error df increases.
This fix does not change the effect size, p-value, or the error degrees of freedom. All remain the same as prior versions. Bootstrapped CIs are also unaffected.
We use the data from raz2005 to compare the old, incorrect CI calculation to the current, correct CI. The sample size is N = 72 with k = 2 repeated measures. Note the difference in CI bounds is slight: old, incorrect 95\% CI [-0.8053581, -0.5637514] and current, correct 95\% CI [ -0.804153, -0.566080].
brainvolage.rmc <- rmcorr(participant = Participant, measure1 = Age, measure2 = Volume, dataset = raz2005) #Old, incorrect CI using error df psych::r.con(brainvolage.rmc$r, brainvolage.rmc$df, p = 0.95) #Current, correct CI using effective sample size brainvolage.rmc$CI #Manual calculation psych::r.con(brainvolage.rmc$r, brainvolage.rmc$df + 2, p = 0.95)
For a small sample size (N = 5 total participants) with k = 2 repeated measures and rrm = 0.88, we show a substantial difference in the old 95\% CI [-0.5257087, 0.9974701] compared to the correct 95\% CI [0.2394418, 0.9868084].
#Old, incorrect CI using error df psych::r.con(0.88, 4, p = 0.95) #Current, correct CI using effective sample size psych::r.con(0.88, 6, p = 0.95)
The same example as above except with the number of participants quadrupled: N = 20. Note the difference in coverage of CIs is now slight.
#Old, incorrect CI using error df psych::r.con(0.88, 19, p = 0.95) #Current, correct CI using effective sample size psych::r.con(0.88, 21, p = 0.95)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.