Simulates data from a linear mixed effects model, then calculates REML effect size estimator as described in Pustejovsky, Hedges, & Shadish (2014).

simulate_MB2(
  iterations,
  beta,
  rho,
  phi,
  tau1_ratio,
  tau_corr,
  design,
  m,
  n,
  MB = TRUE
)

Arguments

iterations

number of independent iterations of the simulation

beta

vector of fixed effect parameters

rho

intra-class correlation parameter

phi

autocorrelation parameter

tau1_ratio

ratio of treatment effect variance to intercept variance

tau_corr

correlation between case-specific treatment effects and intercepts

design

design matrix. If not specified, it will be calculated based on m, n, and MB.

m

number of cases. Not used if design is specified.

n

number of measurement occasions. Not used if design is specified.

MB

If true, a multiple baseline design will be used; otherwise, an AB design will be used. Not used if design is specified.

Value

A matrix reporting the mean and variance of the effect size estimates and various associated statistics.

References

Pustejovsky, J. E., Hedges, L. V., & Shadish, W. R. (2014). Design-comparable effect sizes in multiple baseline designs: A general modeling framework. Journal of Educational and Behavioral Statistics, 39(4), 211-227. doi:10.3102/1076998614547577

Examples


set.seed(8)
simulate_MB2(iterations = 5, beta = c(0,1,0,0), rho = 0.4, phi = 0.5, 
             tau1_ratio = 0.5, tau_corr = -0.4, design = design_matrix(m=3, n=8))
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: nlminb problem, convergence error code = 1
#>   message = iteration limit reached without convergence (10)
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: nlminb problem, convergence error code = 1
#>   message = iteration limit reached without convergence (10)
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#>                                      mean        var
#> p_beta                          0.9388933 0.16476685
#> r_theta                         1.6966191 1.32374899
#> delta_AB                        0.7970645 0.13801477
#> nu                              3.4960998 0.73197224
#> kappa                           0.4162649 0.01670630
#> g_AB                            0.6111694 0.10411695
#> V_g_AB                          0.5168968 0.10674367
#> cnvg_warn                       0.0000000 0.00000000
#> sigma_sq                        0.4672470 0.01517681
#> phi                             0.1993796 0.04850070
#> Tau.id.var(constant)            1.2293721 1.35813739
#> Tau.id.cov(treatment,constant) -0.8825182 1.18250047
#> Tau.id.var(treatment)           0.8140881 1.06970718
#> RML_coverage1                   1.0000000 0.00000000
#> RML_coverage2                   1.0000000 0.00000000
             
set.seed(8)
simulate_MB2(iterations = 5, beta = c(0,1,0,0), rho = 0.4, phi = 0.5, 
             tau1_ratio = 0.5, tau_corr = -0.4, m = 3, n = 8, MB = FALSE)
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: nlminb problem, convergence error code = 1
#>   message = iteration limit reached without convergence (10)
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: nlminb problem, convergence error code = 1
#>   message = iteration limit reached without convergence (10)
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#> Warning: 'g_REML()' is deprecated and may be removed in a later version of the package. Please use 'g_mlm()' instead.
#>                                      mean        var
#> p_beta                          0.9388933 0.16476685
#> r_theta                         1.6966191 1.32374899
#> delta_AB                        0.7970645 0.13801477
#> nu                              3.4960998 0.73197224
#> kappa                           0.4162649 0.01670630
#> g_AB                            0.6111694 0.10411695
#> V_g_AB                          0.5168968 0.10674367
#> cnvg_warn                       0.0000000 0.00000000
#> sigma_sq                        0.4672470 0.01517681
#> phi                             0.1993796 0.04850070
#> Tau.id.var(constant)            1.2293721 1.35813739
#> Tau.id.cov(treatment,constant) -0.8825182 1.18250047
#> Tau.id.var(treatment)           0.8140881 1.06970718
#> RML_coverage1                   1.0000000 0.00000000
#> RML_coverage2                   1.0000000 0.00000000