Package 'equaltestMI'

Title: Examine Measurement Invariance via Equivalence Testing and Projection Method
Description: Functions for examining measurement invariance via equivalence testing are included in this package. The traditionally used RMSEA (Root Mean Square Error of Approximation) cutoff values are adjusted based on simulation results. In addition, a projection-based method is implemented to test the equality of latent factor means across groups without assuming the equality of intercepts. For more information, see Yuan, K. H., & Chan, W. (2016) <doi:10.1037/met0000080>, Deng, L., & Yuan, K. H. (2016) <doi:10.1007/s11336-015-9491-8>, and Jiang, G., Mai, Y., & Yuan, K. H. (2017) <doi:10.3389/fpsyg.2017.01823>.
Authors: Ge Jiang [aut, cre], Yujiao Mai [aut], Ke-Hai Yuan [ctb]
Maintainer: Ge Jiang <[email protected]>
License: GPL-3
Version: 0.6.1
Built: 2024-09-15 04:31:02 UTC
Source: https://github.com/gabriellajg/equaltestmi

Help Index


Bootstrap procedure to test the equality of latent factor means using projection method

Description

Bootstrap procedure to test the equality of latent factor means using projection method

Usage

eqMI.bootstrap(..., B = 100, seed = 111)

Arguments

...

The same arguments as for any lavaan model. See lavaan::sem for more information.

B

The number of bootstrap samples. Default at 100.

seed

The initial seed to generate bootstrap samples. Default at 111.

bootstrap

If bootstrap resampling is used to obtain empirical p-value of the statistics.

Details

Perform bootstrap procedure when testing the equality of latent means using projection method. Note that raw data must be available for bootstrap resampling to be performed. With the projection method, the cross-group intercepts are not required to be the same for further tests. If bootstrap resampling is used, the test statistics are not referred to chi-squared distributions but to bootstrapped empirical distributions for significance testing. Percentage bootstrap critical values are calculated. This process might be time-consuming if the model is complex or the number of bootstrap samples (B) is large.

Value

bootstrap p-values of the tests of common and specific factors.

References

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426.

Examples

data(HolzingerSwineford)
semmodel<-'
L1 =~ V1 + V2 + V3
L2 =~ V4 + V5 + V6
L3 =~ V7 + V8
L4 =~ V9 + V10 + V11
'

run.bts <- eqMI.bootstrap(model = semmodel, data = HolzingerSwineford,
          group = "school", meanstructure = TRUE, B = 100, seed = 111)

Test the equality of two covariance matrices in population

Description

The first step of testing measurement invariance (MI) in multiple-group SEM analysis. The null hypothesis is tested using the method of Lagrange multipliers

Usage

eqMI.covtest(..., lamb0 = NULL)

Arguments

...

The same arguments as for any lavaan model. See lavaan::sem for more information.

lamb0

initial coefficients of Lagrange multiplier. If not pre-specified, 0.01 will be used.

Details

The eqMI.covtest function is the first step to test MI. Under null hypothesis testing (NHT), a non-significant statistic is generally an overall endorsement of MI. If the null hypothesis is rejected then one may proceed to test other aspects of MI.

Value

The likelihood ratio statistic, degrees of freedom, and p-value of the test.

References

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426.

Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL http://www.jstatsoft.org/v48/i02/.

Examples

data(HolzingerSwineford)
semmodel<-'
L1 =~ V1 + V2 + V3
L2 =~ V4 + V5 + V6
L3 =~ V7 + V8
L4 =~ V9 + V10 + V11
'
cov.test <- eqMI.covtest(model = semmodel,
                         data = HolzingerSwineford,
                         group="school")

The main function to test measurement invariance

Description

Test measurement invariance with equivalence testing, projection methods, and adjusted RMSEA cutoffs for two groups.

Usage

eqMI.main(
  ...,
  output = "both",
  equivalence.test = TRUE,
  adjRMSEA = TRUE,
  projection = FALSE,
  bootstrap = FALSE,
  quiet = TRUE,
  B = 100,
  seed = 111
)

Arguments

...

The same arguments as for any lavaan model. See lavaan::sem for more information.

Users must explicitly specify the name of the input elements for this function to catch. For example, specify 'data = HolzingerSwineford' instead just 'HolzingerSwineford'.

output

If the function prints out results of covariance structure, mean structure, or both. The value of output must be mean, covariance, or both. When the tests involve mean structure (output = 'mean' or 'both'), both the strong and the strict tests of measurement invariance will be conducted.

