Skip to contents

Calculate the association of a variable across multiple time points.

Usage

crossTimeCorrelation(id = "tcid", time = "age", variable, data)

Arguments

id

Name of variable indicating the participant ID.

time

Name of variable indicating the timepoint.

variable

Name of variable to estimate the cross-time correlation.

data

Dataframe.

Value

output of cor.test()

Details

Calculate the association of a variable across multiple time points. It is especially useful when there are three or more time points.

See also

Examples

# Prepare Data
df <- expand.grid(ID = 1:100, time = c(1, 2, 3))
df <- df[order(df$ID),]
row.names(df) <- NULL
df$score <- rnorm(nrow(df))

# Cross-Time Correlation
crossTimeCorrelation(id = "ID", time = "time", variable = "score", data = df)
#> 
#> 	Pearson's product-moment correlation
#> 
#> data:  fullMatrix$time1 and fullMatrix$time2
#> t = 0.83592, df = 198, p-value = 0.4042
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#>  -0.08009842  0.19642652
#> sample estimates:
#>        cor 
#> 0.05930162 
#> 



Developmental Psychopathology Lab