lrtp {semlrtp} | R Documentation |
Likelihood Ratio Test P-Values
Description
Compute the likelihood ratio
test (LRT) p-values for free
parameters in
a lavaan
output.
Usage
lrtp(
fit,
op = c("~", "~~"),
no_variances = TRUE,
no_error_variances = TRUE,
no_error_covariances = TRUE,
se_keep_bootstrap = FALSE,
LRT_method = "default",
scaled.shifted = TRUE,
fallback_method = "satorra.2000",
progress = TRUE,
parallel = FALSE,
ncores = parallel::detectCores(logical = FALSE) - 1,
load_balancing = TRUE,
...
)
Arguments
fit |
A |
op |
A character vector of
|
no_variances |
Logical. If
|
no_error_variances |
Logical,
If |
no_error_covariances |
Logical.
If |
se_keep_bootstrap |
Logical.
If |
LRT_method |
String. Passed to
the |
scaled.shifted |
Logical.
Used when the method used in
|
fallback_method |
The default
method of |
progress |
Logical. If |
parallel |
Logical. If |
ncores |
Integer. The number of
CPU cores to use if |
load_balancing |
Logical. If
|
... |
Optional arguments to be
passed to |
Details
It finds free parameters in a
lavaan
-class object, computes the
likelihood ratio test (LRT) p-value
for each of them when fixed to zero,
and returns a parameter estimates table
with the LRT p-values
included.
By default, it only computes LRT
p-values for regression paths
and covariances, except for
error covariances. This default
can be overridden using arguments
such as op
, no_variances
,
no_error_variances
,
and no_error_covariances
.
Technical Details
It first identify the parameters
to be processed, and then call
lrt()
on each of them.
Please refer to
https://sfcheung.github.io/semlrtp/articles/internal_workflow.html
for the internal workflow.
Value
An lrt
-class object, which is a
data-frame-like object similar to the
output of lavaan::parameterEstimates()
,
with a column LRTp
for the LRT
p-values, as well as other columns
such as the chi-square difference in
the test. it has a print method,
print.lrtp()
.
Author(s)
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
See Also
Examples
library(lavaan)
data(data_sem16)
mod <-
"
f1 =~ x1 + x2 + x3
f2 =~ x4 + x5 + x6
f3 =~ x7 + x8 + x9
f4 =~ x10 + x11 + x12
f2 ~~ f1
f3 ~ f1 + f2
f4 ~ f3
"
fit <- sem(mod, data_sem16)
lrtp(fit)
lrtp(fit, op = "~")