View source: R/simulation-functions.R
simulate_MB2 | R Documentation |
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
)
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 |
number of cases. Not used if |
n |
number of measurement occasions. Not used if |
MB |
If true, a multiple baseline design will be used; otherwise, an AB design will be used. Not used if |
A matrix reporting the mean and variance of the effect size estimates and various associated statistics.
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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3102/1076998614547577")}
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))
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.