equivalence.test

If equivalence.test=TRUE, equivalence testing is used for examining all statistics. RMSEA together with conventional or adjusted cutoff values will be used to gauge the goodness of fit.

adjRMSEA

If adjRMSEA=TRUE, adjusted RMSEA cutoff values are used for equivalence testing. See details in Yuan & Chan (2016).

projection

If projection=TRUE, projection method is used to test the equality of latent factor means. The advantage of the projection method over conventional multiple-group SEM approach is that the test of latent factor means can be conducted even when the equality of intercepts do not hold.

bootstrap

If bootstrap=TRUE, bootstrap is used to obtain empirical p-values for testing the equality of cross-group latent factor means.

quiet

If quiet=FALSE, a summary is printed out containing an overview of the different models that are fitted, together with some model comparison tests and fit measures. The results of equivalence testing will also be printed if equivalence testing is used. If quiet=TRUE (default), no summary is printed but results will be stored in 'AnnotatedOutput'.

B

The number of boostrap samples used in bootstrap approach.

seed

The initial seed to generate bootstrap samples. Default at 111.

Details

An all-in-one function with several added options to conduct a sequence of tests needed to evaluate MI. The chi-square statistics, except the one for testing the equality of covariance structure, are obtained based on lavaan::sem function. The test statistic of the covariance structure equality is obtained via the method of Lagrangian multiplier. Equivalence testing is enabled by setting equivalence.test=TRUE and this function will calculate T-size, RMSEA, and adjusted RMSEA cutoff values, and provide the goodness-of-fit.

Value

A list is returned with:

AnnotatedOutput

Annotated outout that will be printed to the console if quiet==FALSE.

eqMI.stat

Test statistics, degrees of freedom, p-values, ncp, T-sizes, RMSEAs, their cutoff values, and the goodness-of-fit under equivalence testing. A formated version of eqMI.stat will be printed if quiet=FALSE.

convention.sem

Results of conventional multiple-group SEM using Lavaan. Returned object of eqMI.semtest.

projection.res

Results of projection methods on tests of latent means. Returned object of eqMI.projection and eqMI.bootstrap.

References

Deng, L., & Yuan, K. H. (2016). Comparing Latent Means Without Mean Structure Models: A Projection-Based Approach. Psychometrika, 81(3), 802-829. https://doi.org/10.1007/s11336-015-9491-8

Jiang, G., Mai, Y., & Yuan, K. H. (2017). Advances in Measurement Invariance and Mean Comparison of Latent Variables: Equivalence Testing and A Projection-Based Approach. Frontiers in Psychology, 8, 1823.

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426. https://doi.org/10.1037/met0000080

Examples

data(HolzingerSwineford)
semmodel<-'
L1 =~ V1 + V2 + V3
L2 =~ V4 + V5 + V6
L3 =~ V7 + V8
L4 =~ V9 + V10 + V11
'
# If raw data are available;

test <- eqMI.main(model = semmodel, data = HolzingerSwineford,
        group = "school", meanstructure = TRUE,
        output = 'both', quiet = FALSE,
        equivalence.test = TRUE, adjRMSEA = TRUE,
        projection = TRUE, bootstrap = FALSE)

# when only sample statistics are available;
# sample.cov need to be provided for tests of covariance structure;
# sample.mean need to be provided for tests of mean structure;

school1 <- subset(HolzingerSwineford, school==1)[,-12]
school2 <- subset(HolzingerSwineford, school==2)[,-12]
test <- eqMI.main(model = semmodel,
        sample.nobs = c(nrow(school1), nrow(school2)),
        sample.cov = list(cov(school1), cov(school2)),
        sample.mean = list(colMeans(school1), colMeans(school2)),
        meanstructure = TRUE, output = 'both', quiet = FALSE,
        equivalence.test = TRUE, adjRMSEA = TRUE,
        projection = TRUE, bootstrap = FALSE)

Obtain noncentrality parameter of a chisquare distribution

Description

Calculate the noncentrality parameter as well as the model missipecification epsilon_t given its lower-tail critical value.

Usage

eqMI.ncp(T, df, N, m, alpha = 0.05)

Arguments

T

A chi-square statistic

df

Degrees of freedom

N

Total sample size of all groups

m

Number of groups

alpha

Significance level. Default at 0.05.

Details

