Power can be calculated using the function in the paper vignette.
This function modifies pwr.r.test from the
pwr package to use
the rmcorr degrees of freedom.
For G*Power or another package, power can be calculated by
substituting the rmcorr degrees of freedom for a Pearson correlation.
Instead of sample size, use the degrees of freedom for rmcorr plus two.
This is because a Pearson correlation has N - 2 degrees of
freedom.
Rmcorr exact degrees of freedom: (k - 1) x
(N - 1), where k is the number of repeated measures
for each individual and N is the sample size.
Example: k = 3 and N = 100.
rmcorr df = (3 - 1)
x (100 - 1) = 2 x 99 = 198.
Add two (kludge): 198 + 2 = 200.
Enter N = 200 as the effective sample size in G*Power.
G*Power will calculate the degrees of freedom as N - 2 = 200 -
2 = 198. Thus, using the correct degrees of freedom for rmcorr.
<- rmcorr(participant = Subject, measure1 = PaCO2, measure2 = pH,
my.rmc dataset = bland1995)
#> Warning in rmcorr(participant = Subject, measure1 = PaCO2, measure2 = pH, :
#> 'Subject' coerced into a factor
# Structure of rmcorr object
#str(my.rmc)
# Extract rmcorr model coefficients
<- my.rmc$model$coefficients
coef.rmc
coef.rmc#> (Intercept) Participant1 Participant2 Participant3 Participant4 Participant5
#> 7.65590848 -0.72605418 -0.02144291 0.22395850 0.24550355 0.13432752
#> Participant6 Participant7 Measure1
#> 0.20037424 -0.03394863 -0.10832305
<- coef.rmc[length(coef.rmc)] #Last value in coefficients is the slope
slope.rmc
slope.rmc#> Measure1
#> -0.108323
# Confidence intervals around all estimates
<- stats::confint(my.rmc$model)
coef.CIs <- cbind(coef.rmc, coef.CIs)
coefs.all
coefs.all#> coef.rmc 2.5 % 97.5 %
#> (Intercept) 7.65590848 7.34994594 7.96187102
#> Participant1 -0.72605418 -0.83211999 -0.61998837
#> Participant2 -0.02144291 -0.11116705 0.06828123
#> Participant3 0.22395850 0.16049969 0.28741732
#> Participant4 0.24550355 0.16448903 0.32651806
#> Participant5 0.13432752 0.05868538 0.20996967
#> Participant6 0.20037424 0.12673292 0.27401556
#> Participant7 -0.03394863 -0.17148111 0.10358385
#> Measure1 -0.10832305 -0.16883787 -0.04780822
Transformations can be used to make the data (errors) more normal. We
highly recommend graphing both the raw and transformed data.
It may
be appropriate to only transform one measure or transform both measures.
“Consider transforming every variable in sight” (Gelman & Hill,
2017: Data Analysis Using Regression and Multilevel/Hierarchical
Models, ISBN: 9780521686891, p. 548).
In general, rmcorr is a time-independent model– it does not model
change over time. A partial exception is if time is a measure, such as
age in the raz2005 dataset.
If slopes meaningfully vary by individual, we recommend using
multilevel modeling. Random effect slopes are even more for rmcorr with
influential observations and/or highly unbalanced data. This is nicely
illustrated in simulations by Dr. Marta Karas:
When
rmcorr may not be ideal