getPowerFitNonNested: Find power in rejecting non-nested models based on the...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/getPowerFitNonNested.R

Description

Find 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.

Usage

1
2
3
getPowerFitNonNested(dat2Mod1, dat2Mod2, cutoff = NULL, dat1Mod1 = NULL, 
dat1Mod2 = NULL, revDirec = FALSE, usedFit = NULL, alpha = 0.05, nVal = NULL, 
pmMCARval = NULL, pmMARval = NULL, condCutoff = TRUE, df = 0, 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

cutoff

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

dat1Mod1

The SimResult that saves the simulation of analyzing Model 1 by datasets created from Model 1. This argument must be specified with dat1Mod2. The dat1Mod1 cannot be specified if the cutoff is specified.

dat1Mod2

The SimResult that saves the simulation of analyzing Model 2 by datasets created from Model 1. This argument must be specified with dat1Mod1. The dat1Mod2 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.

onetailed

Derive the cutoff by using one-tailed test if specified as TRUE. This argument is applicable only when dat1Mod1 and dat1Mod2 are specified.

Value

List of power given different fit indices.

Author(s)

Sunthud Pornprasertmanit (psunthud@gmail.com)

See Also

Examples

 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
## 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) 

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

# Find the power based on the AIC and BIC of 0 (select model B if Output.B.B has lower AIC or BIC)
getPowerFitNonNested(Output.B.A, Output.B.B, cutoff=c(AIC=0, BIC=0))

## End(Not run)

simsem documentation built on March 29, 2021, 1:07 a.m.