This function is to compute the noncentrality parameter ncp, the model missipecification epsilon_t, and its corresponding RMSEA_t. With equivalence testing, the model missipecification is also the minimum tolerable size that a researcher needs to tolerate if one wishes to proceed with further restricted tests. The formula from Venables (1975) is used for obtaining the noncentrality parameter of a non-central chi-square distribution given its lower-tail critical value.

Value

The noncentrality parameter ncp, the minimum tolerable size epsilon_t, and RMSEA_t under equivalence testing.

References

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426.

Examples

alpha <- .05
n_1 <- 200
n_2 <- 200
N <- n_1 + n_2
m <- 2
# A made-up likelihood-ratio statistic
T_ml <- 8.824
df <- 6
ncp <- eqMI.ncp(T = T_ml, df = df, N = N, m = m, alpha = alpha)

Projection-based method for testing latent means equality

Description

Perform projection method for testing the equality of latent means without requiring the equality of cross-group intercepts to hold.

Usage

eqMI.projection(...)

Arguments

...

The same arguments as for any lavaan model. See lavaan::sem for more information. All models fitted by Lavaan are estimated by fixing the variances of latent factors to 1.

Users must explicitly specify the name of the input elements for this function to catch. For example, specify 'data = HolzingerSwineford' instead just 'HolzingerSwineford'.

Details

Perform projection method for testing the equality of two latent means without requiring the cross-group intercepts to be the same. A validity index is provided as the proportion of the differences in manifest variables intercepts explained by latent mean differences as a gauge of the quality of measurements.

Value

A list is returned with:

fit.metric

test of metric invariance (factor loadings). This is a prerequisite for testing equality of latent means.

mvdif.test

t tests of the cross-group sample means for each variable.

chi.stat

Three chi-square tests for intercepts, common factors, and specific factors. chi.stat will be needed for equivalence testing.

common.test

t tests of common factors for each variable.

specific.test

t tests of specific factors for each variable.

latent.test

t tests of latent means

V.index

validity index

Pmat

projection matrix of intercepts into the space of common factors

Qmat

projection matrix of intercepts into the space of specific factors

References

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426.

Examples

data(HolzingerSwineford)
semmodel<-'
L1 =~ V1 + V2 + V3
L2 =~ V4 + V5 + V6
L3 =~ V7 + V8
L4 =~ V9 + V10 + V11
'
run.proj <- eqMI.projection(model = semmodel, data = HolzingerSwineford,
          group = "school", meanstructure = TRUE)

Obtain the RMSEA cutoff values for equivalence testing

Description

Generate adjusted cutoff values of RMSEA for equivalence testing corresponding to conventional cutoff values .01, .05, .08, and .10.

Usage

eqMI.RMSEA(N, m, df)

Arguments

N

Total sample size of all groups

m

Number of groups

df

Degree of freedom

Details

The adjusted cutoff values of RMSEA for equivalence testing can be obtained with N, m, df and transformed variables. Formulas are estimated using simulation studies and the coefficients are given in Table 11 of the reference.

Value

The adjusted cutoff values corresponding to conventional cutoff values .01, .05, .08, and .10.

References

Steiger, J. H. (1980). Statistically based tests for the number of common factors. In the annual meeting of the Psychometric Society. Iowa City, IA.

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426.

Examples

alpha <- .05;
N <- 200;
m <- 1;
T_ml <- 28.446; #the statistic T_ml for group 1;
df <- 24;
eqMI.RMSEA(N = N, m = m, df = df);

Measurement invariance tests using lavaan

Description

Conventional multiple-group SEM to test measurement invariance. A sequence of chi-squared and chi-squared difference tests will be conducted.

Usage

eqMI.semtest(..., output = "both", quiet = FALSE)

Arguments

...

The same arguments as for any lavaan model. See lavaan::cfa and lavaan::lavOptions for more information about the arguments.

Users must explicitly specify the name of the input elements for this function to catch. For example, specify 'eqMI.semtest(model = semmodel, data = HolzingerSwineford)' instead just 'eqMI.semtest(semmodel, HolzingerSwineford)'.

output

If the function prints out results of covariance structure, mean structure, or both. The value of output must be mean, covariance, or both. When the tests involve mean structure (output = 'mean' or 'both'), both the strong and the strict tests of measurement invariance will be conducted.

quiet

If quiet=FALSE (default), a summary is printed out containing an overview of the different models that are fitted, together with some model comparison tests. If quiet=TRUE, no summary is printed but results will be stored in the object.

