Marco Lico
Marco Lico

Reputation: 23

running CFA in lavaan - displaying correlation between latent variables

I have run a Confirmatory Factor Analysis and I now would like to apply the Fornell/Larcker Criterion. For doing so, I need the correlation between the latent variables. How can I display/retrieve the correlation between the latent variables?

I have tried the following commands generating an output:

But none of these commands generates a "phi" (covariance between latent variables. Thus, I have two questions:

1) So, does anyone know how to display latent variables of a confirmatory factor analysis in r?

2) Take a look at the output of lavInspect(fit,"standardized") (see the link at the bottom of the text). Instead of a "phi" it generates a "$psi". Does that "psi" may be a "phi"? Because the matrix it generates looks like a correlation matrix

Here is the code:

#packages
library(lavaan)
library(readr)

CNCS<- read_delim("Desktop/20190703 Full Launch/Regressionen/Factor analysis/CNCS -47 Reversed.csv",
       ";", escape_double = FALSE, trim_ws = TRUE)

View(CNCS)
library(carData)
library(car)

CNCS.model <-

'AttitudeTowardsTheDeal =~ Q42_1 + Q42_2 + Q42_3

SubjectiveNormsImportance =~ Q43_r1 + Q43_r2 + Q43_r3 + Q43_r4

SubjectiveNormsFavour =~ Q44_r1 + Q44_r2 + Q44_r3 + Q44_r4

EaseOfPurchasing =~ Q45_r1 + Q45_r2 + Q45_r3 + Q45_r4 + Q45_r5 + Q45_r6

SE =~ Q3_r1 + Q3_r2 + Q3_r3 + Q4_r4

Consumer Innovativeness =~ Q4_r1 + Q4_r2 + Q4_r3 + Q4_r4 + Q4_r5

Purchase Intention =~ Q41moeglich_1 + Q41gewiss_1 + Q1wahrscheinlich_1 + Q41vorauss_1'


fit <- cfa(CNCS.model, data=CNCS)
summary(fit, fit.measures=TRUE)
lavInspect(fit,"standardized")
standardizedSolution(fit)

Partial OUTPUT of lavInspect(fit,"standardized")

Please follow the link to the screenshot of the partial output of lavInspect()

Upvotes: 2

Views: 3675

Answers (1)

Tom
Tom

Reputation: 1138

Take the cfa example given in the manual as

library(lavaan)
## The famous Holzinger and Swineford (1939) example
HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '

fit <- cfa(HS.model, data=HolzingerSwineford1939)

and include the standardized fit in the summary with

summary(fit, standardized = TRUE)

obtaining

...

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  visual =~                                                             
    x1                1.000                               0.900    0.772
    x2                0.554    0.100    5.554    0.000    0.498    0.424
    x3                0.729    0.109    6.685    0.000    0.656    0.581
  textual =~                                                            
    x4                1.000                               0.990    0.852
    x5                1.113    0.065   17.014    0.000    1.102    0.855
    x6                0.926    0.055   16.703    0.000    0.917    0.838
  speed =~                                                              
    x7                1.000                               0.619    0.570
    x8                1.180    0.165    7.152    0.000    0.731    0.723
    x9                1.082    0.151    7.155    0.000    0.670    0.665

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  visual ~~                                                             
    textual           0.408    0.074    5.552    0.000    0.459    0.459
    speed             0.262    0.056    4.660    0.000    0.471    0.471
  textual ~~                                                            
    speed             0.173    0.049    3.518    0.000    0.283    0.283

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .x1                0.549    0.114    4.833    0.000    0.549    0.404
   .x2                1.134    0.102   11.146    0.000    1.134    0.821
   .x3                0.844    0.091    9.317    0.000    0.844    0.662
   .x4                0.371    0.048    7.779    0.000    0.371    0.275
   .x5                0.446    0.058    7.642    0.000    0.446    0.269
   .x6                0.356    0.043    8.277    0.000    0.356    0.298
   .x7                0.799    0.081    9.823    0.000    0.799    0.676
   .x8                0.488    0.074    6.573    0.000    0.488    0.477
   .x9                0.566    0.071    8.003    0.000    0.566    0.558
    visual            0.809    0.145    5.564    0.000    1.000    1.000
    textual           0.979    0.112    8.737    0.000    1.000    1.000
    speed             0.384    0.086    4.451    0.000    1.000    1.000

You find the entries of the covariance matrix in the Covariances: and Variances: sections respectively in column Estimate and the entries of the correlation matrix in column Std.lv.

Note that inspect or rather lavInspect provides the argument what which by default is specified with "free". Taken from the manual, the three relevant other options are

  • "est": A list of model matrices. The values represent the estimated model parameters. Aliases: "estimates", and "x".

  • "std": A list of model matrices. The values represent the (completely) standardized model parameters (the variances of both the observed and the latent variables are set to unity). Aliases: "std.all", "standardized".

  • "std.lv": A list of model matrices. The values represent the standardized model parameters (only the variances of the latent variables are set to unity.)

which refer to the summary columns Estimate Std.lv and Std.all. Further try the following line

cov2cor(lavInspect(fit, what = "est")$psi)

In case of any remaining doubt, I recommend you consult the tutorial, the packages support infrastructure or the homepage.

Upvotes: 3

Related Questions