# Factor Analysis in R using just a matrix

Can someone help me to do factor analysis using just a matrix in R since I have looked up the code you wrote but I cannot manage to do it with just a matrix?

Say the matrix p = [ 1 0.63 0.45 0.27
0.63 1 0.35 0.21
0.45 0.35 1 0.15
0.27 0.21 0.15 1 ]
p= 4 standardized random variables Z1, Z2, Z3 and Z4.

Thanks,
Lovevind

I assume the matrix is a correlation matrix?

``````cors <- c(1, 0.63, 0.45, 0.27,
0.63, 1, 0.35, 0.21,
0.45, 0.35, 1, 0.15,
0.27, 0.21, 0.15, 1)

p <- matrix(
data = cors,
nrow = 4,
byrow = TRUE,
dimnames = list(
paste0("Z", 1:4),
paste0("Z", 1:4)
)
)

psych::fa(r = p)
#> Factor Analysis using method =  minres
#> Call: psych::fa(r = p)
#>    MR1   h2   u2 com
#> Z1 0.9 0.81 0.19   1
#> Z2 0.7 0.49 0.51   1
#> Z3 0.5 0.25 0.75   1
#> Z4 0.3 0.09 0.91   1
#>
#>                 MR1
#> Proportion Var 0.41
#>
#> Mean item complexity =  1
#> Test of the hypothesis that 1 factor is sufficient.
#>
#> The degrees of freedom for the null model are  6  and the objective function was  0.82
#> The degrees of freedom for the model are 2  and the objective function was  0
#>
#> The root mean square of the residuals (RMSR) is  0
#> The df corrected root mean square of the residuals is  0
#>
#> Fit based upon off diagonal values = 1
#> Measures of factor score adequacy
#>                                                    MR1
#> Correlation of (regression) scores with factors   0.92
#> Multiple R square of scores with factors          0.85
#> Minimum correlation of possible factor scores     0.70
``````

Created on 2022-03-24 by the reprex package (v2.0.1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.