Learn R Programming

simsem (version 0.2-8)

plotCutoffNested: Plot sampling distributions of the differences in fit indices between nested models with fit indices cutoffs

Description

This function will plot sampling distributions of the differences in fit indices between nested models if the nested model is true. The users may add cutoffs by specifying the alpha level.

Usage

plotCutoffNested(nested, parent, alpha = 0.05, cutoff = NULL, 
usedFit = NULL, useContour = T)

Arguments

nested
SimResult that saves the analysis results of nested model from multiple replications
parent
SimResult that saves the analysis results of parent model from multiple replications
alpha
A priori alpha level
cutoff
A priori cutoffs for fit indices, saved in a vector
usedFit
Vector of names of fit indices that researchers wish to plot the sampling distribution.
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

Value

  • NONE. Only plot the fit indices distributions.

See Also

  • SimResultfor simResult that used in this function.
  • getCutoffNestedto find the difference in fit indices cutoffs

Examples

Run this code
n1 <- simNorm(0, 0.1)
u79 <- simUnif(0.7, 0.9)

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)

error.cor.mis <- matrix(NA, 6, 6)
diag(error.cor.mis) <- 1
RTD.Mis <- symMatrix(error.cor.mis, "n1")
CFA.Model.NULL.Mis <- simMisspecCFA(RTE = RTD.Mis)

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.NULL <- simData(CFA.Model.NULL, 500)

SimModel.NULL <- simModel(CFA.Model.NULL)
SimModel.ALT <- simModel(CFA.Model.ALT)

# The actual number of replications should be greater than 10.
Output.NULL.NULL <- simResult(10, SimData.NULL, SimModel.NULL)
Output.NULL.ALT <- simResult(10, SimData.NULL, SimModel.ALT)

plotCutoffNested(Output.NULL.NULL, Output.NULL.ALT, alpha=0.05)

Run the code above in your browser using DataLab