
Calculate a mediation analysis for an SEM based on a modsem model.
Source:R/rmedsem_modsem.R
rmedsem.modsem.Rd
Calculate a mediation analysis for an SEM based on a modsem model.
Arguments
- mod
A fitted SEM model (modsem).
- indep
A string indicating the name of the independent variable in the model.
- med
A string indicating the name of the mediator variable in the model.
- dep
A string indicating the name of the dependent variable in the model.
- moderator
A string indicating the name of the moderator variable in the model.
- standardized
A boolean indicating whether the coefficients should be standardized. The default value is F.
- mcreps
An integer determining the number of monte-carlo samples.
- approach
either 'bk' or 'zlc' or both c("bk", "zlc") (default)
- p.threshold
A double giving the p-value for determining whether a path is significant or not
- effect.size
calculate different effect-sizes; one or more of "RIT", "RID"
Examples
if (FALSE) { # \dontrun{
m <- "
OwnLook =~ smv_attr_face + smv_attr_body + smv_sexy
SelfEst =~ ses_satis + ses_qualities + ses_able_todo
MentWell =~ mwb_optimistic + mwb_useful + mwb_energy
smv =~ smv_kind + smv_caring + smv_understanding +
smv_make_laughh + smv_funny + smv_sociable
SelfEst ~ OwnLook + smv + smv:OwnLook
MentWell ~ OwnLook + SelfEst + smv + smv:OwnLook
"
est <- modsem(m, data = mchoice2, method="lms")
# mediated moderation
rmedsem(indep="smv:OwnLook", dep="MentWell", med="SelfEst", mod=est)
# moderated mediation
rmedsem(indep="OwnLook", dep="MentWell", med="SelfEst", mod=est, moderator="smv")
} # }