Find the proportion of fit indices that indicate worse fit than a specified cutoffs. The cutoffs may be calculated from getCutoff
of the null model.
1 2 3 
altObject 

cutoff 
Fit indices cutoffs from null model or users. This should be a vector with a specified fit indices names as the name of vector elements. The 
nullObject 
The 
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 
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 
nVal 
The sample size value that researchers wish to find the power from. This argument is applicable when 
pmMCARval 
The percent missing completely at random value that researchers wish to find the power from. This argument is applicable when 
pmMARval 
The percent missing at random value that researchers wish to find the power from. This argument is applicable when 
condCutoff 
A logical value to use a conditional quantile method (if 
df 
The degree of freedom used in spline method in quantile regression ( 
List of power given different fit indices. The TraditionalChi
means the proportion of replications that are rejected by the traditional chisquare test.
Sunthud Pornprasertmanit (psunthud@gmail.com)
getCutoff
to find the cutoffs from null model.
SimResult
to see how to create simResult
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46  ## Not run:
# Null 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")
# We make the examples running only 5 replications to save time.
# In reality, more replications are needed.
Output.NULL < sim(5, n=500, model=CFA.Model.NULL)
# Get the fit index cutoff from the null model
Cut.NULL < getCutoff(Output.NULL, 0.05)
# Alternative model with two factor
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, "runif(1, 0.7, 0.9)")
CFA.Model.ALT < model(LY = LY.ALT, RPS = RPS.ALT, RTE = RTE, modelType="CFA")
# We make the examples running only 5 replications to save time.
# In reality, more replications are needed.
Output.ALT < sim(5, n=500, model=CFA.Model.NULL, generate=CFA.Model.ALT)
# Get the power based on the derived cutoff
getPowerFit(Output.ALT, cutoff=Cut.NULL)
# Get the power based on the rule of thumb proposed by Hu & Bentler (1999)
Rule.of.thumb < c(RMSEA=0.05, CFI=0.95, TLI=0.95, SRMR=0.06)
getPowerFit(Output.ALT, cutoff=Rule.of.thumb, usedFit=c("RMSEA", "CFI", "TLI", "SRMR"))
# The example of continous varying sample size. Note that more finegrained
# values of n is needed, e.g., n=seq(50, 500, 1)
Output.NULL2 < sim(NULL, n=seq(50, 500, 50), model=CFA.Model.NULL, generate=CFA.Model.NULL)
Output.ALT2 < sim(NULL, n=seq(50, 500, 50), model=CFA.Model.NULL, generate=CFA.Model.ALT)
# Get the power based on the derived cutoff from the null model at the sample size of 250
getPowerFit(Output.ALT2, nullObject=Output.NULL2, nVal=250)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.