CorrMixed (version 0.1-1)

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

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

Explore.WS.Corr(OLS.Model=" ", Dataset, Id, Time, 
Max.Time="All", 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 b
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.
Max.Time
The maximum time that should be considered. When there are e.g., $40$ repeated measures in the dataset but interest is limited to e.g., the first $20$ observations (time lags $1$--$19$), the argument Max.Time=20 can be used.
Alpha
The $\alpha$-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.
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.CorrThe 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.CorrsA matrix that contains the estimated correlations $R$ for all individual time lags.
  • Bootstrapped.CorrsA matrix that contains the estimated correlations $R$ as a function of time lag in the bootstrapped samples.
  • AlphaThe $\alpha$ level used in the estimation of the confidence interval.
  • CI.UpperThe upper bounds of the confidence intervals.
  • CI.LowerThe lower bounds of the confidence intervals.

References

Van der Elst, W., Molenberghs, G., Hilgers, R., & Heussen, N. (2015). Correlation in continuous monitoring of vital parameters I - estimating reliability using linear mixed-effects models. Submitted.

See Also

plot.Explore.WS.Corr

Examples

Run this code
# 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", Max.Time=40, 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)

Run the code above in your browser using DataCamp Workspace