Learn R Programming

simsem (version 0.5-16)

getPowerFitNested: Find power in rejecting nested models based on the differences in fit indices

Description

Find the proportion of the difference in fit indices that indicate worse fit than a specified (or internally derived) cutoffs.

Usage

getPowerFitNested(altNested, altParent, cutoff = NULL, nullNested = NULL, 
nullParent = NULL, revDirec = FALSE, usedFit = NULL, alpha = 0.05, nVal = NULL, 
pmMCARval = NULL, pmMARval = NULL, condCutoff = TRUE, df = 0)

Arguments

altNested

'>SimResult that saves the simulation result of the nested model when the nested model is FALSE.

altParent

'>SimResult that saves the simulation result of the parent model when the nested model is FALSE.

cutoff

A vector of priori cutoffs for fit indices. The cutoff cannot be specified if the nullNested and nullParent are specified.

nullNested

The '>SimResult that saves the simulation result of the nested model when the nested model is TRUE. This argument must be specified with nullParent. The nullNested cannot be specified if the cutoff is specified.

nullParent

The '>SimResult that saves the simulation result of the parent model when the nested model is TRUE. This argument must be specified with nullNested. The nullNested cannot be specified if the cutoff is specified.

revDirec

Reverse the direction of deciding a power by fit indices (e.g., less than --> greater than). The default is to count the proportion of fit indices that indicates lower fit to the model, such as how many RMSEA in the alternative model that is worse than cutoffs. The direction can be reversed by setting as TRUE.

usedFit

The vector of names of fit indices that researchers wish to get powers from. The default is to get powers of all fit indices

alpha

The alpha level used to find the cutoff if the nullObject is specified. This argument is not applicable if the cutoff is specified.

nVal

The sample size value that researchers wish to find the power from. This argument is applicable when altObject has a random sample size.

pmMCARval

The percent missing completely at random value that researchers wish to find the power from. This argument is applicable when altObject has a random percent missing completely at random.

pmMARval

The percent missing at random value that researchers wish to find the power from. This argument is applicable when altObject has a random percent missing at random.

condCutoff

A logical value to use a conditional quantile method (if TRUE) or logistic regression method (if FALSE) to find the power. The conditional quantile method use quantile regression to find the quantile of the cutoff on the alternative sampling distribution that varies nVal, pmMCARval, or pmMARval. The value of 1 - quantile will be reported as the power given the set of nVal, pmMCARval, and pmMARval. The logistic regression method is based on transforming the fit indices value to reject/retain decision first. Then, the logistic regression is used to predict reject/retain decision given the set of nVal, pmMCARval, and pmMARval. The predicted probability is reported as a power. This argument is applicable for specification of cutoff only.

df

The degree of freedom used in spline method in quantile regression (condCutoff = TRUE). If df is 0, which is the default, the spline method will not be applied.

Value

List of power given different fit indices. The TraditionalChi means the proportion of replications that are rejected by the traditional chi-square difference test.

See Also

  • getCutoff to find the cutoffs from null model.

  • '>SimResult to see how to create simResult

Examples

Run this code
# NOT RUN {
# Null model (Nested model) with one factor
loading.null <- matrix(0, 6, 1)
loading.null[1:6, 1] <- NA
LY.NULL <- bind(loading.null, 0.7)
RPS.NULL <- binds(diag(1))
RTE <- binds(diag(6))
CFA.Model.NULL <- model(LY = LY.NULL, RPS = RPS.NULL, RTE = RTE, modelType="CFA")

# Alternative model (Parent model) with two factors
loading.alt <- matrix(0, 6, 2)
loading.alt[1:3, 1] <- NA
loading.alt[4:6, 2] <- NA
LY.ALT <- bind(loading.alt, 0.7)
latent.cor.alt <- matrix(NA, 2, 2)
diag(latent.cor.alt) <- 1
RPS.ALT <- binds(latent.cor.alt, 0.7)
CFA.Model.ALT <- model(LY = LY.ALT, RPS = RPS.ALT, RTE = RTE, modelType="CFA")

# We make the examples running only 10 replications to save time.
# In reality, more replications are needed.
Output.NULL.NULL <- sim(10, n=500, model=CFA.Model.NULL, generate=CFA.Model.NULL) 
Output.ALT.NULL <- sim(10, n=500, model=CFA.Model.NULL, generate=CFA.Model.ALT) 
Output.NULL.ALT <- sim(10, n=500, model=CFA.Model.ALT, generate=CFA.Model.NULL) 
Output.ALT.ALT <- sim(10, n=500, model=CFA.Model.ALT, generate=CFA.Model.ALT) 

# Find the power based on the derived cutoff from the models analyzed on the null datasets
getPowerFitNested(Output.ALT.NULL, Output.ALT.ALT, nullNested=Output.NULL.NULL, 
	nullParent=Output.NULL.ALT)

# Find the power based on the chi-square value at df=1 and the CFI change (intentionally
# use a cutoff from Cheung and Rensvold (2002) in an appropriate situation).
getPowerFitNested(Output.ALT.NULL, Output.ALT.ALT, cutoff=c(Chi=3.84, CFI=-0.10))

# The example of continous varying sample size. Note that more fine-grained 
# values of n is needed, e.g., n=seq(50, 500, 1)
Output.NULL.NULL2 <- sim(NULL, n=seq(50, 500, 50), model=CFA.Model.NULL, generate=CFA.Model.NULL) 
Output.ALT.NULL2 <- sim(NULL, n=seq(50, 500, 50), model=CFA.Model.NULL, generate=CFA.Model.ALT) 
Output.NULL.ALT2 <- sim(NULL, n=seq(50, 500, 50), model=CFA.Model.ALT, generate=CFA.Model.NULL) 
Output.ALT.ALT2 <- sim(NULL, n=seq(50, 500, 50), model=CFA.Model.ALT, generate=CFA.Model.ALT) 

# Get the power based on the derived cutoff from the null model at the sample size of 250
getPowerFitNested(Output.ALT.NULL2, Output.ALT.ALT2, nullNested=Output.NULL.NULL2, 
	nullParent=Output.NULL.ALT2, nVal = 250)

# Get the power based on the rule of thumb from the null model at the sample size of 250
getPowerFitNested(Output.ALT.NULL2, Output.ALT.ALT2, cutoff=c(Chi=3.84, CFI=-0.10), nVal = 250)
# }

Run the code above in your browser using DataLab