test_parameters | R Documentation |
Test all free parameters,
including user-defined parameters,
for a power4test
object.
test_parameters(
fit = fit,
standardized = FALSE,
pars = NULL,
op = NULL,
remove.nonfree = TRUE,
check_post_check = TRUE,
...,
omnibus = c("no", "all_sig", "at_least_one_sig", "at_least_k_sig"),
at_least_k = 1,
fit_name = "fit",
get_map_names = FALSE,
get_test_name = FALSE
)
find_par_names(object, fit_name = "fit")
fit |
The fit object, to be
passed to |
standardized |
Logical. If |
pars |
Optional. If set to
a character vector, only parameters
with |
op |
Optional. If set to a
character vector, only parameters with
operators (e.g., |
remove.nonfree |
Logical. If
|
check_post_check |
Logical. If
|
... |
Additional arguments to
be passed to |
omnibus |
If |
at_least_k |
The minimum number
of paths required to be significant
for the omnibus test to be considered
significant. Used when
|
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 |
object |
A |
This function is to be used in
power4test()
for testing all
free and user-defined model
parameters, by
setting it to the test_fun
argument.
For models fitted by lavaan
,
it uses lavaan::parameterEstimates()
to do the test. If bootstrapping was
requested (by setting se = "boot"
),
then it supports bootstrap
confidence intervals returned by
lavaan::parameterEstimates()
.
It has preliminary, though limited,
supported for models fitted by
stats::lm()
(through
lmhelprs::many_lm()
). Tests are
conducted by ordinary least squares
confidence intervals based on
the t statistic, reported by
stats::confint()
applied to
the output of stats::lm()
.
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.
To use the argument pars
, the
names as appeared in the function
coef()
must be used. For the
output of lavaan
, this can
usually be inferred from the
parameter syntax (e.g., y~x
,
no space). If not sure, call
coef()
on the output of lavaan
.
If a parameter is labelled, then
the label should be used in par
.
If not sure, the function
find_par_names()
can be used to
find valid names.
power4test()
# Specify the model
mod <-
"
m ~ x
y ~ m + x
"
# Specify the population values
mod_es <-
"
y ~ m: l
m ~ x: m
y ~ x: n
"
# Simulate the data
sim_only <- power4test(nrep = 2,
model = mod,
pop_es = mod_es,
n = 100,
do_the_test = FALSE,
iseed = 1234)
# Do the tests in each replication
test_out <- power4test(object = sim_only,
test_fun = test_parameters)
print(test_out,
test_long = TRUE)
# Do the tests in each replication: Standardized solution
# Delta method SEs will be used to do the tests
test_out <- power4test(object = sim_only,
test_fun = test_parameters,
test_args = list(standardized = TRUE))
print(test_out,
test_long = TRUE)
# Do the tests in each replication: Parameters with the selected operator
test_out <- power4test(object = sim_only,
test_fun = test_parameters,
test_args = list(op = "~"))
print(test_out,
test_long = TRUE)
# Finding valid parameter names
find_par_names(sim_only)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.