lavaan_summary: Tidy report of lavaan model.

Description Usage Arguments Value See Also Examples

View source: R/bruceR_stats_05_advance.R

Description

Tidy report of lavaan model.

Usage

1
2
3
4
5
6
7
8
9
lavaan_summary(
  lavaan,
  ci = c("raw", "boot", "bc.boot", "bca.boot"),
  nsim = 100,
  seed = NULL,
  digits = 3,
  nsmall = digits,
  print = TRUE
)

Arguments

lavaan

Model object fitted by lavaan.

ci

Method for estimating the standard error (SE) and 95% confidence interval (CI) of user-defined parameter(s). Default is "raw" (the standard approach of lavaan). Other options include:

"boot"

Percentile Bootstrap

"bc.boot"

Bias-Corrected Percentile Bootstrap

"bca.boot"

Bias-Corrected and Accelerated (BCa) Percentile Bootstrap

nsim

Number of simulation samples (bootstrap resampling) for estimating SE and 95% CI of user-defined parameter(s). Default is 100 for running examples faster. In formal analyses, however, nsim=1000 (or larger) is strongly suggested!

seed

Random seed for obtaining reproducible results. Default is NULL.

digits, nsmall

Number of decimal places of output. Default is 3.

print

Print results. Default is TRUE.

Value

Invisibly return a list of results:

fit

Fit measures.

path

Path coefficients.

effect

Used-defined effect estimates.

See Also

PROCESS

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
## Simple Mediation:
## Solar.R (X) => Ozone (M) => Temp (Y)

# PROCESS(airquality, y="Temp", x="Solar.R",
#         meds="Ozone", ci="boot", nsim=1000, seed=1)

model="
Ozone ~ a*Solar.R
Temp ~ c.*Solar.R + b*Ozone
Indirect := a*b
Direct := c.
Total := c. + a*b
"
lv=lavaan::sem(model=model, data=airquality)
lavaan::summary(lv, fit.measure=TRUE, ci=TRUE, nd=3)  # raw output
lavaan_summary(lv)
# lavaan_summary(lv, ci="boot", nsim=1000, seed=1)


## Serial Multiple Mediation:
## Solar.R (X) => Ozone (M1) => Wind(M2) => Temp (Y)

# PROCESS(airquality, y="Temp", x="Solar.R",
#         meds=c("Ozone", "Wind"),
#         med.type="serial", ci="boot", nsim=1000, seed=1)

model0="
Ozone ~ a1*Solar.R
Wind ~ a2*Solar.R + d12*Ozone
Temp ~ c.*Solar.R + b1*Ozone + b2*Wind
Indirect_All := a1*b1 + a2*b2 + a1*d12*b2
Ind_X_M1_Y := a1*b1
Ind_X_M2_Y := a2*b2
Ind_X_M1_M2_Y := a1*d12*b2
Direct := c.
Total := c. + a1*b1 + a2*b2 + a1*d12*b2
"
lv0=lavaan::sem(model=model0, data=airquality)
lavaan::summary(lv0, fit.measure=TRUE, ci=TRUE, nd=3)  # raw output
lavaan_summary(lv0)
# lavaan_summary(lv0, ci="boot", nsim=1000, seed=1)

model1="
Ozone ~ a1*Solar.R
Wind ~ d12*Ozone
Temp ~ c.*Solar.R + b1*Ozone + b2*Wind
Indirect_All := a1*b1 + a1*d12*b2
Ind_X_M1_Y := a1*b1
Ind_X_M1_M2_Y := a1*d12*b2
Direct := c.
Total := c. + a1*b1 + a1*d12*b2
"
lv1=lavaan::sem(model=model1, data=airquality)
lavaan::summary(lv1, fit.measure=TRUE, ci=TRUE, nd=3)  # raw output
lavaan_summary(lv1)
# lavaan_summary(lv1, ci="boot", nsim=1000, seed=1)

bruceR documentation built on June 22, 2021, 1:06 a.m.