Aja Murray
## item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
## item1 0.98 0.56 0.47 0.44 0.59 -0.01 0.09 0.06 0.10 0.05
## item2 0.56 1.00 0.53 0.52 0.67 0.01 0.10 0.06 0.11 0.06
## item3 0.47 0.53 0.98 0.46 0.58 0.04 0.09 0.04 0.10 0.02
## item4 0.44 0.52 0.46 1.00 0.56 0.04 0.10 0.04 0.11 0.06
## item5 0.59 0.67 0.58 0.56 1.01 0.01 0.08 0.04 0.08 0.04
## item6 -0.01 0.01 0.04 0.04 0.01 1.03 0.58 0.60 0.43 0.45
## item7 0.09 0.10 0.09 0.10 0.08 0.58 0.98 0.81 0.58 0.60
## item8 0.06 0.06 0.04 0.04 0.04 0.60 0.81 1.02 0.61 0.64
## item9 0.10 0.11 0.10 0.11 0.08 0.43 0.58 0.61 0.98 0.45
## item10 0.05 0.06 0.02 0.06 0.04 0.45 0.60 0.64 0.45 1.01
Welcome back!
The answer to the quiz question is…
To ensure model identification, we need to know the number of knowns
We can calculate the knowns by:
\[ \frac{\left(k+1 \right)\left(k \right)}{2} \]
where k is the number of observed variables.
## V1 V2 V3
## V1 1.05 0.33 0.42
## V2 0.33 1.03 0.65
## V3 0.42 0.65 1.01
#step 1: specify the model
model<-'LV=~V1+V2+V3+V4'
# we write the model using lavaan syntax enclosed in single quote marks
#step2: estimate the model
model.est<-cfa(model=model, data=df)
# 'model= ' refers to a lavaan syntax object with the model specification
# 'data= ' gives name of the dataframe in which to find the variables
#step3: inspect the results
summary(model.est)
# the summary function shows us output from a fitted model
## lavaan 0.6-5 ended normally after 23 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 21
##
## Number of observations 1000
##
## Model Test User Model:
##
## Test statistic 41.739
## Degrees of freedom 34
## P-value (Chi-square) 0.170
##
## Model Test Baseline Model:
##
## Test statistic 4711.354
## Degrees of freedom 45
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.998
## Tucker-Lewis Index (TLI) 0.998
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -11838.328
## Loglikelihood unrestricted model (H1) -11817.459
##
## Akaike (AIC) 23718.657
## Bayesian (BIC) 23821.720
## Sample-size adjusted Bayesian (BIC) 23755.023
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.015
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.029
## P-value RMSEA <= 0.05 1.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.024
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## Pagg =~
## item1 0.695 0.029 24.157 0.000
## item2 0.792 0.028 28.463 0.000
## item3 0.678 0.029 23.387 0.000
## item4 0.656 0.030 22.003 0.000
## item5 0.850 0.027 31.231 0.000
## Vagg =~
## item6 0.652 0.030 21.967 0.000
## item7 0.873 0.025 34.276 0.000
## item8 0.922 0.025 36.289 0.000
## item9 0.662 0.029 23.157 0.000
## item10 0.691 0.029 24.006 0.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## Pagg ~~
## Vagg 0.098 0.035 2.792 0.005
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .item1 0.491 0.026 19.051 0.000
## .item2 0.369 0.022 16.488 0.000
## .item3 0.515 0.027 19.360 0.000
## .item4 0.572 0.029 19.844 0.000
## .item5 0.286 0.021 13.748 0.000
## .item6 0.605 0.029 20.891 0.000
## .item7 0.219 0.016 13.978 0.000
## .item8 0.168 0.015 10.988 0.000
## .item9 0.541 0.026 20.657 0.000
## .item10 0.532 0.026 20.469 0.000
## Pagg 1.000
## Vagg 1.000
## lhs op rhs mi epc sepc.lv sepc.all sepc.nox
## 26 Pagg =~ item8 7.281 -0.051 -0.051 -0.051 -0.051
## 27 Pagg =~ item9 7.099 0.069 0.069 0.070 0.070
## 25 Pagg =~ item7 6.654 0.050 0.050 0.050 0.050
## 38 item1 ~~ item6 5.283 -0.044 -0.044 -0.080 -0.080
## 61 item4 ~~ item8 4.760 -0.030 -0.030 -0.096 -0.096
## 24 Pagg =~ item6 3.288 -0.050 -0.050 -0.049 -0.049
## 57 item3 ~~ item10 2.572 -0.029 -0.029 -0.056 -0.056
## 60 item4 ~~ item7 2.231 0.021 0.021 0.059 0.059
## 33 Vagg =~ item5 2.018 -0.032 -0.032 -0.032 -0.032
## 36 item1 ~~ item4 1.997 -0.028 -0.028 -0.054 -0.054
## 53 item3 ~~ item6 1.701 0.025 0.025 0.045 0.045
## 40 item1 ~~ item8 1.513 0.016 0.016 0.055 0.055
## 62 item4 ~~ item9 1.427 0.023 0.023 0.041 0.041
## 46 item2 ~~ item6 1.333 -0.020 -0.020 -0.043 -0.043
## 56 item3 ~~ item9 1.290 0.021 0.021 0.040 0.040
## 69 item6 ~~ item7 1.050 0.017 0.017 0.046 0.046
## 59 item4 ~~ item6 0.929 0.019 0.019 0.033 0.033
## 49 item2 ~~ item9 0.816 0.015 0.015 0.033 0.033
## 47 item2 ~~ item7 0.815 0.011 0.011 0.038 0.038
## 70 item6 ~~ item8 0.760 -0.015 -0.015 -0.046 -0.046
## 55 item3 ~~ item8 0.730 -0.011 -0.011 -0.038 -0.038
## 34 item1 ~~ item2 0.698 0.016 0.016 0.038 0.038
## 77 item8 ~~ item10 0.678 0.014 0.014 0.046 0.046
## 32 Vagg =~ item4 0.642 0.021 0.021 0.021 0.021
## 51 item3 ~~ item4 0.615 0.016 0.016 0.029 0.029
## 67 item5 ~~ item9 0.611 -0.012 -0.012 -0.031 -0.031
## 75 item7 ~~ item10 0.538 -0.012 -0.012 -0.035 -0.035
## 48 item2 ~~ item8 0.524 -0.008 -0.008 -0.034 -0.034
## 54 item3 ~~ item7 0.503 0.009 0.009 0.028 0.028
## 45 item2 ~~ item5 0.294 -0.012 -0.012 -0.036 -0.036
## 76 item8 ~~ item9 0.275 0.009 0.009 0.028 0.028
## 41 item1 ~~ item9 0.262 0.009 0.009 0.018 0.018
## 43 item2 ~~ item3 0.246 -0.010 -0.010 -0.022 -0.022
## 30 Vagg =~ item2 0.229 0.011 0.011 0.011 0.011
## 50 item2 ~~ item10 0.214 0.008 0.008 0.017 0.017
## 37 item1 ~~ item5 0.182 0.008 0.008 0.023 0.023
## 29 Vagg =~ item1 0.164 0.010 0.010 0.010 0.010
## 28 Pagg =~ item10 0.161 -0.010 -0.010 -0.010 -0.010
## 74 item7 ~~ item9 0.133 -0.006 -0.006 -0.017 -0.017
## 63 item4 ~~ item10 0.123 0.007 0.007 0.012 0.012
## 78 item9 ~~ item10 0.107 -0.006 -0.006 -0.011 -0.011
## 65 item5 ~~ item7 0.094 -0.004 -0.004 -0.014 -0.014
## 58 item4 ~~ item5 0.076 0.005 0.005 0.013 0.013
## 31 Vagg =~ item3 0.065 0.007 0.007 0.007 0.007
## 35 item1 ~~ item3 0.055 -0.005 -0.005 -0.009 -0.009
## 71 item6 ~~ item9 0.053 -0.005 -0.005 -0.008 -0.008
## 68 item5 ~~ item10 0.051 0.004 0.004 0.009 0.009
## 72 item6 ~~ item10 0.048 0.004 0.004 0.008 0.008
## 44 item2 ~~ item4 0.038 0.004 0.004 0.008 0.008
## 73 item7 ~~ item8 0.034 -0.004 -0.004 -0.022 -0.022
## 64 item5 ~~ item6 0.021 -0.002 -0.002 -0.006 -0.006
## 66 item5 ~~ item8 0.020 -0.002 -0.002 -0.007 -0.007
## 39 item1 ~~ item7 0.020 -0.002 -0.002 -0.006 -0.006
## 42 item1 ~~ item10 0.005 -0.001 -0.001 -0.003 -0.003
## 52 item3 ~~ item5 0.003 0.001 0.001 0.003 0.003
## lavaan 0.6-5 ended normally after 23 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 21
##
## Number of observations 1000
##
## Model Test User Model:
##
## Test statistic 41.739
## Degrees of freedom 34
## P-value (Chi-square) 0.170
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Pagg =~
## item1 0.695 0.029 24.157 0.000 0.695 0.704
## item2 0.792 0.028 28.463 0.000 0.792 0.793
## item3 0.678 0.029 23.387 0.000 0.678 0.687
## item4 0.656 0.030 22.003 0.000 0.656 0.655
## item5 0.850 0.027 31.231 0.000 0.850 0.846
## Vagg =~
## item6 0.652 0.030 21.967 0.000 0.652 0.642
## item7 0.873 0.025 34.276 0.000 0.873 0.881
## item8 0.922 0.025 36.289 0.000 0.922 0.914
## item9 0.662 0.029 23.157 0.000 0.662 0.669
## item10 0.691 0.029 24.006 0.000 0.691 0.688
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Pagg ~~
## Vagg 0.098 0.035 2.792 0.005 0.098 0.098
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item1 0.491 0.026 19.051 0.000 0.491 0.504
## .item2 0.369 0.022 16.488 0.000 0.369 0.371
## .item3 0.515 0.027 19.360 0.000 0.515 0.528
## .item4 0.572 0.029 19.844 0.000 0.572 0.570
## .item5 0.286 0.021 13.748 0.000 0.286 0.284
## .item6 0.605 0.029 20.891 0.000 0.605 0.588
## .item7 0.219 0.016 13.978 0.000 0.219 0.223
## .item8 0.168 0.015 10.988 0.000 0.168 0.165
## .item9 0.541 0.026 20.657 0.000 0.541 0.552
## .item10 0.532 0.026 20.469 0.000 0.532 0.527
## Pagg 1.000 1.000 1.000
## Vagg 1.000 1.000 1.000
CFA involves testing a hypothesised factor structure