# Constructing latent variables in SEM

I need to extract results from a SEM, but I'm struggling to read the results using lavaan package in R. More specifically, I have 3 latent variables and would like to know how can i reconstruct them using the results from the SEM. Below you can find my model:

sem_model_100 <- '
Att_x       =~ ATT_good_100 + ATT_important_100 + self_1_100 + self_2_100 + ATT_useful_100        #  + satis_2_100
PBC_x       =~ PBC_time_100 + PBC_space_100 + ATT_pleasant_100 + ATT_hygenic_100 #+ satis_3_100   # + satis_1_100
Soc_x       =~ MN_friend_100 + MN_colleg_100 + MN_family_100 + MN_media_100 #+satis_4_100

#Covariances
self_1_100  ~~  ATT_pleasant_100
self_1_100  ~~ Intention_100
self_1_100  ~~ self_2_100

# Regresion - Structural
Intention_100   ~ Att_x + PBC_x + Soc_x
beh_avg     ~ Intention_100 + PBC_x   + PANT + dist_org
'



Here are the results of my regression and the standardized solution.

summary(fit.factors_4,  rsquare = TRUE, standardized = TRUE, fit.measures = TRUE)
lavaan 0.6-12 ended normally after 172 iterations

Estimator                                         ML
Optimization method                           NLMINB
Number of model parameters                        56

Number of observations                           110

Model Test User Model:
Standard      Robust
Test Statistic                               146.049     143.819
Degrees of freedom                               109         109
P-value (Chi-square)                           0.010       0.014
Scaling correction factor                                  1.016
Satorra-Bentler correction

Model Test Baseline Model:

Test statistic                               667.874     490.248
Degrees of freedom                               135         135
P-value                                        0.000       0.000
Scaling correction factor                                  1.362

User Model versus Baseline Model:

Comparative Fit Index (CFI)                    0.930       0.902
Tucker-Lewis Index (TLI)                       0.914       0.879

Robust Comparative Fit Index (CFI)                         0.927
Robust Tucker-Lewis Index (TLI)                            0.910

Loglikelihood and Information Criteria:

Loglikelihood user model (H0)              -7168.644   -7168.644
Loglikelihood unrestricted model (H1)      -7095.619   -7095.619

Akaike (AIC)                               14449.287   14449.287
Bayesian (BIC)                             14600.514   14600.514
Sample-size adjusted Bayesian (BIC)        14423.552   14423.552

Root Mean Square Error of Approximation:

RMSEA                                          0.056       0.054
90 Percent confidence interval - lower         0.028       0.026
90 Percent confidence interval - upper         0.078       0.076
P-value RMSEA <= 0.05                          0.337       0.380

Robust RMSEA                                               0.054
90 Percent confidence interval - lower                     0.026
90 Percent confidence interval - upper                     0.077

Standardized Root Mean Square Residual:

SRMR                                           0.084       0.084

Parameter Estimates:

Standard errors                           Robust.sem
Information                                 Expected
Information saturated (h1) model          Structured

Latent Variables:
Estimate   Std.Err  z-value  P(>|z|)   Std.lv   Std.all
Att_x =~
ATT_good_100      12.621    3.091    4.083    0.000    12.621    0.876
ATT_mprtnt_100    12.758    3.120    4.090    0.000    12.758    0.802
self_1_100         8.265    3.475    2.379    0.017     8.265    0.454
self_2_100         9.192    3.131    2.935    0.003     9.192    0.444
ATT_useful_100    -8.263    1.215   -6.801    0.000    -8.263   -0.498
PBC_x =~
PBC_time_100      21.448    2.904    7.384    0.000    21.448    0.789
PBC_space_100     18.144    2.437    7.444    0.000    18.144    0.650
ATT_plesnt_100    11.252    2.420    4.649    0.000    11.252    0.485
ATT_hygenc_100   -10.718    2.715   -3.947    0.000   -10.718   -0.399
Soc_x =~
MN_friend_100     25.834    1.844   14.007    0.000    25.834    0.935
MN_colleg_100     25.054    2.140   11.706    0.000    25.054    0.849
MN_family_100     19.312    2.646    7.298    0.000    19.312    0.624
MN_media_100      16.129    2.373    6.796    0.000    16.129    0.599

