fa_hs {lazy.fa}R Documentation

ML/LS Solution of Factor Analysis with Homoschedastic Error
Sigma = Lambda %*% t(Lambda) + psi diag(c)

Description

ML/LS Solution of Factor Analysis with Homoschedastic Error
Sigma = Lambda %*% t(Lambda) + psi diag(c)

Usage

fa_hs(S, ndim = 2, c = "pca", model = "random", noderiv = 0,
  print = 1)

Arguments

S

Input dispersion matrix

ndim

# of dimensions

c

A vector of proportionality or 1 or "smc"

model

"random" or "fixed".

noderiv

= 1 to skip the calculation of the final derivatives.

print

= 2 to print the derivatives

Details

When c == "pca", diag(S-Lambda0 Lambda0') will be used as the c vector where Lambda0 is from PCA.
When c == "smc", diag(S) - Squared Multiple Correlation of each variable will be used as the c vector.

The numeric and analytic derivative of the criterion function will be printed as dcritN and dcritA, resp.


When model = "fixed", the Factor Score matrix F will be treated as the parameters satisfying F'F = n I.

Value

A list of
Lambda Factor Loadings
psi Scalar error variance
c The input proportionality constants
psic psi*c
method
critfa The criterion value minimized.
Lambda0 and psi0 The PCA Lambda and the residual psi vector.
dcritN and dcritA The derivatives of the criterion

Examples

seed <- 1701
set.seed(seed)

nvar <- 10
ndim0 <- 3
ps <- 0.2
df <- 500

Lambda <- matrix(runif(nvar*ndim0),nvar)
Sigma <- Lambda%*%t(Lambda) + ps*diag(nvar)
dS <- sqrt(diag(Sigma))
Sigma <- diag(1/dS)%*%Sigma%*%diag(1/dS)
S <- rWishart( 1, df, Sigma )
S <- S[,,1]/df
dS <- sqrt(diag(S))
S <- diag(1/dS)%*%S%*%diag(1/dS)

res_r <- fa_hs( S, ndim=2, print=2 )
res_f <- fa_hs( S, ndim=2, print=2, model="fixed" )
Print(res_r$Lambda, res_f$Lambda)
Print(res_r$psi, res_f$psi)



[Package lazy.fa version 0.1.3 Index]