Details

This is a wrapper around the (now deprecated) measurementInvariance in package semTools, with the following default options: std.lv = FALSE, fit.measures = "default", and method = "satorra.bentler.2001". See semTools for more information. This function is now updated to semTools::measEq.syntax.

Value

A list is returned with:

LavaanOut

A sublist in convention.sem. Contains lavann style output and results for each chi-squared and chi-squared difference.

Mean.part

A sublist in convention.sem. Contains test statistics and fit measures on invariance tests of mean structure.

Cov.part

A sublist in convention.sem. Contains test statistics and fit measures on invariance tests of covariacne structure.

Author(s)

The maintainer, Ge Jiang, adapted the original source code of measurementInvariance() in the lavaan and semTools packages written by Yves Rosseel, Sunthud Pornprasertmanit, and Terrence D. Jorgensen (permission obtained).

References

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426.

Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36.

semTools Contributors. (2016). semTools: Useful tools for structural equation modeling. R package version 0.4-14. Retrieved from https://CRAN.R-project.org/package=semTools

See Also

sem, measurementInvariance

Examples

data(HolzingerSwineford)
semmodel<-'
L1 =~ V1 + V2 + V3
L2 =~ V4 + V5 + V6
L3 =~ V7 + V8
L4 =~ V9 + V10 + V11
'

run.sem <- eqMI.semtest(model = semmodel, data = HolzingerSwineford,
           group = "school", meanstructure = TRUE)

Holzinger and Swineford (1939) cognitive tests data in 301 children from two schools

Description

This classic data set contains reported data on cognitive tests from two elementary schools.

Usage

data(HolzingerSwineford)

Format

A data frame with 301 observations on 11 numeric variables and a group indicator (12 variables in total).

Details

11 variables used in Deng and Yuan (2016) are included in this version of data, they are: visual perception, cubes, paper form board, paragraph comprehension, word classification, word meaning, counting dots, straight-curved capitals, deduction, problem reasoning, and series completion.

This data set with more variables are available in other R packages such as lavaan, and OpenMX.

References

Deng, L., & Yuan, K. H. (2016). Comparing Latent Means Without Mean Structure Models: A Projection-Based Approach. Psychometrika, 81(3), 802-829.

Yuan, K. H., & Chan, W. (2016). Measurement invariance via multigroup SEM: Issues and solutions with chi-square-difference tests. Psychological methods, 21(3), 405-426.

See Also

HolzingerSwineford1939, HS.ability.data

Examples

data(HolzingerSwineford)

Lee and Al Otaiba (2015) early literacy skills in four socioeconomic groups

Description

This data set contains means and covariance matrices of early literacy skills measured in four different sociodemographic groups. The results are reported in Table 1 of Lee and Al Otaiba (2015).

Usage

data(LeeAlOtaiba)

Format

A list of four data frames. Every data frame is of dimension 7 by 6. The first row contains sample means of the six variables. The next six rows contain sample covariance matrix. The colomn names of the data frame are the names of the six variables. The row names of the data frame contain a label 'mean' and the names of the six variables.

Details

Six variables used in Lee and Al Otaiba (2015) to measure literacy constructs, including (1) letter-name fluency, (2) letter-sound fluency, (3) blending, (4) elision, (5) real words spelling, and (6) pseudo-words spelling.

Following from Snow’s (2006) definition of componential skills and the work of Schatschneider, Fletcher, Francis, Carlson, and Foorman (2004) on National Early Literacy Panel (NELP), the six variables aim to measure three aspects of literacy constructs: (1) alphabet knowledge, (2) phonological awareness, and (3) spelling.

The four sociodemographic groups are: (1) boys who are ineligible for FRL (n=78); (2) boys who are eligible for FRL (n=65); (3) girls who are ineligible for FRL (n=175); and (4) girls who are eligible for FRL (n=165).

References

Lee, J. A. C., & Al Otaiba, S. (2015). Socioeconomic and gender group differences in early literacy skills: A multiple-group confirmatory factor analysis approach. Educational Research and Evaluation, 21(1), 40–59. https://doi.org/10.1080/13803611.2015.1010545

Examples

data(LeeAlOtaiba)
# If one wants to extract the two groups used in the paper:
Group1 <- LeeAlOtaiba[[1]]
Group2 <- LeeAlOtaiba[[2]]