# Specify the model
mod <-
"
m ~ x + w1 + x:w1
y ~ m + x
"
# Specify the population values
mod_es <-
"
m ~ x: n
y ~ x: m
m ~ w1: n
m ~ x:w1: l
"
# Simulate the data
sim_only <- power4test(nrep = 4,
model = mod,
pop_es = mod_es,
n = 100,
do_the_test = FALSE,
iseed = 1234)
# Do the test in each replication
test_out <- power4test(object = sim_only,
test_fun = test_moderation)
print(test_out,
test_long = TRUE)
Run the code above in your browser using DataLab