Skip to content

vlt.stats.power.simulate_lme_data

  SIMULATE_LME_DATA - (Helper) Generates data using the 'gaussian' (parametric) method.

    Methodology:
    This function simulates new data based on the idealized assumption that
    both the random effects and the residual errors come from normal (Gaussian)
    distributions. The parameters for these distributions (variances) are
    estimated from the baseline model fit on the original data.

    Process:
    1.  Extracts the fixed intercept, random effect standard deviation, and
        residual standard deviation from the `lme_base` model.
    2.  Simulates random effects by drawing one value for each group from
        N(0, sigma_random).
    3.  Simulates residual errors by drawing one value for each observation
        from N(0, sigma_resid).
    4.  Constructs the simulated response Y_sim = Intercept + RandomEffect + Residual.
    5.  "Injects" the `effect_size` by adding it to all rows belonging to
        the `category_level`.

    Assumptions:
    -   The random effects and residuals in the true population are normally
        distributed.

    Pros/Cons:
    +   Statistically efficient and powerful if the normality assumption is correct.
    -   Can produce inaccurate power estimates if the true error distributions
        are skewed, heavy-tailed, or otherwise non-normal.