You can install the development version of bifacLpRot from GitHub with:
# install.packages("devtools")
devtools::install_github("ccardehu/bifacLpRot")This is a basic example:
set.seed(1234)
A <- matrix(0, 20, 4) # A 20 x 4 Factor loading matrix
A[,1] = runif(20, 1, 2) # Bi-factor structure, strong first-order factors
A[,2] = runif(20, 0.5, 1) * rbinom(20, 1, 0.25) # Sparse second-order factors
A[,3] = runif(20, 0.5, 1) * rbinom(20, 1, 0.25)
A[,4] = runif(20, 0.5, 1) * rbinom(20, 1, 0.25)
# Create rotation matrix (via random matrix):
Ah = array(rnorm(length(A), sd = .1), dim = dim(A))
Tr = eigen(t(Ah) %*% Ah)$vectors
Ah = (A)%*%(Tr)
res = bifacLpRot::bifactorLp(Ah)
Arot = res$B
Phi = res$Phi