Compute Factor Scores

Share:

Description

Compute factor scores on the result of factor analysis method, the method is one of "mle", "pca", and "pfa".

Usage

1
computeScores(out, x = data, covmat = covmat, cor = cor, scoresMethod = scoresMethod)

Arguments

out

The result of factorScorePca(), factorScorePfa(), or factanal(). It is a list.

x

A numeric matrix.

covmat

A list with components: cov, center, and n.obs.

cor

A logical value indicating whether the calculation should use the covariance matrix (cor = FALSE) or the correlation matrix (cor = TRUE).

scoresMethod

Type of scores to produce, if any. The default is "none", "regression" gives Thompson's scores, "Bartlett" gives Bartlett's weighted least-squares scores.

Value

The output is a list. Except for the components of out, it also has components:

scoringCoef

The scoring coefficients.

scores

The matrix of scores.

meanF

The sample mean of the scores.

corF

The sample correlation matrix of the scores.

eigenvalues

The eigenvalues of the running matrix.

covariance

The covariance matrix.

correlation

The correlation matrix.

usedMatrix

The used matrix (running matrix) to compute scoringCoef etc..

reducedCorrelation

NULL. The reduced correlation matrix, reducedCorrelation is calculated in factorScorePfa.R.

scoringCoef = F = meanF = corF = NULL if scoresMethod = "none".

Author(s)

Ying-Ying Zhang (Robert) robertzhangyying@qq.com

References

Zhang, Y. Y. (2013), An Object Oriented Solution for Robust Factor Analysis.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data("stock611")
stock604 = stock611[-c(92,2,337,338,379,539,79), ]
data = as.matrix(stock604[, 3:12])

factors = 2
cor = TRUE
scoresMethod = "regression" 

covx = Cov(data)
covmat = list(cov = getCov(covx), center = getCenter(covx), n.obs = covx@n.obs)

out = factanal(factors = factors, covmat = covmat)

out = computeScores(out, x = data, covmat = covmat, cor = cor, scoresMethod = scoresMethod)
out