communalities_optimal_solution {FactorAssumptions} | R Documentation |
Calculates the Optimal Solution for Communalities in a Dataframe
Description
communalities_optimal_solution()
call upon either the principal
or fa
functions from psych
package to iterate over the variables of a dataframe.
Usage
communalities_optimal_solution(
df,
nfactors,
type,
rotate = "varimax",
fm = "minres",
squared = TRUE
)
Arguments
df |
a dataframe with only |
nfactors |
number of factors to extract in principal components or factor analysis |
type |
either |
rotate |
rotation to be employed (default is varimax). "none", "varimax", "quartimax", "bentlerT", "equamax", "varimin", "geominT" and "bifactor" are orthogonal rotations. "Promax", "promax", "oblimin", "simplimax", "bentlerQ, "geominQ" and "biquartimin" and "cluster" are possible oblique transformations of the solution. The default is to do a oblimin transformation, although versions prior to 2009 defaulted to varimax. SPSS seems to do a Kaiser normalization before doing Promax, this is done here by the call to "promax" which does the normalization before calling Promax in GPArotation. |
fm |
Factoring method fm="minres" (default) will do a minimum residual as will fm="uls". Both of these use a first derivative. fm="ols" differs very slightly from "minres" in that it minimizes the entire residual matrix using an OLS procedure but uses the empirical first derivative. This will be slower. fm="wls" will do a weighted least squares (WLS) solution, fm="gls" does a generalized weighted least squares (GLS), fm="pa" will do the principal factor solution, fm="ml" will do a maximum likelihood factor analysis. fm="minchi" will minimize the sample size weighted chi square when treating pairwise correlations with different number of subjects per pair. fm ="minrank" will do a minimum rank factor analysis. "old.min" will do minimal residual the way it was done prior to April, 2017 (see discussion below). fm="alpha" will do alpha factor analysis as described in Kaiser and Coffey (1965) |
squared |
TRUE if matrix is squared (such as adjacency matrices), FALSE otherwise |
Details
If finds any individual communality below the optimal value of 0.5 then removes the lowest communality value variable until no more variable has not-optimal communality values.
Value
A list with
-
df
- A dataframe that has reached its optimal solution in terms of KMO values -
removed
- A list of removed variables ordered by the first to last removed during the procedure -
loadings
- A table with the communalities loadings from the variables final iteration -
results
- Results of the final iteration of either theprincipal
orfa
functions frompsych
package
See Also
principal
the PCA function from psych and
fa
the Factor Analysis function from psych
Examples
set.seed(123)
df <- as.data.frame(matrix(rnorm(100*10, 1, .5), ncol=10))
communalities_optimal_solution(df, nfactors = 2,type = "principal", squared = FALSE)