Description

Uses the relabeling method of Erosheva and Curtis to correct for sign invariance in MCMC draws from confirmatory factor analysis (CFA) models.

Usage

 1 2 3 4 5 6 7 relabel(obj, ...) ## Default S3 method: relabel(obj, ...) ## S3 method for class 'matrix' relabel(obj, random = FALSE, max.iter = 100, ...)

Arguments

 ... Not used.

Details

See the references.

Value

An S3 object of class relabel with the following components:

 Lam original (untransformed) draws of the loadings. nuLam transformed draws of the loadings. nu.init initial values for the sign-change parameters. nu final values of the sign change parameters used to compute nuLam. m final values of the mean parameters in the loss function. s final values of the standard deviation parameters in the loss function. factor.idx vector of integers indicating which columns of the posterior draws belong to which factor. iter number of iterations the algorithm took to converge. loss final value of the loss function after convergence. converged logical indicating whether the algorithm converged.

Author(s)

S. McKay Curtis and Elena Erosheva

References

Erosheva, E. A. and Curtis, S. M. (2011) "A relabeling scheme for confirmatory factor analysis." Technical report #589. University of Washington, Dept. of Statistics.

Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 n <- 1000 p <- 8 set.seed(1) mu <- as.numeric(t(cbind( matrix(rep(sample(c(-1, 1), size=n, replace=TRUE)*4, each=8), n, 8, byrow=TRUE), matrix(rep(sample(c(-1, 1), size=n, replace=TRUE)*4, each=8), n, 4, byrow=TRUE), matrix(rep(sample(c(-1, 1), size=n, replace=TRUE)*4, each=8), n, 4, byrow=TRUE)))) Lam <- matrix(rnorm(length(mu), mu, 1.0), n, 16, byrow=TRUE) colnames(Lam) <- c(paste0("Lam[", 1:p, ",", 1, "]"), paste0("Lam[", 1:4, ",", 2, "]"), paste0("Lam[", 5:8, ",", 3, "]")) par(mfrow=c(2, 8)) apply(Lam, 2, function(x) plot(density(x))) ## Relabeling removes the bimodality out <- relabel(Lam) par(mfrow=c(2, 8)) apply(out\$nuLam, 2, function(x) plot(density(x)))