vlt.stats.artificialAnovaTable
vlt.stats.artificialAnovaTable Generates an artificial data table for ANOVA power analysis.
[T, powerParams] = vlt.stats.artificialAnovaTable(factorNames, factorLevels, ...
nPerGroup, differenceToTest, differenceFactors, SD_Components)
Generates a data table T for a repeated-measures (mixed-effects)
design. It assumes the first factor (e.g., 'Drug') is the
between-subjects grouping factor, and all subsequent factors (e.g., 'Day')
are within-subjects (repeated measures).
This function is ideal for generating data to test a power simulation.
Inputs:
factorNames (cell array): The names of the *fixed factors* only.
Example: {'Drug', 'Day'}
factorLevels (vector): The number of levels for each fixed factor.
Example: [2, 4] (for 2 drugs and 4 time points)
nPerGroup (scalar): The number of random subjects (e.g., animals)
per group in the *first* factor.
Example: 10 (Creates 10 animals for 'Drug_1' and 10 for 'Drug_2')
differenceToTest (scalar): The effect size (mean difference) to apply.
Example: 5.0
differenceFactors (vector): 1-based indices of the factors to apply
the difference to. The difference is *always* applied to the
*last level* of these factors.
Example 1 (Main Effect): [1] -> Applies diff to all 'Drug_2' cells.
Example 2 (Interaction): [1, 2] -> Applies diff to the
('Drug_2', 'Day_4') cell.
SD_Components (struct): Struct with standard deviations.
Example: struct('RandomIntercept', 2.0, 'Residual', 3.0)
.RandomIntercept: The "between-subject" SD (e.g., sigma_animal).
.Residual: The "within-subject" SD (e.g., sqrt(MSE) or sigma_error).
Outputs:
T (table): The generated artificial data table.
Columns: [factorNames..., 'Animal', 'Measurement']
(e.g., 'Drug', 'Day', 'Animal', 'Measurement')
powerParams (struct): A struct formatted to pass to
vlt.stats.calculateTukeyPairwisePower.
See also: vlt.stats.calculateTukeyPairwisePower, fitlme