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

simulate_MB4(
  iterations,
  beta,
  rho,
  phi,
  tau2_ratio,
  tau_corr,
  p_const,
  r_const,
  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

tau2_ratio

ratio of trend variance to intercept variance

tau_corr

correlation between case-specific trends and intercepts

p_const

vector of constants for calculating numerator of effect size

r_const

vector of constants for calculating denominator of effect size

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


simulate_MB4(iterations = 5, beta = c(0,1,0,0), rho = 0.8, phi = 0.5, 
             tau2_ratio = 0.5, tau_corr = 0, 
             p_const = c(0,1,0,7), r_const = c(1,0,1,0,0), 
             design = design_matrix(3, 16, treat_times=c(5,9,13), center = 12))
#> 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: 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.
#>                                  mean         var
#> p_beta                     0.90786533  0.60919917
#> r_theta                    0.72190950  0.29746647
#> delta_AB                   1.26267885  1.23136092
#> nu                         4.79853424 13.68057596
#> kappa                      0.56651232  0.04464172
#> g_AB                       1.00503299  0.88205241
#> V_g_AB                     1.26289285  0.47313348
#> cnvg_warn                  0.80000000  0.20000000
#> sigma_sq                   0.26582104  0.04144079
#> phi                        0.54825841  0.04814683
#> Tau.id.var(constant)       0.45608846  0.30819490
#> Tau.id.cov(trend,constant) 0.05595113  0.15749032
#> Tau.id.var(trend)          0.52727241  0.07815863
#> RML_coverage1              0.80000000  0.20000000
#> RML_coverage2              1.00000000  0.00000000
             
simulate_MB4(iterations = 5, beta = c(0,1,0,0), rho = 0.8, phi = 0.5, 
             tau2_ratio = 0.5, tau_corr = 0, m = 6, 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: '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.
#>                                 mean          var
#> p_beta                     1.0193101 0.0534911473
#> r_theta                    0.6543626 0.0258859203
#> delta_AB                   1.2628964 0.0525578915
#> nu                         7.6334890 0.5647078268
#> kappa                      0.3737110 0.0019066609
#> g_AB                       1.1326260 0.0399160641
#> V_g_AB                     0.2814734 0.0008029116
#> cnvg_warn                  0.2000000 0.2000000000
#> sigma_sq                   0.3761835 0.0491877578
#> phi                        0.6218427 0.0364771287
#> Tau.id.var(constant)       0.2781791 0.0691504202
#> Tau.id.cov(trend,constant) 0.1026622 0.0539376551
#> Tau.id.var(trend)          0.4106644 0.0415225349
#> RML_coverage1              1.0000000 0.0000000000
#> RML_coverage2              1.0000000 0.0000000000