View source: R/FACTOR_SCORES.R
| FACTOR_SCORES | R Documentation |
FACTOR_SCORES() has been superseded by efa_scores(), which is the
recommended interface going forward. It remains available so existing code
keeps working. Note that R2 is now the squared factor-score determinacy of
the requested method: the squared correlation between a factor and the
scores that method produces. For method = "Thurstone" this is each factor's
squared multiple correlation with the observed variables (the value
psych::factor.scores() returns with Grice = TRUE); for every other method
it is smaller, because no estimator correlates more highly with the factor
than the regression estimator does. Earlier versions returned psych's default
Grice = FALSE validity coefficient, so the slot is not comparable across
versions.
A convenience wrapper around efa_scores() that returns factor scores and
weights in a compact list. Factor scores are calculated according to the
specified method if raw data are provided, and only factor weights if a
correlation matrix is provided.
FACTOR_SCORES(
x,
f,
Phi = NULL,
rho = NULL,
method = c("Thurstone", "tenBerge", "Anderson", "Bartlett", "Harman", "components")
)
x |
data.frame or matrix. Dataframe or matrix of raw data (needed to get factor scores) or matrix with correlations. |
f |
object of class |
Phi |
matrix. A matrix of factor intercorrelations. Only needs to be
specified if a factor loadings matrix is entered directly into |
rho |
matrix. Correlation matrix used to derive the scoring weights.
Defaults to |
method |
character. The method used to calculate factor scores. One of "Thurstone" (regression-based; default), "tenBerge", "Anderson", "Bartlett", "Harman", or "components". |
A list of class FACTOR_SCORES containing the following:
scores |
The factor scores (only if raw data are provided.) |
weights |
The factor weights. |
r.scores |
The correlations of the factor score estimates. |
missing |
Whether the raw data contained missing values (only if raw data are provided). |
R2 |
The squared factor-score determinacy for each factor: the squared
correlation between a factor and the score the requested |
settings |
A list of the settings used. |
efa_scores() for the factor-score weights together with the full
set of score-quality diagnostics (determinacy, univocality, and Guttman
indeterminacy index) and a print/summary method.
# Example with raw data with method "Bartlett"
EFA_raw <- efa_fit(DOSPERT_raw, n_factors = 10, estimator = "PAF",
rotation = "oblimin",
rotate_control = rotate_control(random_starts = 1))
fac_scores_raw <- FACTOR_SCORES(DOSPERT_raw, f = EFA_raw, method = "Bartlett")
# Same as above, but with raw data AND a correlation matrix
cor_pearson <- cor(DOSPERT_raw)
EFA_cor_pearson <- efa_fit(cor_pearson, n_factors = 10, N = nrow(DOSPERT_raw),
estimator = "PAF", rotation = "oblimin",
rotate_control = rotate_control(random_starts = 1))
fac_scores_cor_pearson <- FACTOR_SCORES(DOSPERT_raw, f = EFA_cor_pearson,
rho = cor_pearson,
method = "Bartlett")
# Scores between two alternatives above are identical
isTRUE(all.equal(fac_scores_raw$scores, fac_scores_cor_pearson$scores,
check.attributes = FALSE))
# Example with a correlation matrix only (does not return factor scores)
EFA_cor <- efa_fit(test_models$baseline$cormat, n_factors = 3, N = 500,
estimator = "PAF", rotation = "oblimin")
fac_scores_cor <- FACTOR_SCORES(test_models$baseline$cormat, f = EFA_cor)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.