Learn R Programming

simsem (version 0.2-0)

plotPower: Plot sampling distributions of fit indices that visualize power

Description

This function will plot sampling distributions of fit indices that visualize power in either a histogram or overlapping histograms.

Usage

plotPower(altObject, nullObject, ...)

Arguments

altObject
The object (SimResult or data.frame) that saves fit indices for alternative hypothesis
nullObject
The object that represents null hypothesis. It can be vector of cutoffs (that might be calculated from getCutoff or an object that save raw data of fit indices for null hypothesis (<
...
Other arguments specific to different types of object you pass in the function.

Value

  • NONE. Only plot the fit indices distributions.

Details in ...

  • alpha: A priori alpha level to getCutoffs of fit indices (do not specify when you havecutoff)
  • usedFit: The name of fit indices that researchers wish to plot

See Also

  • SimResultfor simResult that used in this function.
  • getCutoffto find values of cutoffs based on null hypothesis sampling distributions only

Examples

Run this code
loading.null <- matrix(0, 6, 1)
loading.null[1:6, 1] <- NA
LX.NULL <- simMatrix(loading.null, 0.7)
RPH.NULL <- symMatrix(diag(1))
RTD <- symMatrix(diag(6))
CFA.Model.NULL <- simSetCFA(LY = LX.NULL, RPS = RPH.NULL, RTE = RTD)
SimData.NULL <- simData(CFA.Model.NULL, 500)
SimModel <- simModel(CFA.Model.NULL)
# We make the examples running only 5 replications to save time.
# In reality, more replications are needed.
Output.NULL <- simResult(5, SimData.NULL, SimModel)
Cut.NULL <- getCutoff(Output.NULL, 0.95)

u79 <- simUnif(0.7, 0.9)
loading.alt <- matrix(0, 6, 2)
loading.alt[1:3, 1] <- NA
loading.alt[4:6, 2] <- NA
LX.ALT <- simMatrix(loading.alt, 0.7)
latent.cor.alt <- matrix(NA, 2, 2)
diag(latent.cor.alt) <- 1
RPH.ALT <- symMatrix(latent.cor.alt, "u79")
CFA.Model.ALT <- simSetCFA(LY = LX.ALT, RPS = RPH.ALT, RTE = RTD)
SimData.ALT <- simData(CFA.Model.ALT, 500)
Output.ALT <- simResult(5, SimData.ALT, SimModel)
getPower(Output.ALT, Cut.NULL)
Rule.of.thumb <- c(RMSEA=0.05, CFI=0.95, TLI=0.95, SRMR=0.06)
plotPower(Output.ALT, Output.NULL, alpha=0.05, usedFit=c("RMSEA", "CFI", "TLI", "SRMR"))

Run the code above in your browser using DataLab