Return the estimate of the standardized moderation effect in the output of stdmod_lavaan().

# S3 method for stdmod_lavaan
coef(object, ...)

Arguments

object

The output of stdmod_lavaan().

...

Optional arguments. Ignored by the function.

Value

A scalar: The estimate of the standardized moderation effect.

Details

It just extracts and returns the element stdmod.

Examples


# Load a test data of 500 cases
dat <- test_mod1
library(lavaan)
#> This is lavaan 0.6-12
#> lavaan is FREE software! Please report any bugs.

mod <-
"
med ~ iv + mod + iv:mod + cov1
dv ~ med + cov2
"
fit <- sem(mod, dat)
coef(fit)
#>     med~iv    med~mod med~iv:mod   med~cov1     dv~med    dv~cov2   med~~med 
#>      0.221      0.104      0.257      0.104      0.246      0.191      0.201 
#>     dv~~dv 
#>      0.169 

# Compute the standardized moderation effect
out_noboot <- stdmod_lavaan(fit = fit,
                            x = "iv",
                            y = "med",
                            w = "mod",
                            x_w = "iv:mod")
coef(out_noboot)
#> med~iv:mod 
#>  0.4397874 

# Compute the standardized moderation effect and
# its confidence interval based on nonparametric bootstrapping
set.seed(8479075)
system.time(out_boot <- stdmod_lavaan(fit = fit,
                                      x = "iv",
                                      y = "med",
                                      w = "mod",
                                      x_w = "iv:mod",
                                      boot_ci = TRUE,
                                      R = 50))
#>    user  system elapsed 
#>   0.909   0.027   0.911 
# In real analysis, R should be at least 2000.
coef(out_boot)
#> med~iv:mod 
#>  0.4397874