View source: R/test_moderation.R
test_moderation | R Documentation |
Test all moderation
effects by testing all product
terms for a power4test
object.
test_moderation(
fit = fit,
standardized = FALSE,
check_post_check = TRUE,
...,
fit_name = "fit",
get_map_names = FALSE,
get_test_name = FALSE
)
fit |
The fit object, to be
passed to |
standardized |
Logical. If |
check_post_check |
Logical. If
|
... |
Additional arguments to
be passed to |
fit_name |
The name of the fit
results for which the parameter names
will be displayed. Default is |
get_map_names |
Logical. Used
by |
get_test_name |
Logical. Used
by |
This function is to be used in
power4test()
for testing all
product terms, by
setting it to the test_fun
argument.
It is just a wrapper to
test_parameters()
. It will
first identifies all product
terms (terms with :
in the names),
and then call test_parameters()
,
with pars
set to select the
regression coefficients of these
terms.
In its normal usage, it returns
the output returned by
lavaan::parameterEstimates()
or lmhelprs::lm_list_to_partable()
,
with the following modifications:
est
: The parameter estimates,
even if standardized estimates
are requested (not est.std
).
cilo
and cihi
: The
lower and upper limits of the
confidence interval (95% by
default), respectively (not
ci.lower
and ci.upper
).
sig
: Whether a test by confidence
interval is significant (1
) or
not significant (0
).
test_label
: A column of labels
generated by
lavaan::lav_partable_labels()
,
which are usually the labels used by
coef()
to label the parameters.
power4test()
,
test_parameters()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.