print.indirect {manymome} | R Documentation |
Print an 'indirect' Class Object
Description
Print the content of the
output of indirect_effect()
or
cond_indirect()
.
Usage
## S3 method for class 'indirect'
print(x, digits = 3, pvalue = FALSE, pvalue_digits = 3, se = FALSE, ...)
Arguments
x |
The output of
|
digits |
Number of digits to display. Default is 3. |
pvalue |
Logical. If |
pvalue_digits |
Number of decimal places to display for the p-value. Default is 3. |
se |
Logical. If |
... |
Other arguments. Not used. |
Details
The print
method of the
indirect
-class object.
If bootstrapping confidence interval was requested, this method has the option to print a p-value computed by the method presented in Asparouhov and Muthén (2021). Note that this p-value is asymmetric bootstrap p-value based on the distribution of the bootstrap estimates. It is not computed based on the distribution under the null hypothesis.
For a p-value of a, it means that a 100(1 - a)% bootstrapping confidence interval will have one of its limits equal to 0. A confidence interval with a higher confidence level will include zero, while a confidence interval with a lower confidence level will exclude zero.
We recommend using confidence interval
directly. Therefore, p-value is not
printed by default. Nevertheless,
users who need it can request it
by setting pvalue
to TRUE
.
Value
x
is returned invisibly.
Called for its side effect.
References
Asparouhov, A., & Muthén, B. (2021). Bootstrap p-value computation. Retrieved from https://www.statmodel.com/download/FAQ-Bootstrap%20-%20Pvalue.pdf
See Also
indirect_effect()
and
cond_indirect()
Examples
library(lavaan)
dat <- modmed_x1m3w4y1
mod <-
"
m1 ~ a1 * x + b1 * w1 + d1 * x:w1
m2 ~ a2 * m1 + b2 * w2 + d2 * m1:w2
m3 ~ a3 * m2 + b3 * w3 + d3 * m2:w3
y ~ a4 * m3 + b4 * w4 + d4 * m3:w4
"
fit <- sem(mod, dat,
meanstructure = TRUE, fixed.x = FALSE,
se = "none", baseline = FALSE)
est <- parameterEstimates(fit)
wvalues <- c(w1 = 5, w2 = 4, w3 = 2, w4 = 3)
indirect_1 <- cond_indirect(x = "x", y = "y",
m = c("m1", "m2", "m3"),
fit = fit,
wvalues = wvalues)
indirect_1
dat <- modmed_x1m3w4y1
mod2 <-
"
m1 ~ a1 * x
m2 ~ a2 * m1
m3 ~ a3 * m2
y ~ a4 * m3 + x
"
fit2 <- sem(mod2, dat,
meanstructure = TRUE, fixed.x = FALSE,
se = "none", baseline = FALSE)
est <- parameterEstimates(fit)
indirect_2 <- indirect_effect(x = "x", y = "y",
m = c("m1", "m2", "m3"),
fit = fit2)
indirect_2
print(indirect_2, digits = 5)