#Conduct a Path Analysis ##Study the correlation between the variables Let’s study the correlation and the covariance between the variables First Group

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2     ✓ purrr   0.3.4
## ✓ tibble  3.0.4     ✓ dplyr   1.0.2
## ✓ tidyr   1.1.2     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
require(dplyr)
library(lavaan)
## This is lavaan 0.6-7
## lavaan is BETA software! Please report any bugs.
library(psych)
## 
## Attaching package: 'psych'
## The following object is masked from 'package:lavaan':
## 
##     cor2cov
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(semPlot)
## Registered S3 methods overwritten by 'huge':
##   method    from   
##   plot.sim  BDgraph
##   print.sim BDgraph
df <- read_csv("/home/asma/Desktop/CFA_FINAL/Factor_Analysis.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   .default = col_double()
## )
## ℹ Use `spec()` for the full column specifications.
covariance_matrix <- round(cov(df[,1:5]),2)
# create a correlation matrix
correlation_matrix <- cor(df[,1:5])
covariance_matrix
##                   sector_work_class Career_day Career_day_help Relation
## sector_work_class              0.13       0.01           -0.04     0.00
## Career_day                     0.01       0.17            0.03     0.01
## Career_day_help               -0.04       0.03            0.25    -0.11
## Relation                       0.00       0.01           -0.11     0.21
## Cur_salar                     -0.05       0.05            0.32    -0.29
##                   Cur_salar
## sector_work_class     -0.05
## Career_day             0.05
## Career_day_help        0.32
## Relation              -0.29
## Cur_salar              1.22
correlation_matrix
##                   sector_work_class Career_day Career_day_help     Relation
## sector_work_class       1.000000000 0.08848601      -0.2195342  0.005246782
## Career_day              0.088486013 1.00000000       0.1296595  0.029816606
## Career_day_help        -0.219534237 0.12965953       1.0000000 -0.476172288
## Relation                0.005246782 0.02981661      -0.4761723  1.000000000
## Cur_salar              -0.131292225 0.09868834       0.5852821 -0.581023873
##                     Cur_salar
## sector_work_class -0.13129223
## Career_day         0.09868834
## Career_day_help    0.58528208
## Relation          -0.58102387
## Cur_salar          1.00000000

Second group

# create a correlation matrix

library(semPlot)
df <- read_csv("/home/asma/Desktop/CFA_FINAL/Factor_Analysis.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   .default = col_double()
## )
## ℹ Use `spec()` for the full column specifications.
covariance_matrix <- round(cov(df[,6:19]),2)
correlation_matrix <- cor(df[,6:19])
covariance_matrix
##       PA1  PA2  PA3  PA4  PA5  PA6  PA7  PA8  PA9 PA10 PA11 PA12 PA13 PA14
## PA1  0.92 0.50 0.51 0.42 0.53 0.51 0.60 0.49 0.51 0.47 0.54 0.54 0.52 0.46
## PA2  0.50 0.88 0.65 0.50 0.51 0.47 0.53 0.47 0.49 0.57 0.55 0.52 0.51 0.54
## PA3  0.51 0.65 0.89 0.55 0.45 0.44 0.52 0.46 0.43 0.57 0.58 0.51 0.47 0.42
## PA4  0.42 0.50 0.55 0.91 0.65 0.59 0.55 0.54 0.52 0.46 0.41 0.52 0.53 0.45
## PA5  0.53 0.51 0.45 0.65 1.14 0.65 0.68 0.55 0.68 0.55 0.52 0.73 0.65 0.66
## PA6  0.51 0.47 0.44 0.59 0.65 1.03 0.65 0.54 0.57 0.50 0.41 0.60 0.45 0.64
## PA7  0.60 0.53 0.52 0.55 0.68 0.65 0.99 0.55 0.52 0.52 0.49 0.63 0.54 0.53
## PA8  0.49 0.47 0.46 0.54 0.55 0.54 0.55 1.31 0.66 0.66 0.49 0.57 0.41 0.46
## PA9  0.51 0.49 0.43 0.52 0.68 0.57 0.52 0.66 1.03 0.64 0.52 0.64 0.48 0.54
## PA10 0.47 0.57 0.57 0.46 0.55 0.50 0.52 0.66 0.64 1.29 0.76 0.70 0.55 0.55
## PA11 0.54 0.55 0.58 0.41 0.52 0.41 0.49 0.49 0.52 0.76 1.11 0.75 0.68 0.64
## PA12 0.54 0.52 0.51 0.52 0.73 0.60 0.63 0.57 0.64 0.70 0.75 1.34 0.82 0.66
## PA13 0.52 0.51 0.47 0.53 0.65 0.45 0.54 0.41 0.48 0.55 0.68 0.82 1.24 0.61
## PA14 0.46 0.54 0.42 0.45 0.66 0.64 0.53 0.46 0.54 0.55 0.64 0.66 0.61 2.03
correlation_matrix
##            PA1       PA2       PA3       PA4       PA5       PA6       PA7
## PA1  1.0000000 0.5546416 0.5696548 0.4593138 0.5186495 0.5230535 0.6289039
## PA2  0.5546416 1.0000000 0.7380481 0.5533564 0.5134730 0.4968103 0.5662640
## PA3  0.5696548 0.7380481 1.0000000 0.6148604 0.4459097 0.4575497 0.5529272
## PA4  0.4593138 0.5533564 0.6148604 1.0000000 0.6400842 0.6135089 0.5814082
## PA5  0.5186495 0.5134730 0.4459097 0.6400842 1.0000000 0.5983047 0.6423391
## PA6  0.5230535 0.4968103 0.4575497 0.6135089 0.5983047 1.0000000 0.6401350
## PA7  0.6289039 0.5662640 0.5529272 0.5814082 0.6423391 0.6401350 1.0000000
## PA8  0.4495319 0.4329473 0.4284650 0.4931994 0.4523979 0.4600253 0.4792444
## PA9  0.5303571 0.5118894 0.4469960 0.5402925 0.6324713 0.5510269 0.5188057
## PA10 0.4356556 0.5332379 0.5363535 0.4230978 0.4505303 0.4345094 0.4638834
## PA11 0.5370137 0.5597673 0.5850084 0.4135218 0.4610475 0.3831567 0.4675466
## PA12 0.4917534 0.4738689 0.4708482 0.4750648 0.5913379 0.5132133 0.5472307
## PA13 0.4900643 0.4893092 0.4521673 0.4978824 0.5465732 0.4015520 0.4904514
## PA14 0.3356502 0.4043172 0.3099145 0.3320833 0.4325805 0.4401709 0.3707710
##            PA8       PA9      PA10      PA11      PA12      PA13      PA14
## PA1  0.4495319 0.5303571 0.4356556 0.5370137 0.4917534 0.4900643 0.3356502
## PA2  0.4329473 0.5118894 0.5332379 0.5597673 0.4738689 0.4893092 0.4043172
## PA3  0.4284650 0.4469960 0.5363535 0.5850084 0.4708482 0.4521673 0.3099145
## PA4  0.4931994 0.5402925 0.4230978 0.4135218 0.4750648 0.4978824 0.3320833
## PA5  0.4523979 0.6324713 0.4505303 0.4610475 0.5913379 0.5465732 0.4325805
## PA6  0.4600253 0.5510269 0.4345094 0.3831567 0.5132133 0.4015520 0.4401709
## PA7  0.4792444 0.5188057 0.4638834 0.4675466 0.5472307 0.4904514 0.3707710
## PA8  1.0000000 0.5685952 0.5094052 0.4086080 0.4323614 0.3243631 0.2788873
## PA9  0.5685952 1.0000000 0.5603399 0.4855153 0.5441025 0.4217423 0.3740137
## PA10 0.5094052 0.5603399 1.0000000 0.6367229 0.5299883 0.4325425 0.3389642
## PA11 0.4086080 0.4855153 0.6367229 1.0000000 0.6162374 0.5808169 0.4238692
## PA12 0.4323614 0.5441025 0.5299883 0.6162374 1.0000000 0.6356367 0.3971059
## PA13 0.3243631 0.4217423 0.4325425 0.5808169 0.6356367 1.0000000 0.3835737
## PA14 0.2788873 0.3740137 0.3389642 0.4238692 0.3971059 0.3835737 1.0000000

Third group

# create a correlation matrix

library(semPlot)
df <- read_csv("/home/asma/Desktop/CFA_FINAL/Factor_Analysis.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   .default = col_double()
## )
## ℹ Use `spec()` for the full column specifications.
covariance_matrix <- round(cov(df[,20:31]),2)
correlation_matrix <- cor(df[,20:31])
covariance_matrix
##       SA1  SA2  SA3  SA4  SA5  SA6  SA7  SA8  SA9 SA10 SA11 SA12
## SA1  0.96 0.65 0.67 0.47 0.57 0.50 0.51 0.51 0.45 0.41 0.47 0.59
## SA2  0.65 0.95 0.72 0.56 0.60 0.58 0.55 0.56 0.47 0.41 0.46 0.55
## SA3  0.67 0.72 1.00 0.61 0.58 0.58 0.59 0.58 0.56 0.45 0.49 0.55
## SA4  0.47 0.56 0.61 0.88 0.51 0.49 0.50 0.52 0.48 0.42 0.46 0.48
## SA5  0.57 0.60 0.58 0.51 0.93 0.46 0.45 0.44 0.48 0.43 0.49 0.56
## SA6  0.50 0.58 0.58 0.49 0.46 0.87 0.55 0.47 0.44 0.42 0.39 0.46
## SA7  0.51 0.55 0.59 0.50 0.45 0.55 0.82 0.45 0.45 0.50 0.43 0.46
## SA8  0.51 0.56 0.58 0.52 0.44 0.47 0.45 1.07 0.66 0.51 0.44 0.59
## SA9  0.45 0.47 0.56 0.48 0.48 0.44 0.45 0.66 0.95 0.53 0.47 0.49
## SA10 0.41 0.41 0.45 0.42 0.43 0.42 0.50 0.51 0.53 0.93 0.47 0.57
## SA11 0.47 0.46 0.49 0.46 0.49 0.39 0.43 0.44 0.47 0.47 0.99 0.57
## SA12 0.59 0.55 0.55 0.48 0.56 0.46 0.46 0.59 0.49 0.57 0.57 1.11
correlation_matrix
##            SA1       SA2       SA3       SA4       SA5       SA6       SA7
## SA1  1.0000000 0.6835017 0.6873520 0.5107108 0.6013675 0.5479905 0.5760284
## SA2  0.6835017 1.0000000 0.7386661 0.6176969 0.6393782 0.6363041 0.6203962
## SA3  0.6873520 0.7386661 1.0000000 0.6473061 0.6035389 0.6243592 0.6464176
## SA4  0.5107108 0.6176969 0.6473061 1.0000000 0.5674268 0.5628966 0.5823837
## SA5  0.6013675 0.6393782 0.6035389 0.5674268 1.0000000 0.5163699 0.5121593
## SA6  0.5479905 0.6363041 0.6243592 0.5628966 0.5163699 1.0000000 0.6504141
## SA7  0.5760284 0.6203962 0.6464176 0.5823837 0.5121593 0.6504141 1.0000000
## SA8  0.4984632 0.5514133 0.5567643 0.5335931 0.4455758 0.4893906 0.4731259
## SA9  0.4754886 0.4969138 0.5770613 0.5274532 0.5140571 0.4807801 0.5080965
## SA10 0.4361209 0.4401855 0.4650327 0.4681250 0.4605738 0.4710334 0.5744776
## SA11 0.4798553 0.4779644 0.4903456 0.4946522 0.5078935 0.4243516 0.4792917
## SA12 0.5776685 0.5398073 0.5239512 0.4811109 0.5566634 0.4697337 0.4769087
##            SA8       SA9      SA10      SA11      SA12
## SA1  0.4984632 0.4754886 0.4361209 0.4798553 0.5776685
## SA2  0.5514133 0.4969138 0.4401855 0.4779644 0.5398073
## SA3  0.5567643 0.5770613 0.4650327 0.4903456 0.5239512
## SA4  0.5335931 0.5274532 0.4681250 0.4946522 0.4811109
## SA5  0.4455758 0.5140571 0.4605738 0.5078935 0.5566634
## SA6  0.4893906 0.4807801 0.4710334 0.4243516 0.4697337
## SA7  0.4731259 0.5080965 0.5744776 0.4792917 0.4769087
## SA8  1.0000000 0.6503222 0.5111268 0.4236922 0.5370809
## SA9  0.6503222 1.0000000 0.5653181 0.4873760 0.4764728
## SA10 0.5111268 0.5653181 1.0000000 0.4930643 0.5638951
## SA11 0.4236922 0.4873760 0.4930643 1.0000000 0.5453459
## SA12 0.5370809 0.4764728 0.5638951 0.5453459 1.0000000

Fourth group

# create a correlation matrix

library(semPlot)
df <- read_csv("/home/asma/Desktop/CFA_FINAL/Factor_Analysis.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   .default = col_double()
## )
## ℹ Use `spec()` for the full column specifications.
covariance_matrix <- round(cov(df[,32:44]),2)
correlation_matrix <- cor(df[,32:49])
covariance_matrix
##      SA13  IS1  IS2  IS3  IS4  IS5  IS6  IS7  IS8  IS9 IS10 IS11 IS12
## SA13 1.01 0.37 0.42 0.43 0.45 0.34 0.41 0.32 0.43 0.29 0.36 0.37 0.35
## IS1  0.37 1.36 0.43 0.44 0.40 0.44 0.36 0.42 0.54 0.26 0.46 0.46 0.48
## IS2  0.42 0.43 1.03 0.66 0.60 0.41 0.36 0.44 0.59 0.33 0.46 0.34 0.52
## IS3  0.43 0.44 0.66 1.26 0.71 0.44 0.45 0.50 0.67 0.27 0.37 0.37 0.71
## IS4  0.45 0.40 0.60 0.71 1.24 0.47 0.46 0.43 0.52 0.25 0.35 0.47 0.52
## IS5  0.34 0.44 0.41 0.44 0.47 0.88 0.60 0.43 0.49 0.23 0.29 0.40 0.20
## IS6  0.41 0.36 0.36 0.45 0.46 0.60 1.00 0.35 0.28 0.22 0.24 0.38 0.10
## IS7  0.32 0.42 0.44 0.50 0.43 0.43 0.35 0.95 0.66 0.34 0.32 0.39 0.50
## IS8  0.43 0.54 0.59 0.67 0.52 0.49 0.28 0.66 1.69 0.41 0.40 0.57 0.74
## IS9  0.29 0.26 0.33 0.27 0.25 0.23 0.22 0.34 0.41 0.73 0.33 0.26 0.17
## IS10 0.36 0.46 0.46 0.37 0.35 0.29 0.24 0.32 0.40 0.33 1.17 0.41 0.51
## IS11 0.37 0.46 0.34 0.37 0.47 0.40 0.38 0.39 0.57 0.26 0.41 1.08 0.50
## IS12 0.35 0.48 0.52 0.71 0.52 0.20 0.10 0.50 0.74 0.17 0.51 0.50 1.98
correlation_matrix
##           SA13       IS1       IS2       IS3       IS4       IS5       IS6
## SA13 1.0000000 0.3161633 0.4093483 0.3782502 0.4003895 0.3573227 0.4055616
## IS1  0.3161633 1.0000000 0.3623674 0.3361182 0.3064731 0.4036982 0.3081366
## IS2  0.4093483 0.3623674 1.0000000 0.5792443 0.5297738 0.4315697 0.3516593
## IS3  0.3782502 0.3361182 0.5792443 1.0000000 0.5639915 0.4166951 0.3962074
## IS4  0.4003895 0.3064731 0.5297738 0.5639915 1.0000000 0.4522712 0.4171133
## IS5  0.3573227 0.4036982 0.4315697 0.4166951 0.4522712 1.0000000 0.6375403
## IS6  0.4055616 0.3081366 0.3516593 0.3962074 0.4171133 0.6375403 1.0000000
## IS7  0.3294458 0.3691262 0.4451550 0.4601100 0.4005754 0.4689266 0.3587670
## IS8  0.3313304 0.3534015 0.4461337 0.4580708 0.3599498 0.4052301 0.2127666
## IS9  0.3380121 0.2654892 0.3740648 0.2779059 0.2635084 0.2823019 0.2592501
## IS10 0.3355500 0.3659229 0.4203843 0.3069887 0.2880858 0.2901289 0.2225302
## IS11 0.3583400 0.3849260 0.3266479 0.3168956 0.4055986 0.4108271 0.3620067
## IS12 0.2505388 0.2946100 0.3661291 0.4477396 0.3296530 0.1488925 0.0732025
## IS13 0.2615293 0.1582299 0.3005309 0.3069556 0.3545890 0.1443478 0.1800517
## IS14 0.2128691 0.0208829 0.1239028 0.1659061 0.3609494 0.2504481 0.3073466
## GA1  0.4672505 0.3631154 0.2879418 0.2466235 0.2752063 0.4597662 0.3401380
## GA2  0.3781681 0.3704435 0.2499464 0.1677393 0.2155627 0.3167812 0.2338764
## GA3  0.5627687 0.3049953 0.3155425 0.2676854 0.3534142 0.4533552 0.3925197
##            IS7         IS8       IS9      IS10      IS11       IS12       IS13
## SA13 0.3294458 0.331330443 0.3380121 0.3355500 0.3583400 0.25053884 0.26152930
## IS1  0.3691262 0.353401533 0.2654892 0.3659229 0.3849260 0.29461001 0.15822994
## IS2  0.4451550 0.446133685 0.3740648 0.4203843 0.3266479 0.36612910 0.30053086
## IS3  0.4601100 0.458070836 0.2779059 0.3069887 0.3168956 0.44773957 0.30695557
## IS4  0.4005754 0.359949843 0.2635084 0.2880858 0.4055986 0.32965297 0.35458897
## IS5  0.4689266 0.405230053 0.2823019 0.2901289 0.4108271 0.14889253 0.14434777
## IS6  0.3587670 0.212766596 0.2592501 0.2225302 0.3620067 0.07320250 0.18005167
## IS7  1.0000000 0.521321342 0.4040559 0.3003033 0.3832554 0.36554958 0.22682720
## IS8  0.5213213 1.000000000 0.3649696 0.2857208 0.4219079 0.40265417 0.08357512
## IS9  0.4040559 0.364969594 1.0000000 0.3578973 0.2928365 0.14275882 0.25090169
## IS10 0.3003033 0.285720823 0.3578973 1.0000000 0.3669000 0.33638423 0.28340671
## IS11 0.3832554 0.421907946 0.2928365 0.3669000 1.0000000 0.34055335 0.23066094
## IS12 0.3655496 0.402654168 0.1427588 0.3363842 0.3405533 1.00000000 0.27228382
## IS13 0.2268272 0.083575120 0.2509017 0.2834067 0.2306609 0.27228382 1.00000000
## IS14 0.1397898 0.001296027 0.2387858 0.1991182 0.2279366 0.03877721 0.42357264
## GA1  0.3285342 0.330646456 0.2514986 0.2532271 0.2916454 0.08932213 0.07633492
## GA2  0.2931203 0.269842221 0.2133124 0.2059785 0.2698236 0.17645309 0.18592302
## GA3  0.3259466 0.320785674 0.2799685 0.2530560 0.2943454 0.13111886 0.18300860
##             IS14        GA1       GA2       GA3
## SA13 0.212869079 0.46725045 0.3781681 0.5627687
## IS1  0.020882901 0.36311536 0.3704435 0.3049953
## IS2  0.123902751 0.28794177 0.2499464 0.3155425
## IS3  0.165906124 0.24662352 0.1677393 0.2676854
## IS4  0.360949427 0.27520629 0.2155627 0.3534142
## IS5  0.250448129 0.45976624 0.3167812 0.4533552
## IS6  0.307346575 0.34013796 0.2338764 0.3925197
## IS7  0.139789786 0.32853417 0.2931203 0.3259466
## IS8  0.001296027 0.33064646 0.2698422 0.3207857
## IS9  0.238785774 0.25149865 0.2133124 0.2799685
## IS10 0.199118185 0.25322706 0.2059785 0.2530560
## IS11 0.227936561 0.29164542 0.2698236 0.2943454
## IS12 0.038777213 0.08932213 0.1764531 0.1311189
## IS13 0.423572638 0.07633492 0.1859230 0.1830086
## IS14 1.000000000 0.13589024 0.1056496 0.1769258
## GA1  0.135890237 1.00000000 0.6836135 0.7093512
## GA2  0.105649632 0.68361353 1.0000000 0.5897725
## GA3  0.176925755 0.70935124 0.5897725 1.0000000

Path Analysis:

model <-'PA3~ PA2+PA4+PA10+PA11
SA1~ SA2+SA3+SA4+SA5
GA3~GA1
IS8~IS7
IS2~ IS3+IS4
Cur_salar~ Relation+Career_day_help'
fit <- cfa(model, data=df, std.lv=TRUE)
summary(fit)
## lavaan 0.6-7 ended normally after 37 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         35
##                                                       
##   Number of observations                           336
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               256.852
##   Degrees of freedom                                70
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   PA3 ~                                               
##     PA2               0.461    0.045   10.329    0.000
##     PA4               0.251    0.040    6.358    0.000
##     PA10              0.056    0.037    1.525    0.127
##     PA11              0.160    0.040    3.972    0.000
##   SA1 ~                                               
##     SA2               0.284    0.057    4.949    0.000
##     SA3               0.316    0.056    5.670    0.000
##     SA4              -0.040    0.051   -0.779    0.436
##     SA5               0.195    0.049    3.950    0.000
##   GA3 ~                                               
##     GA1               0.687    0.039   17.572    0.000
##   IS8 ~                                               
##     IS7               0.658    0.061   10.730    0.000
##   IS2 ~                                               
##     IS3               0.350    0.046    7.611    0.000
##     IS4               0.253    0.046    5.463    0.000
##   Cur_salar ~                                         
##     Relation         -0.947    0.109   -8.709    0.000
##     Career_day_hlp    0.898    0.099    9.049    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .PA3 ~~                                              
##    .SA1              -0.005    0.020   -0.241    0.810
##    .GA3               0.019    0.021    0.914    0.361
##    .IS8               0.028    0.034    0.820    0.412
##    .IS2               0.010    0.024    0.391    0.696
##    .Cur_salar         0.029    0.025    1.147    0.252
##  .SA1 ~~                                              
##    .GA3               0.096    0.025    3.928    0.000
##    .IS8               0.045    0.039    1.134    0.257
##    .IS2               0.025    0.028    0.904    0.366
##    .Cur_salar         0.037    0.029    1.291    0.197
##  .GA3 ~~                                              
##    .IS8               0.060    0.041    1.470    0.141
##    .IS2               0.036    0.029    1.236    0.216
##    .Cur_salar        -0.025    0.030   -0.831    0.406
##  .IS8 ~~                                              
##    .IS2               0.122    0.048    2.523    0.012
##    .Cur_salar         0.078    0.049    1.589    0.112
##  .IS2 ~~                                              
##    .Cur_salar         0.041    0.035    1.178    0.239
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .PA3               0.320    0.025   12.961    0.000
##    .SA1               0.422    0.033   12.961    0.000
##    .GA3               0.457    0.035   12.961    0.000
##    .IS8               1.232    0.095   12.961    0.000
##    .IS2               0.624    0.048   12.961    0.000
##    .Cur_salar         0.654    0.050   12.961    0.000
semPaths(fit, intercept = FALSE, whatLabel = "est", residuals = FALSE, exoCov = FALSE, layout = 'tree')

#Confirmatory Factor Analysis

We have tried few models in this part, first we construct our CFA model with all variables, we did no get a good fit, so we tried to reduces teh items for every factor.

##Model1: Four Factors wih all items

###########################################################################
# Experiment with the factors that have the lowest measure of uniqueness
###########################################################################

m1a<- 'Program Quality =~ PA1+PA2+PA3+PA4+PA5+PA6+PA7+PA8+PA9+PA10+PA11+PA12+PA13+PA14+GA1+GA2+GA3+GA4
Faculty Assistance =~ SA1+SA2+SA3+SA4+SA5+SA6+SA7+SA8+SA9+SA10+SA11+SA12+SA13
Student Satisfaction =~ IS1+IS2+IS3+IS4+IS5+IS6+IS7+IS8+IS9+IS10+IS11+IS12
Current Employmentn=~ sector_work_class+Career_day+Career_day_help+Relation+Cur_salar'

fourfac_all_items<- cfa(m1a, data=df, std.lv=TRUE)
summary(fourfac_all_items, fit.measures=TRUE)
## lavaan 0.6-7 ended normally after 42 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                        102
##                                                       
##   Number of observations                           336
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                              3295.884
##   Degrees of freedom                              1074
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             10507.455
##   Degrees of freedom                              1128
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.763
##   Tucker-Lewis Index (TLI)                       0.751
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -18651.938
##   Loglikelihood unrestricted model (H1)     -17003.996
##                                                       
##   Akaike (AIC)                               37507.875
##   Bayesian (BIC)                             37897.221
##   Sample-size adjusted Bayesian (BIC)        37573.664
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.078
##   90 Percent confidence interval - lower         0.075
##   90 Percent confidence interval - upper         0.082
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.079
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality =~                                         
##     PA1                     0.686    0.046   14.955    0.000
##     PA2                     0.699    0.044   15.734    0.000
##     PA3                     0.677    0.045   15.017    0.000
##     PA4                     0.668    0.046   14.523    0.000
##     PA5                     0.786    0.051   15.561    0.000
##     PA6                     0.710    0.049   14.442    0.000
##     PA7                     0.738    0.047   15.700    0.000
##     PA8                     0.753    0.056   13.345    0.000
##     PA9                     0.746    0.048   15.520    0.000
##     PA10                    0.789    0.055   14.335    0.000
##     PA11                    0.739    0.051   14.567    0.000
##     PA12                    0.827    0.056   14.894    0.000
##     PA13                    0.704    0.055   12.706    0.000
##     PA14                    0.721    0.074    9.690    0.000
##     GA1                     0.604    0.046   13.258    0.000
##     GA2                     0.615    0.053   11.598    0.000
##     GA3                     0.562    0.049   11.539    0.000
##     GA4                     0.620    0.062   10.026    0.000
##   FacultyAssistance =~                                      
##     SA1                     0.756    0.045   16.655    0.000
##     SA2                     0.790    0.044   17.899    0.000
##     SA3                     0.821    0.045   18.266    0.000
##     SA4                     0.694    0.044   15.612    0.000
##     SA5                     0.705    0.046   15.433    0.000
##     SA6                     0.678    0.044   15.294    0.000
##     SA7                     0.682    0.043   15.994    0.000
##     SA8                     0.727    0.050   14.527    0.000
##     SA9                     0.682    0.047   14.472    0.000
##     SA10                    0.635    0.047   13.389    0.000
##     SA11                    0.646    0.049   13.151    0.000
##     SA12                    0.754    0.050   14.992    0.000
##     SA13                    0.782    0.046   16.841    0.000
##   StudentSatisfaction =~                                    
##     IS1                     0.655    0.061   10.705    0.000
##     IS2                     0.715    0.050   14.201    0.000
##     IS3                     0.772    0.056   13.769    0.000
##     IS4                     0.746    0.056   13.325    0.000
##     IS5                     0.633    0.047   13.455    0.000
##     IS6                     0.575    0.052   10.956    0.000
##     IS7                     0.656    0.049   13.402    0.000
##     IS8                     0.816    0.067   12.222    0.000
##     IS9                     0.419    0.046    9.078    0.000
##     IS10                    0.557    0.058    9.637    0.000
##     IS11                    0.605    0.054   11.169    0.000
##     IS12                    0.668    0.076    8.765    0.000
##   CurrentEmploymentn =~                                     
##     sectr_wrk_clss          0.058    0.022    2.653    0.008
##     Career_day             -0.042    0.025   -1.669    0.095
##     Career_day_hlp         -0.352    0.027  -12.897    0.000
##     Relation                0.309    0.025   12.412    0.000
##     Cur_salar              -0.929    0.060  -15.503    0.000
## 
## Covariances:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality ~~                                         
##     FacultyAssstnc          0.721    0.030   24.261    0.000
##     StudentStsfctn          0.552    0.043   12.708    0.000
##     CrrntEmplymntn         -0.072    0.062   -1.161    0.245
##   FacultyAssistance ~~                                      
##     StudentStsfctn          0.664    0.036   18.437    0.000
##     CrrntEmplymntn         -0.038    0.062   -0.607    0.544
##   StudentSatisfaction ~~                                    
##     CrrntEmplymntn         -0.090    0.064   -1.400    0.161
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .PA1               0.443    0.036   12.145    0.000
##    .PA2               0.393    0.033   12.005    0.000
##    .PA3               0.426    0.035   12.135    0.000
##    .PA4               0.458    0.038   12.213    0.000
##    .PA5               0.515    0.043   12.038    0.000
##    .PA6               0.526    0.043   12.225    0.000
##    .PA7               0.440    0.037   12.012    0.000
##    .PA8               0.740    0.060   12.372    0.000
##    .PA9               0.467    0.039   12.046    0.000
##    .PA10              0.663    0.054   12.241    0.000
##    .PA11              0.556    0.046   12.206    0.000
##    .PA12              0.652    0.054   12.155    0.000
##    .PA13              0.737    0.059   12.445    0.000
##    .PA14              1.508    0.119   12.697    0.000
##    .GA1               0.485    0.039   12.383    0.000
##    .GA2               0.711    0.057   12.553    0.000
##    .GA3               0.601    0.048   12.559    0.000
##    .GA4               1.029    0.081   12.675    0.000
##    .SA1               0.382    0.032   11.871    0.000
##    .SA2               0.321    0.028   11.544    0.000
##    .SA3               0.320    0.028   11.425    0.000
##    .SA4               0.398    0.033   12.081    0.000
##    .SA5               0.426    0.035   12.112    0.000
##    .SA6               0.406    0.033   12.136    0.000
##    .SA7               0.356    0.030   12.010    0.000
##    .SA8               0.544    0.044   12.254    0.000
##    .SA9               0.483    0.039   12.262    0.000
##    .SA10              0.523    0.042   12.400    0.000
##    .SA11              0.569    0.046   12.427    0.000
##    .SA12              0.533    0.044   12.185    0.000
##    .SA13              0.394    0.033   11.829    0.000
##    .IS1               0.922    0.075   12.228    0.000
##    .IS2               0.520    0.046   11.406    0.000
##    .IS3               0.663    0.057   11.540    0.000
##    .IS4               0.678    0.058   11.666    0.000
##    .IS5               0.475    0.041   11.630    0.000
##    .IS6               0.670    0.055   12.185    0.000
##    .IS7               0.516    0.044   11.645    0.000
##    .IS8               1.024    0.086   11.936    0.000
##    .IS9               0.556    0.045   12.465    0.000
##    .IS10              0.856    0.069   12.391    0.000
##    .IS11              0.707    0.058   12.147    0.000
##    .IS12              1.531    0.122   12.503    0.000
##    .sectr_wrk_clss    0.130    0.010   12.883    0.000
##    .Career_day        0.172    0.013   12.931    0.000
##    .Career_day_hlp    0.126    0.014    9.250    0.000
##    .Relation          0.112    0.011    9.860    0.000
##    .Cur_salar         0.350    0.071    4.911    0.000
##     ProgramQuality    1.000                           
##     FacultyAssstnc    1.000                           
##     StudentStsfctn    1.000                           
##     CrrntEmplymntn    1.000
semPaths(fourfac_all_items, intercept = FALSE, whatLabel = "est", residuals = FALSE, exoCov = FALSE, layout = 'tree')

#Model 2 Estimation and results

m1<-  'Program Quality =~ PA2+PA5+PA7+PA12
Faculty Assistance =~ SA1+SA2+SA3+SA13
Student Satisfaction =~ IS2+IS3+IS4
Current Employment =~ Career_day_help+Relation+Cur_salar'

fourfactor<- cfa(m1, data=df, std.lv=TRUE)
summary(fourfactor, fit.measures=TRUE)
## lavaan 0.6-7 ended normally after 29 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         34
##                                                       
##   Number of observations                           336
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               156.230
##   Degrees of freedom                                71
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2165.984
##   Degrees of freedom                                91
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.959
##   Tucker-Lewis Index (TLI)                       0.947
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -5312.561
##   Loglikelihood unrestricted model (H1)      -5234.446
##                                                       
##   Akaike (AIC)                               10693.122
##   Bayesian (BIC)                             10822.904
##   Sample-size adjusted Bayesian (BIC)        10715.052
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.060
##   90 Percent confidence interval - lower         0.047
##   90 Percent confidence interval - upper         0.072
##   P-value RMSEA <= 0.05                          0.099
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.052
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality =~                                         
##     PA2                     0.652    0.048   13.575    0.000
##     PA5                     0.853    0.052   16.455    0.000
##     PA7                     0.771    0.049   15.783    0.000
##     PA12                    0.831    0.058   14.208    0.000
##   FacultyAssistance =~                                      
##     SA1                     0.801    0.045   17.677    0.000
##     SA2                     0.821    0.044   18.497    0.000
##     SA3                     0.841    0.046   18.440    0.000
##     SA13                    0.741    0.049   15.220    0.000
##   StudentSatisfaction =~                                    
##     IS2                     0.773    0.053   14.470    0.000
##     IS3                     0.839    0.059   14.180    0.000
##     IS4                     0.813    0.059   13.817    0.000
##   CurrentEmployment =~                                      
##     Career_day_hlp          0.345    0.027   12.604    0.000
##     Relation               -0.313    0.025  -12.516    0.000
##     Cur_salar               0.933    0.061   15.416    0.000
## 
## Covariances:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality ~~                                         
##     FacultyAssstnc          0.614    0.043   14.333    0.000
##     StudentStsfctn          0.359    0.060    5.978    0.000
##     CurrntEmplymnt          0.031    0.066    0.468    0.640
##   FacultyAssistance ~~                                      
##     StudentStsfctn          0.519    0.051   10.246    0.000
##     CurrntEmplymnt          0.047    0.064    0.729    0.466
##   StudentSatisfaction ~~                                    
##     CurrntEmplymnt          0.082    0.068    1.212    0.226
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .PA2               0.456    0.042   10.831    0.000
##    .PA5               0.406    0.046    8.812    0.000
##    .PA7               0.390    0.041    9.421    0.000
##    .PA12              0.646    0.061   10.505    0.000
##    .SA1               0.313    0.032    9.857    0.000
##    .SA2               0.271    0.029    9.173    0.000
##    .SA3               0.288    0.031    9.226    0.000
##    .SA13              0.456    0.041   11.166    0.000
##    .IS2               0.434    0.052    8.311    0.000
##    .IS3               0.555    0.064    8.670    0.000
##    .IS4               0.574    0.063    9.090    0.000
##    .Career_day_hlp    0.130    0.014    9.470    0.000
##    .Relation          0.110    0.011    9.586    0.000
##    .Cur_salar         0.342    0.073    4.660    0.000
##     ProgramQuality    1.000                           
##     FacultyAssstnc    1.000                           
##     StudentStsfctn    1.000                           
##     CurrntEmplymnt    1.000

#Model 3 Estimation and results

m2<-  'Program Quality =~ PA1+PA2+PA3+PA4+PA5+PA6+PA7+PA9+PA11+PA12
Faculty Assistance =~ SA1+SA2+SA3+SA13
Student Satisfaction =~ IS1+IS2++IS4+IS5+IS6
Current Employment =~ Career_day_help+Relation+Cur_salar'

fourfactor_1<- cfa(m2, data=df, std.lv=TRUE)
summary(fourfactor_1, fit.measures=TRUE)
## lavaan 0.6-7 ended normally after 29 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         50
##                                                       
##   Number of observations                           336
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               596.885
##   Degrees of freedom                               203
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              4083.082
##   Degrees of freedom                               231
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.898
##   Tucker-Lewis Index (TLI)                       0.884
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -8350.692
##   Loglikelihood unrestricted model (H1)      -8052.249
##                                                       
##   Akaike (AIC)                               16801.384
##   Bayesian (BIC)                             16992.239
##   Sample-size adjusted Bayesian (BIC)        16833.633
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.076
##   90 Percent confidence interval - lower         0.069
##   90 Percent confidence interval - upper         0.083
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.059
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality =~                                         
##     PA1                     0.700    0.046   15.264    0.000
##     PA2                     0.709    0.044   15.939    0.000
##     PA3                     0.693    0.045   15.377    0.000
##     PA4                     0.703    0.046   15.446    0.000
##     PA5                     0.816    0.050   16.277    0.000
##     PA6                     0.735    0.049   15.028    0.000
##     PA7                     0.768    0.047   16.516    0.000
##     PA9                     0.734    0.049   15.058    0.000
##     PA11                    0.715    0.052   13.814    0.000
##     PA12                    0.821    0.056   14.624    0.000
##   FacultyAssistance =~                                      
##     SA1                     0.801    0.045   17.719    0.000
##     SA2                     0.819    0.044   18.453    0.000
##     SA3                     0.842    0.045   18.512    0.000
##     SA13                    0.741    0.049   15.224    0.000
##   StudentSatisfaction =~                                    
##     IS1                     0.612    0.064    9.497    0.000
##     IS2                     0.622    0.055   11.373    0.000
##     IS4                     0.703    0.059   11.837    0.000
##     IS5                     0.733    0.047   15.559    0.000
##     IS6                     0.701    0.052   13.482    0.000
##   CurrentEmployment =~                                      
##     Career_day_hlp          0.347    0.027   12.678    0.000
##     Relation               -0.313    0.025  -12.525    0.000
##     Cur_salar               0.929    0.060   15.369    0.000
## 
## Covariances:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality ~~                                         
##     FacultyAssstnc          0.640    0.038   16.827    0.000
##     StudentStsfctn          0.562    0.046   12.132    0.000
##     CurrntEmplymnt          0.063    0.063    0.999    0.318
##   FacultyAssistance ~~                                      
##     StudentStsfctn          0.604    0.045   13.435    0.000
##     CurrntEmplymnt          0.047    0.064    0.732    0.464
##   StudentSatisfaction ~~                                    
##     CurrntEmplymnt          0.062    0.067    0.916    0.360
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .PA1               0.423    0.036   11.765    0.000
##    .PA2               0.378    0.033   11.587    0.000
##    .PA3               0.405    0.034   11.737    0.000
##    .PA4               0.411    0.035   11.720    0.000
##    .PA5               0.467    0.041   11.488    0.000
##    .PA6               0.489    0.041   11.821    0.000
##    .PA7               0.394    0.035   11.413    0.000
##    .PA9               0.485    0.041   11.814    0.000
##    .PA11              0.592    0.049   12.071    0.000
##    .PA12              0.662    0.056   11.911    0.000
##    .SA1               0.312    0.032    9.891    0.000
##    .SA2               0.274    0.029    9.295    0.000
##    .SA3               0.285    0.031    9.241    0.000
##    .SA13              0.457    0.041   11.198    0.000
##    .IS1               0.976    0.082   11.921    0.000
##    .IS2               0.644    0.057   11.321    0.000
##    .IS4               0.741    0.067   11.133    0.000
##    .IS5               0.340    0.039    8.604    0.000
##    .IS6               0.508    0.049   10.281    0.000
##    .Career_day_hlp    0.129    0.014    9.388    0.000
##    .Relation          0.110    0.011    9.593    0.000
##    .Cur_salar         0.349    0.073    4.778    0.000
##     ProgramQuality    1.000                           
##     FacultyAssstnc    1.000                           
##     StudentStsfctn    1.000                           
##     CurrntEmplymnt    1.000

#Model 4 Estimation and results

m3<-  'Program Quality =~ PA2+PA5+PA7+PA12
Faculty Assistance =~ SA1+SA2+SA3+SA13
Student Satisfaction =~ IS2+IS4
Current Employment =~ Career_day_help+Relation+Cur_salar'

fourfactor_2<- cfa(m3, data=df, std.lv=TRUE)
summary(fourfactor_2, fit.measures=TRUE)
## lavaan 0.6-7 ended normally after 32 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         32
##                                                       
##   Number of observations                           336
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               120.085
##   Degrees of freedom                                59
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1951.936
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.967
##   Tucker-Lewis Index (TLI)                       0.957
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4886.066
##   Loglikelihood unrestricted model (H1)      -4826.024
##                                                       
##   Akaike (AIC)                                9836.133
##   Bayesian (BIC)                              9958.280
##   Sample-size adjusted Bayesian (BIC)         9856.772
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.056
##   90 Percent confidence interval - lower         0.041
##   90 Percent confidence interval - upper         0.070
##   P-value RMSEA <= 0.05                          0.249
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.047
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality =~                                         
##     PA2                     0.652    0.048   13.586    0.000
##     PA5                     0.853    0.052   16.472    0.000
##     PA7                     0.770    0.049   15.774    0.000
##     PA12                    0.830    0.058   14.191    0.000
##   FacultyAssistance =~                                      
##     SA1                     0.800    0.045   17.668    0.000
##     SA2                     0.821    0.044   18.528    0.000
##     SA3                     0.841    0.046   18.476    0.000
##     SA13                    0.740    0.049   15.176    0.000
##   StudentSatisfaction =~                                    
##     IS2                     0.759    0.065   11.672    0.000
##     IS4                     0.787    0.070   11.215    0.000
##   CurrentEmployment =~                                      
##     Career_day_hlp          0.345    0.027   12.598    0.000
##     Relation               -0.312    0.025  -12.498    0.000
##     Cur_salar               0.934    0.061   15.428    0.000
## 
## Covariances:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality ~~                                         
##     FacultyAssstnc          0.614    0.043   14.327    0.000
##     StudentStsfctn          0.407    0.063    6.447    0.000
##     CurrntEmplymnt          0.031    0.066    0.466    0.641
##   FacultyAssistance ~~                                      
##     StudentStsfctn          0.579    0.053   10.934    0.000
##     CurrntEmplymnt          0.047    0.064    0.733    0.464
##   StudentSatisfaction ~~                                    
##     CurrntEmplymnt          0.089    0.072    1.237    0.216
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .PA2               0.456    0.042   10.827    0.000
##    .PA5               0.405    0.046    8.799    0.000
##    .PA7               0.391    0.041    9.432    0.000
##    .PA12              0.647    0.062   10.517    0.000
##    .SA1               0.314    0.032    9.881    0.000
##    .SA2               0.269    0.029    9.166    0.000
##    .SA3               0.286    0.031    9.214    0.000
##    .SA13              0.459    0.041   11.192    0.000
##    .IS2               0.454    0.077    5.918    0.000
##    .IS4               0.615    0.087    7.039    0.000
##    .Career_day_hlp    0.130    0.014    9.471    0.000
##    .Relation          0.110    0.011    9.604    0.000
##    .Cur_salar         0.340    0.074    4.627    0.000
##     ProgramQuality    1.000                           
##     FacultyAssstnc    1.000                           
##     StudentStsfctn    1.000                           
##     CurrntEmplymnt    1.000

Model 5 Estimation and results

m4<-  'Program Quality =~ PA2+PA5+PA7+PA12
Faculty Assistance =~ SA1+SA2+SA3+SA13
Student Satisfaction =~ IS2+IS3+IS4
Current Employment =~ Career_day+Cur_salar'

fourfactor_3<- cfa(m4, data=df, std.lv=TRUE)
summary(fourfactor_3, fit.measures=TRUE)
## lavaan 0.6-7 ended normally after 62 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         32
##                                                       
##   Number of observations                           336
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               130.979
##   Degrees of freedom                                59
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1869.525
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.960
##   Tucker-Lewis Index (TLI)                       0.947
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -5174.154
##   Loglikelihood unrestricted model (H1)      -5108.664
##                                                       
##   Akaike (AIC)                               10412.307
##   Bayesian (BIC)                             10534.455
##   Sample-size adjusted Bayesian (BIC)        10432.947
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.060
##   90 Percent confidence interval - lower         0.046
##   90 Percent confidence interval - upper         0.074
##   P-value RMSEA <= 0.05                          0.108
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.050
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality =~                                         
##     PA2                     0.649    0.048   13.504    0.000
##     PA5                     0.855    0.052   16.531    0.000
##     PA7                     0.769    0.049   15.730    0.000
##     PA12                    0.833    0.058   14.269    0.000
##   FacultyAssistance =~                                      
##     SA1                     0.801    0.045   17.678    0.000
##     SA2                     0.821    0.044   18.503    0.000
##     SA3                     0.840    0.046   18.428    0.000
##     SA13                    0.742    0.049   15.228    0.000
##   StudentSatisfaction =~                                    
##     IS2                     0.776    0.053   14.578    0.000
##     IS3                     0.837    0.059   14.164    0.000
##     IS4                     0.811    0.059   13.822    0.000
##   CurrentEmployment =~                                      
##     Career_day              0.252    0.114    2.219    0.026
##     Cur_salar               0.180    0.099    1.805    0.071
## 
## Covariances:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality ~~                                         
##     FacultyAssstnc          0.614    0.043   14.331    0.000
##     StudentStsfctn          0.360    0.060    6.000    0.000
##     CurrntEmplymnt          0.299    0.154    1.944    0.052
##   FacultyAssistance ~~                                      
##     StudentStsfctn          0.520    0.051   10.267    0.000
##     CurrntEmplymnt          0.285    0.148    1.928    0.054
##   StudentSatisfaction ~~                                    
##     CurrntEmplymnt          0.400    0.188    2.122    0.034
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .PA2               0.460    0.042   10.874    0.000
##    .PA5               0.402    0.046    8.758    0.000
##    .PA7               0.393    0.041    9.482    0.000
##    .PA12              0.642    0.061   10.483    0.000
##    .SA1               0.313    0.032    9.857    0.000
##    .SA2               0.270    0.029    9.168    0.000
##    .SA3               0.288    0.031    9.238    0.000
##    .SA13              0.456    0.041   11.163    0.000
##    .IS2               0.429    0.052    8.283    0.000
##    .IS3               0.559    0.064    8.784    0.000
##    .IS4               0.576    0.063    9.164    0.000
##    .Career_day        0.110    0.057    1.929    0.054
##    .Cur_salar         1.180    0.095   12.367    0.000
##     ProgramQuality    1.000                           
##     FacultyAssstnc    1.000                           
##     StudentStsfctn    1.000                           
##     CurrntEmplymnt    1.000

Model 6 Estimation and results

m5<-  'Program Quality =~ PA2+PA5+PA7+PA12
Faculty Assistance =~ SA1+SA2+SA3+SA13
Student Satisfaction =~ IS2+IS3+IS4
Current Employment =~ Relation+Cur_salar'

fourfactor_4<- cfa(m5, data=df, std.lv=TRUE)
summary(fourfactor_4, fit.measures=TRUE)
## lavaan 0.6-7 ended normally after 56 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         32
##                                                       
##   Number of observations                           336
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                               132.930
##   Degrees of freedom                                59
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1987.909
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.961
##   Tucker-Lewis Index (TLI)                       0.949
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -5146.374
##   Loglikelihood unrestricted model (H1)      -5079.909
##                                                       
##   Akaike (AIC)                               10356.749
##   Bayesian (BIC)                             10478.896
##   Sample-size adjusted Bayesian (BIC)        10377.389
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.061
##   90 Percent confidence interval - lower         0.047
##   90 Percent confidence interval - upper         0.075
##   P-value RMSEA <= 0.05                          0.091
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.050
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality =~                                         
##     PA2                     0.652    0.048   13.588    0.000
##     PA5                     0.853    0.052   16.465    0.000
##     PA7                     0.770    0.049   15.762    0.000
##     PA12                    0.831    0.058   14.204    0.000
##   FacultyAssistance =~                                      
##     SA1                     0.801    0.045   17.683    0.000
##     SA2                     0.820    0.044   18.486    0.000
##     SA3                     0.840    0.046   18.435    0.000
##     SA13                    0.742    0.049   15.231    0.000
##   StudentSatisfaction =~                                    
##     IS2                     0.773    0.053   14.473    0.000
##     IS3                     0.840    0.059   14.202    0.000
##     IS4                     0.812    0.059   13.810    0.000
##   CurrentEmployment =~                                      
##     Relation                0.351    0.122    2.875    0.004
##     Cur_salar              -0.832    0.290   -2.873    0.004
## 
## Covariances:
##                          Estimate  Std.Err  z-value  P(>|z|)
##   ProgramQuality ~~                                         
##     FacultyAssstnc          0.614    0.043   14.342    0.000
##     StudentStsfctn          0.359    0.060    5.978    0.000
##     CurrntEmplymnt          0.022    0.069    0.316    0.752
##   FacultyAssistance ~~                                      
##     StudentStsfctn          0.519    0.051   10.243    0.000
##     CurrntEmplymnt         -0.007    0.067   -0.097    0.923
##   StudentSatisfaction ~~                                    
##     CurrntEmplymnt         -0.093    0.071   -1.302    0.193
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .PA2               0.456    0.042   10.825    0.000
##    .PA5               0.406    0.046    8.803    0.000
##    .PA7               0.391    0.041    9.439    0.000
##    .PA12              0.646    0.062   10.508    0.000
##    .SA1               0.313    0.032    9.851    0.000
##    .SA2               0.271    0.030    9.182    0.000
##    .SA3               0.288    0.031    9.229    0.000
##    .SA13              0.456    0.041   11.161    0.000
##    .IS2               0.434    0.052    8.323    0.000
##    .IS3               0.553    0.064    8.659    0.000
##    .IS4               0.575    0.063    9.110    0.000
##    .Relation          0.085    0.085    1.004    0.315
##    .Cur_salar         0.521    0.476    1.094    0.274
##     ProgramQuality    1.000                           
##     FacultyAssstnc    1.000                           
##     StudentStsfctn    1.000                           
##     CurrntEmplymnt    1.000
semPaths(fourfactor_4, intercept = FALSE, whatLabel = "est", residuals = FALSE, exoCov = FALSE, layout = 'tree')