Regressions:
Estimate   Std.Err  z-value  P(>|z|)   Std.lv   Std.all
Intention_100 ~
Att_x              1.119    1.164    0.961    0.336     1.119    0.062
PBC_x              4.216    1.706    2.471    0.013     4.216    0.234
Soc_x              3.673    2.069    1.775    0.076     3.673    0.204
beh_avg ~
Intention_100      0.118    0.077    1.529    0.126     0.118    0.145
PBC_x              3.406    1.522    2.238    0.025     3.406    0.233
PANT              17.226    4.268    4.036    0.000    17.226    0.415
dist_org          -0.029    0.010   -3.064    0.002    -0.029   -0.304


Here the standardized solution


> standardizedsolution(fit.factors_4, type = "std.all",
+                      se = TRUE, zstat = TRUE, pvalue = TRUE, ci = TRUE)%>%
+   filter(op == "~" | op == "=~") %>%
+   select(LV=lhs, Item=rhs, Coefficient=est.std, ci.lower,
+          ci.upper, SE=se, Z=z, 'p-value'=pvalue)
LV              Item Coefficient ci.lower ci.upper    SE      Z p.value
1          Att_x      ATT_good_100       0.876    0.730    1.021 0.074 11.807   0.000
2          Att_x ATT_important_100       0.802    0.632    0.971 0.086  9.278   0.000
3          Att_x        self_1_100       0.454    0.138    0.770 0.161  2.815   0.005
4          Att_x        self_2_100       0.444    0.179    0.709 0.135  3.285   0.001
5          Att_x    ATT_useful_100      -0.498   -0.708   -0.288 0.107 -4.654   0.000
6          PBC_x      PBC_time_100       0.789    0.631    0.947 0.081  9.796   0.000
7          PBC_x     PBC_space_100       0.650    0.503    0.797 0.075  8.650   0.000
8          PBC_x  ATT_pleasant_100       0.485    0.300    0.670 0.095  5.129   0.000
9          PBC_x   ATT_hygenic_100      -0.399   -0.588   -0.210 0.096 -4.141   0.000
10         Soc_x     MN_friend_100       0.935    0.871    0.999 0.032 28.802   0.000
11         Soc_x     MN_colleg_100       0.849    0.744    0.954 0.053 15.876   0.000
12         Soc_x     MN_family_100       0.624    0.477    0.771 0.075  8.323   0.000
13         Soc_x      MN_media_100       0.599    0.446    0.753 0.078  7.650   0.000
14 Intention_100             Att_x       0.062   -0.069    0.194 0.067  0.926   0.355
15 Intention_100             PBC_x       0.234    0.005    0.464 0.117  2.001   0.045
16 Intention_100             Soc_x       0.204    0.026    0.383 0.091  2.242   0.025
17       beh_avg     Intention_100       0.145   -0.002    0.293 0.075  1.929   0.054
18       beh_avg             PBC_x       0.233    0.024    0.441 0.106  2.190   0.029
19       beh_avg              PANT       0.415    0.247    0.582 0.086  4.843   0.000
20       beh_avg          dist_org      -0.304   -0.495   -0.113 0.097 -3.122   0.002


How can I calculate Att_x, PBC_x, Soc_x and beh_avg?

Keep in mind that you should never use the extracted factors in an analysis with the same data set (because you would be over-fitting). But if you want to visualize them, or extract them from a different data set...I agree with @jeremy-miles that lavPredict() is the way. If you want to understand lavPredict() when it's run on a simple cfa model, you can run summary() on your data without any standardization, and then take the estimates, intercepts, and variances from the model fit. The output of lavPredict() will be a rescaled version of: sum((Variable - intercepts)/variances*estimates).