library(psych)
library(readxl)
places <- read_excel("~/2nd Sem/MULTIVARIATE DATA ANALYSIS/Factor-Analysis/places.xlsx")
data<- places[,1:9]
head(data)
## # A tibble: 6 x 9
##   Climate Housing Health Crime Transpo Education  Arts Recreation Economics
##     <dbl>   <dbl>  <dbl> <dbl>   <dbl>     <dbl> <dbl>      <dbl>     <dbl>
## 1     521    6200    237   923    4031      2757   996       1405      7633
## 2     575    8138   1656   886    4883      2438  5564       2632      4350
## 3     468    7339    618   970    2531      2560   237        859      5250
## 4     476    7908   1431   610    6883      3399  4655       1617      5864
## 5     659    8393   1853  1483    6558      3026  4496       2612      5727
## 6     520    5819    640   727    2444      2972   334       1018      5254

Maximum Likelihood

ml <- fa(r = data,
         nfactors = 3,
         rotate = "varimax",
         fm = "ml",
         residuals = TRUE)
ml
## Factor Analysis using method =  ml
## Call: fa(r = data, nfactors = 3, rotate = "varimax", residuals = TRUE, 
##     fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##              ML2  ML1   ML3   h2    u2 com
## Climate     0.13 0.37  0.11 0.17 0.831 1.4
## Housing     0.28 0.95 -0.08 1.00 0.005 1.2
## Health      0.97 0.20  0.11 0.98 0.017 1.1
## Crime       0.18 0.16  0.90 0.87 0.132 1.1
## Transpo     0.43 0.17  0.21 0.26 0.741 1.8
## Education   0.50 0.06 -0.03 0.25 0.749 1.0
## Arts        0.82 0.25  0.22 0.78 0.215 1.3
## Recreation  0.23 0.40  0.28 0.29 0.714 2.4
## Economics  -0.02 0.30  0.22 0.14 0.856 1.8
## 
##                        ML2  ML1  ML3
## SS loadings           2.22 1.46 1.06
## Proportion Var        0.25 0.16 0.12
## Cumulative Var        0.25 0.41 0.53
## Proportion Explained  0.47 0.31 0.22
## Cumulative Proportion 0.47 0.78 1.00
## 
## Mean item complexity =  1.5
## Test of the hypothesis that 3 factors are sufficient.
## 
## The degrees of freedom for the null model are  36  and the objective function was  3.24 with Chi Square of  1051.61
## The degrees of freedom for the model are 12  and the objective function was  0.22 
## 
## The root mean square of the residuals (RMSR) is  0.06 
## The df corrected root mean square of the residuals is  0.1 
## 
## The harmonic number of observations is  329 with the empirical chi square  76.37  with prob <  2e-11 
## The total number of observations was  329  with Likelihood Chi Square =  72.24  with prob <  1.2e-10 
## 
## Tucker Lewis Index of factoring reliability =  0.821
## RMSEA index =  0.123  and the 90 % confidence intervals are  0.097 0.152
## BIC =  2.68
## Fit based upon off diagonal values = 0.97
## Measures of factor score adequacy             
##                                                    ML2  ML1  ML3
## Correlation of (regression) scores with factors   0.99 1.00 0.93
## Multiple R square of scores with factors          0.98 0.99 0.87
## Minimum correlation of possible factor scores     0.96 0.98 0.73

Let us now interpret the data based on factor rotation:

ML2: primarily a measure of Health, Transportation, Education, and the Arts.

ML1: primarily a measure of Housing, Recreation, the Economics, and Climate .

ML3: primarily a measure of Crime alone.

To see it clearly, below is the diagram for our factor analysis.

fa.diagram(ml,main="data")