group_estimates {semhelpinghands} | R Documentation |
Group Estimates By Dependent or Independent Variables
Description
Groups parameter estimates or other information such as p-values into a table with dependent variables as columns and independent variables as rows, or a transpose of this table.
Usage
group_by_dvs(
object,
...,
col_name = "est",
add_prefix = TRUE,
group_first = FALSE,
use_standardizedSolution = FALSE
)
group_by_ivs(
object,
...,
col_name = "est",
add_prefix = TRUE,
group_first = FALSE,
use_standardizedSolution = FALSE
)
Arguments
object |
A lavaan object
or the output of
|
... |
Optional arguments to be
passed to
|
col_name |
The column name of
information to be grouped. Default is
|
add_prefix |
If |
group_first |
If |
use_standardizedSolution |
If |
Details
It gets a lavaan
object or the output of
lavaan::parameterEstimates()
or
lavaan::standardizedSolution()
and
group selected columns by "dependent"
variables group_by_dvs()
or by
"independent" variables
group_by_ivs()
.
"Dependent" variables are defined
as variables on the left hand side
of the operator ~
.
"Independent" variables are defined
as variables on the right hand side
of the operator ~
.
Note that a variable can both be a "dependent" variable and an "independent" variable in a model.
Value
A data-frame-like object of
the class est_table
.
Author(s)
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
Examples
library(lavaan)
set.seed(5478374)
n <- 50
x <- runif(n) - .5
m <- .40 * x + rnorm(n, 0, sqrt(1 - .40))
y <- .30 * m + rnorm(n, 0, sqrt(1 - .30))
dat <- data.frame(x = x, y = y, m = m)
model <-
'
m ~ a*x
y ~ b*m
ab := a*b
'
fit <- sem(model, data = dat, fixed.x = FALSE)
parameterEstimates(fit)
# Group by DVs
group_by_dvs(fit)
# Group by IVs
group_by_ivs(fit)