Learn R Programming

simsem (version 0.2-8)

plotPowerFit: Plot sampling distributions of fit indices that visualize power of rejecting datasets underlying misspecified models

Description

This function will plot sampling distributions of fit indices that visualize power in rejecting the misspecified models

Usage

plotPowerFit(altObject, nullObject = NULL, cutoff = NULL, usedFit = NULL, 
alpha = 0.05, contN = TRUE, contMCAR = TRUE, contMAR = TRUE, 
useContour = TRUE, logistic = TRUE)

Arguments

altObject
The result object (SimResult) saves the simulation result of fitting the hypothesized model when the hypothesized model is FALSE.
nullObject
The result object (SimResult) saves the simulation result of fitting the hypothesized model when the hypothesized model is TRUE. This argument may be not specified if the cutoff is specifie
cutoff
A vector of priori cutoffs for fit indices.
usedFit
Vector of names of fit indices that researchers wish to plot.
alpha
A priori alpha level
contN
Include the varying sample size in the power plot if available
contMCAR
Include the varying MCAR (missing completely at random percentage) in the power plot if available
contMAR
Include the varying MAR (missing at random percentage) in the power plot if available
useContour
If there are two of sample size, percent completely at random, and percent missing at random are varying, the plotCutoff function will provide 3D graph. Contour graph is a default. However, if this is specified as FALSE, perspect
logistic
If logistic is TRUE and the varying parameter exists (e.g., sample size or percent missing), the plot based on logistic regression predicting the significance by the varying parameters is preferred. If FALSE, the ove

Value

  • NONE. Only plot the fit indices distributions.

See Also

  • SimResultfor simResult that used in this function.
  • getCutoffto find values of cutoffs based on null hypothesis sampling distributions only
  • getPowerFitto find power of rejecting the hypothesized model when the hypothesized model isFALSE.

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)

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, 0.5)
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)
plotPowerFit(Output.ALT, nullObject=Output.NULL, alpha=0.05, usedFit=c("RMSEA", "CFI", "TLI", "SRMR"))
Rule.of.thumb <- c(RMSEA=0.05, CFI=0.95, TLI=0.95, SRMR=0.06)
plotPowerFit(Output.ALT, cutoff=Rule.of.thumb, alpha=0.05, usedFit=c("RMSEA", "CFI", "TLI", "SRMR"))

Output.NULL2 <- simResult(NULL, SimData.NULL, SimModel, n=seq(50, 250, 25))
Output.ALT2 <- simResult(NULL, SimData.ALT, SimModel, n=seq(50, 250, 25))

plotPowerFit(Output.ALT2, nullObject=Output.NULL2, alpha=0.05, usedFit=c("RMSEA", "CFI", "TLI", "SRMR"))
plotPowerFit(Output.ALT2, cutoff=Rule.of.thumb, alpha=0.05, usedFit=c("RMSEA", "CFI", "TLI", "SRMR"))

Run the code above in your browser using DataLab