Explore.WS.Corr: Explore within-subject correlations (reliabilities)

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/Explore.WS.Corr.R

Description

This function allows for exploring the within-subject (test-retest) correlation (R) structure in the data, taking relevant covariates into account. Estimated correlations as a function of time lag (= absolute difference between measurement moments t_1 and t_2) are provided as well as their confidence intervals (based on a non-parametric bootstrap).

Usage

1
2
3
Explore.WS.Corr(OLS.Model=" ", Dataset, Id, Time, 
Alpha=0.05, Smoother.Span=.2, Number.Bootstrap=100, 
Seed=1)

Arguments

OLS.Model

OLS.Model is a formula passed to lm (to obtain the OLS residuals, i.e., to take covariates into account in the computation of R). OLS.Model should thus be a formula that specifies the outcome of interest followed by a ~ sign and the covariates to be taken into account, e.g.

OLS.Model="Outcome~1+as.factor(Time) + as.factor(Treatment)".

Dataset

A data.frame that should consist of multiple lines per subject ('long' format).

Id

The subject indicator.

Time

The time indicator. Should be coded as 1, 2, etc.

Alpha

The α-level to be used in the non-parametric bootstrap-based Confidence Interval for R. Default Alpha=0.05

Smoother.Span

A smoothing (loess) technique is used to estimate R as a function of time lag. The smoother span gives the proportion of points in the plot which influence the smooth at each value. Larger values give more smoothness. For details, see https://stat.ethz.ch/R-manual/R-patched/library/stats/html/lowess.html. Defauls Smoother.Span=.2.

Number.Bootstrap

The number of non-parametric bootstrap samples to be used to estimate the Confidence Interval for R. Default Number.Bootstrap=100

Seed

The seed to be used in the bootstrap. Default Seed=1.

Value

Est.Corr

The estimated correlations R as a function of time lag. A smoothing (loess) technique is used to estimate R as a function of time lag (based on the output in All.Corrs).

All.Corrs

A matrix that contains the estimated correlations R for all individual time lags.

Bootstrapped.Corrs

A matrix that contains the estimated correlations R as a function of time lag in the bootstrapped samples.

Alpha

The α level used in the estimation of the confidence interval.

CI.Upper

The upper bounds of the confidence intervals.

CI.Lower

The lower bounds of the confidence intervals.

Author(s)

Wim Van der Elst, Geert Molenberghs, Ralf-Dieter Hilgers, & Nicole Heussen

References

Van der Elst, W., Molenberghs, G., Hilgers, R., & Heussen, N. (2015). Estimating the reliability of repeatedly measured endpoints based on linear mixed-effects models. A tutorial. Submitted.

See Also

plot.Explore.WS.Corr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Open data
data(Example.Data)

# Explore correlation structure
Expl_Corr <- Explore.WS.Corr(OLS.Model="Outcome~as.factor(Time)+ 
  as.factor(Cycle) + as.factor(Condition)", Dataset=Example.Data, 
  Id="Id", Time="Time", Alpha=.05, Number.Bootstrap=50, Seed=123)

# explore results
summary(Expl_Corr)

# plot with correlations for all time lags, and 
# add smoothed (loess) correlation function 
plot(Expl_Corr, Indiv.Corrs=TRUE)
# plot bootstrapped smoothed (loess) correlation function 
plot(Expl_Corr)

Example output

Loading required package: nlme
Estimated correlations (as a function of time lag):
#==================================================
 [1]  0.993537984  0.982641225  0.930955103  0.791871531  0.598514523
 [6]  0.315781067  0.458325761  0.398833840  0.491485978  0.600097802
[11]  0.805612967  0.789318606  0.877023638  0.876136390  0.952953729
[16]  0.674330143  0.556926585  0.180733876  0.249880796 -0.121012486
[21] -0.243025244 -0.370991257 -0.553685844 -0.186027773  0.275747841
[26]  0.087227537  0.134854586 -0.115637995 -0.096025098 -0.137790839
[31] -0.008822229 -0.112176641 -0.247695629 -0.428173174 -0.400234228
[36] -0.950470618 -0.429848875 -0.863738573 -0.838143384 -0.438173506
[41] -0.826407801  0.633957023 -0.097520580  0.367347011 -1.000000000
attr(,"na.action")
[1] 46
attr(,"class")
[1] "exclude"

95% bootstrapped Confidence Intervals
Lower limit:
#=======================================
 [1]  0.707401535  0.553545747  0.356069744  0.190940031 -0.049673598
 [6] -0.255103955 -0.384031743 -0.599468745 -0.432054420 -0.225471301
[11] -0.013738656  0.001543266  0.092691382  0.018440931 -0.040700231
[16] -0.172974452 -0.382471214 -0.258454437 -0.329400588 -0.609216952
[21] -0.806503776 -0.648592362 -0.868366211 -0.747845187 -0.480059649
[26] -0.684950476 -0.893959805 -0.862975409 -0.986129806 -0.930285240
[31] -0.979268994 -0.891229020 -0.932269215 -0.864929525 -0.786144808
[36] -0.993746520 -0.998323182 -1.000000000 -0.992720995 -1.000000000
[41] -1.000000000 -1.000000000 -1.000000000 -1.000000000 -1.000000000

Upper limit:
#=======================================
 [1] 0.99975191 0.99856660 0.98338301 0.95471247 0.87839439 0.87111247
 [7] 0.78966803 0.76274116 0.79852904 0.85766860 0.92556923 0.94604742
[13] 0.98551983 0.96818130 0.98530645 0.96618168 0.85712018 0.93728676
[19] 0.89565697 0.75462936 0.78754541 0.55250075 0.21163872 0.52919323
[25] 0.82129537 0.74053028 0.84446023 0.71901388 0.95076941 0.84443874
[31] 0.82515355 0.84168757 0.90348532 0.74752140 0.59978081 0.20987420
[37] 0.36457217 0.30923664 0.09878425 1.00000000 1.00000000 1.00000000
[43] 0.56392919 0.88663451 1.00000000

CorrMixed documentation built on May 2, 2019, 3:26 p.m.