Description Usage Arguments Details Value Author(s) References Examples

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

1 2 3 4 5 6 7 |

`obj` |
An object of the appropriate class. Currently, the method is
implemented only for objects of S3 class |

`random` |
Logical value. If |

`max.iter` |
Integer that specifies the maximum number of iterations of the algorithm before aborting procedure. |

`...` |
Not used. |

See the references.

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 |

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

S. McKay Curtis and Elena Erosheva

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

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.