lambda.Pop <- matrix(c(.41, .00, .00,
.45, .00, .00,
.53, .00, .00,
.00, .66, .00,
.00, .38, .00,
.00, .66, .00,
.00, .00, .68,
.00, .00, .56,
.00, .00, .55),
nrow = 9, ncol = 3, byrow = TRUE)
NVar <- nrow(lambda.Pop)
NFac <- 3
## Factor correlation matrix
Phi.Pop <- matrix(.50, nrow = 3, ncol = 3)
diag(Phi.Pop) <- 1
#Model-implied correlation matrix
R <- lambda.Pop %*% Phi.Pop %*% t(lambda.Pop)
diag(R) <- 1
#Generate population data to perfectly reproduce pop R
Out <- simFA( Model = list(Model = "oblique"),
Loadings = list(FacPattern = lambda.Pop),
Phi = list(PhiType = "user",
UserPhi = Phi.Pop),
FactorScores = list(FS = TRUE,
CFSeed = 1,
SFSeed = 2,
EFSeed = 3,
Population = TRUE,
NFacScores = 100),
Seed = 1)
PopFactorScores <- Out$Scores$FactorScores
X <- PopObservedScores <- Out$Scores$ObservedScores
fout <- faMain(X = X,
numFactors = 3,
facMethod = "fals",
rotate = "oblimin")
print( round(fout$loadings, 2) )
print( round(fout$Phi,2) )
fload <- fout$loadings
Phi <- fout$Phi
fsOut <- faScores(X = X,
faMainObject = fout,
Method = "Thurstone")
fscores <- fsOut$fscores
print( round(cor(fscores), 2 ))
print(round(Phi,2))
CommonFS <- PopFactorScores[,1:NFac]
SpecificFS <-PopFactorScores[ ,(NFac+1):(NFac+NVar)]
ErrorFS <- PopFactorScores[ , (NFac + NVar + 1):(NFac + 2*NVar) ]
print( cor(fscores, CommonFS) )
Run the code above in your browser using DataLab