FACTOR_SCORES {EFAtools} | R Documentation |
Estimate factor scores for an EFA model
Description
This is a wrapper function for
psych::factor.scores
to be used directly
with an output from EFA
or by manually specifying the factor
loadings and intercorrelations. Calculates factor scores according to the
specified methods if raw data are provided, and only factor weights if a
correlation matrix is provided.
Usage
FACTOR_SCORES(
x,
f,
Phi = NULL,
method = c("Thurstone", "tenBerge", "Anderson", "Bartlett", "Harman", "components"),
impute = c("none", "means", "median")
)
Arguments
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 |
method |
character. The method used to calculate factor scores. One of
"Thurstone" (regression-based; default), "tenBerge", "Anderson", "Bartlett",
"Harman", or "components".
See |
impute |
character. Whether and how missing values in |
Value
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 |
A vector of the number of missing observations per subject (only if raw data are provided. |
R2 |
Multiple R2 of the scores with the factors. |
settings |
A list of the settings used. |
Examples
# Example with raw data with method "Bartlett" and no imputation
EFA_raw <- EFA(DOSPERT_raw, n_factors = 10, type = "EFAtools", method = "PAF",
rotation = "oblimin")
fac_scores_raw <- FACTOR_SCORES(DOSPERT_raw, f = EFA_raw, method = "Bartlett",
impute = "none")
# Example with a correlation matrix (does not return factor scores)
EFA_cor <- EFA(test_models$baseline$cormat, n_factors = 3, N = 500,
type = "EFAtools", method = "PAF", rotation = "oblimin")
fac_scores_cor <- FACTOR_SCORES(test_models$baseline$cormat, f = EFA_cor)