| makeRepeated | R Documentation |
Constructs a synthetic dataset and inter-timepoint correlation matrix from a repeated-measures ANOVA result, based on reported means, standard deviations, and an F-statistic. This is useful when only summary statistics are available from published studies.
makeRepeated(
n,
k,
means,
sds,
f_stat,
df_between = k - 1,
df_within = (n - 1) * (k - 1),
structure = c("cs", "ar1", "toeplitz"),
names = paste0("time_", 1:k),
items = 1,
lowerbound = 1,
upperbound = 5,
return_corr_only = FALSE,
diagnostics = FALSE,
...
)
n |
Integer. Sample size used in the original study. |
k |
Integer. Number of repeated measures (timepoints). |
means |
Numeric vector of length |
sds |
Numeric vector of length |
f_stat |
Numeric. The reported repeated-measures ANOVA F-statistic for the within-subjects factor. |
df_between |
Degrees of freedom between conditions (default: |
df_within |
Degrees of freedom within-subjects
(default: |
structure |
Character. Correlation structure to assume:
|
names |
Character vector of length |
items |
Integer. Number of items used to generate each scale score (passed to lfast). |
lowerbound |
Integer. Lower bounds for Likert-type response scales (default: 1). |
upperbound |
Integer. upper bounds for Likert-type response scales (default: 5). |
return_corr_only |
Logical. If |
diagnostics |
Logical. If |
... |
Reserved for future use. |
This function estimates the average correlation between repeated measures by matching the reported F-statistic, under one of three assumed correlation structures:
"cs" (Compound Symmetry): The Default. Assumes all timepoints are
equally correlated. Common in standard RM-ANOVA settings.
"ar1" (First-Order Autoregressive): Assumes correlations decay
exponentially with time lag.
"toeplitz" (Linearly Decreasing): Assumes correlation declines
linearly with time lag - a middle ground between "cs" and "ar1".
The function then generates a data frame of synthetic item-scale ratings using lfast, and adjusts them to match the estimated correlation structure using lcor.
Set return_corr_only = TRUE to extract only the estimated
correlation matrix.
A named list with components:
dataA data frame of simulated repeated-measures responses
(unless return_corr_only = TRUE).
correlation_matrixThe estimated inter-timepoint correlation matrix.
structureThe correlation structure assumed.
achieved_fThe F-statistic produced by the estimated rho value
(if diagnostics = TRUE).
feasible_f_rangeMinimum and maximum achievable F-values under the chosen structure (shown if diagnostics are requested).
recommended_fConservative, moderate, and strong F-statistic suggestions for similar designs.
effect_size_rawUnstandardised effect size across timepoints.
effect_size_standardisedEffect size standardised by average variance.
lfast, lcor
set.seed(42)
out1 <- makeRepeated(
n = 64,
k = 3,
means = c(3.1, 3.5, 3.9),
sds = c(1.0, 1.1, 1.0),
items = 4,
f_stat = 4.87,
structure = "cs",
diagnostics = FALSE
)
head(out1$data)
out1$correlation_matrix
out2 <- makeRepeated(
n = 32, k = 4,
means = c(2.75, 3.5, 4.0, 4.4),
sds = c(0.8, 1.0, 1.2, 1.0),
f_stat = 16,
structure = "ar1",
items = 5,
lowerbound = 1, upperbound = 7,
return_corr_only = FALSE,
diagnostics = TRUE
)
print(out2)
out3 <- makeRepeated(
n = 64, k = 4,
means = c(2.0, 2.25, 2.75, 3.0),
sds = c(0.8, 0.9, 1.0, 0.9),
items = 4,
f_stat = 24,
# structure = "toeplitz",
diagnostics = TRUE
)
str(out3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.