Learn R Programming

⚠️There's a newer version (2.1.1) of this package.Take me there.

semPower

semPower is an R-package that provides several functions to perform a-priori, post-hoc, and compromise power analyses for structural equation models (SEM).

Installation

Install semPower via CRAN or as follows:

install.packages("devtools")
library("devtools")
install_github("moshagen/semPower")

Basic functionality is also provided as a shiny app, which you can use online at https://sempower.shinyapps.io/sempower.

Manual

Read the manual by typing

vignette("semPower")

or view the manual online.

Quick Examples

Determine the required sample size to detect misspecifications of a model (involving df = 100 degrees of freedom) corresponding to RMSEA = .05 with a power of 80% on an alpha error of .05:

ap <- semPower.aPriori(effect = .05, effect.measure = 'RMSEA', alpha = .05, power = .80, df = 100)
summary(ap)

Determine the achieved power with a sample size of N = 1000 to detect misspecifications of a model (involving df = 100 degrees of freedom) corresponding to RMSEA = .05 on an alpha error of .05:

ph <- semPower.postHoc(effect = .05, effect.measure = 'RMSEA', alpha = .05, N = 1000, df = 100)
summary(ph)

Determine the critical chi-square such that the associated alpha and beta errors are equal, assuming sample size of N = 1000, a model involving df = 100 degrees of freedom, and misspecifications corresponding to RMSEA = .05:

cp <- semPower.compromise(effect = .05, effect.measure = 'RMSEA', abratio = 1, N = 1000, df = 100)
summary(cp)

Plot power as function of the sample size to detect misspecifications corresponding to RMSEA = .05 (assuming df = 100) on alpha = .05:

semPower.powerPlot.byN(effect = .05, effect.measure = 'RMSEA', alpha = .05, df = 100, power.min = .05, power.max = .99)

Plot power as function of the magnitude of effect (measured through the RMSEA assuming df = 100) at N = 500 on alpha = .05:

semPower.powerPlot.byEffect(effect.measure = 'RMSEA', alpha = .05, N = 500, df = 100, effect.min = .001, effect.max = .10)

For more details and for a description how to express the magnitude of effect in terms of model parameters, see the manual.

Citation

If you use semPower in publications, please cite the package as follows:

Moshagen, M., & Erdfelder, E. (2016). A new strategy for testing structural equation models.Structural Equation Modeling, 23, 54-60. doi: 10.1080/10705511.2014.950896

Copy Link

Version

Install

install.packages('semPower')

Monthly Downloads

865

Version

1.1.0

License

LGPL

Maintainer

Morten Moshagen

Last Published

August 24th, 2020

Functions in semPower (1.1.0)

getF.Mc

getF.Mc
semPower

semPower: Power analyses for structural equation models (SEM).
getF.RMSEA

getF.RMSEA
semPower.aPriori

semPower.aPriori
semPower.showPlot

semPower.showPlot
getNCP

getNCP
getRMSEA.F

getRMSEA.F
getChiSquare.F

getChiSquare.F
summary.semPower.aPriori

summary.semPower.aPriori
getFormattedResults

getFormattedResults
getGFI.F

getGFI.F
getSRMR.Sigma

getSRMR.Sigma
getSRMR.Sigma.mgroups

getSRMR.Sigma.mgroups
getF

getF calculates minimum of the ML-fit-function from known fit indices
getIndices.F

getIndices.F
getMc.F

getMc.F
getF.Sigma

getF.Sigma
semPower.powerPlot.byEffect

sempower.powerPlot.byEffect
semPower.compromise

sempower.compromise
validateInput

validateInput
semPower.postHoc

semPower.postHoc
semPower.powerPlot.byN

sempower.powerPlot.byN
getF.AGFI

getF.AGFI
getF.GFI

getF.GFI
summary.semPower.compromise

summary.sempower.compromise
summary.semPower.postHoc

semPower.postHoc.summary
checkPositive

checkPositive
getChiSquare.NCP

getChiSquare.NCP
getErrorDiff

getErrorDiff
checkBounded

checkBounded
checkPositiveDefinite

checkPositiveDefinite
getCFI.Sigma.mgroups

getCFI.Sigma.mgroups
getAGFI.F

getAGFI.F
getBetadiff

getBetadiff
getCFI.Sigma

getCFI.Sigma