Learn R Programming

metaSEM (version 1.4.0)

calEffSizes: Calculate Effect Sizes using lavaan Models

Description

It calculates effect sizes with Delta Method by formulating the effect sizes as functions of SEM in lavaan.

Usage

calEffSizes(model, data=NULL, n, Cov, Mean=NULL, group=NULL, lavaan.output=FALSE, ...)

Value

Effect sizes and their sampling covariance matrix or a lavaan fitted object.

Arguments

model

A lavaan model. Effect sizes are defined as functions of SEM parameters with :=.

data

A data frame of the observed variables. If it is NULL, summary statistics are required.

n

Sample sizes

Cov

A covariance matrix or a list of covariance matrices.

Mean

Optional sample means.

group

A character of the variable name in the data frame defining the groups in a multiple group analysis.

lavaan.output

If TRUE, it returns the fitted object instead of the effect sizes and their sampling covariance matrix.

...

Further arguments passed to sem.

Author

Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>

References

Cheung, M. W.-L. (2015). Meta-analysis: A structural equation modeling approach. Chichester, West Sussex: John Wiley & Sons, Inc.

Cheung, M. W.-L. (2018). Computing multivariate effect sizes and their sampling covariance matrices with structural equation modeling: Theory, examples, and computer simulations. Frontiers in Psychology, 9(1387). https://doi.org/10.3389/fpsyg.2018.01387

See Also

smdMES, smdMTS

Examples

Run this code
# \donttest{ 
## Select ATT, Bi, and BEH 
obs.vars <- c("BEH", "BI", "ATT")

## Select one study from Cooke16 for illustration
my.cor <- Cooke16$data[[4]][obs.vars, obs.vars]
my.n  <- Cooke16$n[4]

## Effect sizes: indirect effect and direct effect
model <- "BEH ~ c*ATT + b*BI
          BI ~ a*ATT
          ## Indirect effect
          Ind := a*b
          Dir := c"

calEffSizes(model=model, n=my.n, Cov=my.cor, lavaan.output=FALSE)

## Return the lavaan fitted model
fit <- calEffSizes(model=model, n=my.n, Cov=my.cor, lavaan.output=TRUE)
lavaan::summary(fit)
    
lavaan::parameterestimates(fit)  
# }

Run the code above in your browser using DataLab