Learn R Programming

simsem (version 0.5-16)

plotPowerFitNonNested: Plot power of rejecting a non-nested model based on a difference in fit index

Description

Plot the proportion of the difference in fit indices from one model that does not in the range of sampling distribution from another model (reject that the dataset comes from the second model) or indicates worse fit than a specified cutoff. This plot can show the proportion in the second model that does not in the range of sampling distribution from the first model too.

Usage

plotPowerFitNonNested(dat2Mod1, dat2Mod2, dat1Mod1=NULL, dat1Mod2=NULL, 
cutoff = NULL, usedFit = NULL, alpha = 0.05, contN = TRUE, contMCAR = TRUE, 
contMAR = TRUE, useContour = TRUE, logistic = TRUE, onetailed = FALSE)

Arguments

dat2Mod1

'>SimResult that saves the simulation of analyzing Model 1 by datasets created from Model 2

dat2Mod2

'>SimResult that saves the simulation of analyzing Model 2 by datasets created from Model 2

dat1Mod1

'>SimResult that saves the simulation of analyzing Model 1 by datasets created from Model 1

dat1Mod2

'>SimResult that saves the simulation of analyzing Model 2 by datasets created from Model 1

cutoff

A vector of priori cutoffs for the differences in 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, perspective plot is used.

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 overlaying scatterplot with a line of cutoff is plotted.

onetailed

If TRUE, the function will use the cutoff from one-tail test. If FALSE, the funciton will use the cutoff from two-tailed test.

Value

NONE. Only plot the fit indices distributions.

See Also

  • '>SimResult for simResult that used in this function.

  • getCutoffNonNested to find the cutoffs of the differences in fit indices for non-nested model comparison

  • plotCutoffNonNested to visualize the cutoffs of the differences in fit indices for non-nested model comparison

  • getPowerFitNonNested to find the power in rejecting the non-nested model by the difference in fit indices cutoffs

Examples

Run this code
# NOT RUN {
# Model A: Factor 1 on Items 1-3 and Factor 2 on Items 4-8
loading.A <- matrix(0, 8, 2)
loading.A[1:3, 1] <- NA
loading.A[4:8, 2] <- NA
LY.A <- bind(loading.A, 0.7)
latent.cor <- matrix(NA, 2, 2)
diag(latent.cor) <- 1
RPS <- binds(latent.cor, "runif(1, 0.7, 0.9)")
RTE <- binds(diag(8))
CFA.Model.A <- model(LY = LY.A, RPS = RPS, RTE = RTE, modelType="CFA")

# Model B: Factor 1 on Items 1-4 and Factor 2 on Items 5-8
loading.B <- matrix(0, 8, 2)
loading.B[1:4, 1] <- NA
loading.B[5:8, 2] <- NA
LY.B <- bind(loading.B, 0.7)
CFA.Model.B <- model(LY = LY.B, RPS = RPS, RTE = RTE, modelType="CFA")

# The actual number of replications should be greater than 10.
Output.A.A <- sim(10, n=500, model=CFA.Model.A, generate=CFA.Model.A)
Output.A.B <- sim(10, n=500, model=CFA.Model.B, generate=CFA.Model.A)
Output.B.A <- sim(10, n=500, model=CFA.Model.A, generate=CFA.Model.B)
Output.B.B <- sim(10, n=500, model=CFA.Model.B, generate=CFA.Model.B)

# Plot the power based on the derived cutoff for both models
plotPowerFitNonNested(Output.B.A, Output.B.B, dat1Mod1=Output.A.A, dat1Mod2=Output.A.B)

# Plot the power based on AIC and BIC cutoffs
plotPowerFitNonNested(Output.B.A, Output.B.B, cutoff=c(AIC=0, BIC=0))
# }

Run the code above in your browser using DataLab