# ---- Example 1: ----
# To run the example in Waller (2021) enter:
out1 <- fsIndeterminacy(Example = TRUE)
# ---- Example 1: Extended Version: ----
N <- 10 # number of observations
# Generate Lambda: common factor loadings
# Phi: Common factor correlation matrix
Lambda <- matrix(c(.8, 0,
.7, 0,
.6, 0,
0, .5,
0, .4,
0, .3), 6, 2, byrow=TRUE)
out1 <- fsIndeterminacy(Lambda,
Phi = NULL, # orthogonal model
SeedX = 1, # Seed for X
SeedBasis = 2, # Seed for Basis
SeedW = 3, # Seed for Weight matrix
SeedT = 5, # Seed for Transformation matrix
N = 10, # Number of subjects
Print = "long",
Digits = 3)
# Four sets of factor scores
Fi <- out1$Fi
Fj <- out1$Fj
Fk <- out1$Fk
Fl <- out1$Fl
# Estimated Factor scores
Fhat <- out1$Fhat
# B wipes out Fhat (in an orthogonal model)
B <- out1$B
round( cbind(Fhat[1:5,1:2], (Fhat %*% B)[1:5,1:2]), 3)
# B takes Ei -> Ek
Ei <- out1$Ei
Ek <- out1$Ek
Ek - (Ei %*% B)
# The Transformation Approach
# Bstar takes Fi --> Fk
Bstar <- out1$Bstar
round( Fk - Fi %*% Bstar, 3)
# Bstar L' = L'
L <- out1$L
round( L %*% t(Bstar), 3)[,1:2]
# ---- Example 3 ----
# We choose a different seed for T
out2 <- fsIndeterminacy(Lambda ,
Phi = NULL,
X = NULL,
SeedX = 1, # Seed for X
SeedBasis = 2, # Seed for Basis
SeedW = 3, # Seed for Weight matrix
SeedT = 4, # Seed for Transformation matrix
N,
Print = "long",
Digits = 3,
Example = FALSE)
Fi <- out2$Fi
Fj <- out2$Fj
Fk <- out2$Fk
Fl <- out2$Fl
X <- out2$X
# Notice that all sets of factor scores are model consistent
round( t( solve(t(Fi) %*% Fi) %*% t(Fi) %*% X) ,3)
round( t( solve(t(Fj) %*% Fj) %*% t(Fj) %*% X) ,3)
round( t( solve(t(Fk) %*% Fk) %*% t(Fk) %*% X) ,3)
round( t( solve(t(Fl) %*% Fl) %*% t(Fl) %*% X) ,3)
# Guttman's Indeterminacy Index
round( (1/N * t(Fi) %*% Fj)[1:2,1:2], 3)
Run the code above in your browser using DataLab