Skip to contents

This function obtained the factor scores, standard errors, loading matrix, and variance covariance matrix by calling the lavaan::lavPredict() function.

Usage

augment_lav_predict(
  lavobj,
  method = c("regression", "Bartlett"),
  drop_list_single = TRUE,
  ...
)

Arguments

lavobj

A fitted lavaan::lavaan object

method

A character string indicating the scoring method to use. Must be either "regression" or "Bartlett".

drop_list_single

logical. Should the results be unlisted for single-group models?

...

Additional arguments passed to lavaan::lavPredict()

Value

A data.frame containing the factor scores, the corresponding standard errors, the loadings and cross-loadings of the factor scores as indicators of the latent variables, the error variance-covariance matrix of the factor scores, and the measurement intercepts. In addition, three character matrices are added as attributes that can be used as input to tspa_mx_model():

  • ld: cross-loading matrix

  • ev: error variance-covariance matrix

  • int: measurement intercepts

Examples

library(lavaan)
#> This is lavaan 0.6-18
#> lavaan is FREE software! Please report any bugs.
hs_model <- ' visual  =~ x1 + x2 + x3 '
fit <- cfa(hs_model,
           data = HolzingerSwineford1939,
           group = "school")
augment_lav_predict(fit)
#> $Pasteur
#>        fs_visual se_fs_visual visual_by_fs_visual ev_fs_visual int_fs_visual
#> 1   -0.821165191    0.3391326           0.6734826    0.1150109             0
#> 2   -0.124009418    0.3391326           0.6734826    0.1150109             0
#> 3   -0.370072089    0.3391326           0.6734826    0.1150109             0
#> 4    0.440928618    0.3391326           0.6734826    0.1150109             0
#> 5   -0.691389016    0.3391326           0.6734826    0.1150109             0
#> 6   -0.110032619    0.3391326           0.6734826    0.1150109             0
#> 7   -0.904127845    0.3391326           0.6734826    0.1150109             0
#> 8   -0.031747573    0.3391326           0.6734826    0.1150109             0
#> 9   -0.439478981    0.3391326           0.6734826    0.1150109             0
#> 10  -0.938939050    0.3391326           0.6734826    0.1150109             0
#> 11  -0.436821880    0.3391326           0.6734826    0.1150109             0
#> 12   0.305033497    0.3391326           0.6734826    0.1150109             0
#> 13   0.522076263    0.3391326           0.6734826    0.1150109             0
#> 14  -0.090367931    0.3391326           0.6734826    0.1150109             0
#> 15   0.526276771    0.3391326           0.6734826    0.1150109             0
#> 16  -0.226580678    0.3391326           0.6734826    0.1150109             0
#> 17  -0.582016192    0.3391326           0.6734826    0.1150109             0
#> 18   0.017040431    0.3391326           0.6734826    0.1150109             0
#> 19   0.563052459    0.3391326           0.6734826    0.1150109             0
#> 20   0.746621910    0.3391326           0.6734826    0.1150109             0
#> 21   0.234672405    0.3391326           0.6734826    0.1150109             0
#> 22   1.157487518    0.3391326           0.6734826    0.1150109             0
#> 23  -0.162272449    0.3391326           0.6734826    0.1150109             0
#> 24  -0.556027059    0.3391326           0.6734826    0.1150109             0
#> 25  -0.321443540    0.3391326           0.6734826    0.1150109             0
#> 26   0.153141050    0.3391326           0.6734826    0.1150109             0
#> 27   0.696234416    0.3391326           0.6734826    0.1150109             0
#> 28  -0.020961039    0.3391326           0.6734826    0.1150109             0
#> 29   0.532601236    0.3391326           0.6734826    0.1150109             0
#> 30  -0.727687585    0.3391326           0.6734826    0.1150109             0
#> 31  -0.676719580    0.3391326           0.6734826    0.1150109             0
#> 32  -1.120216393    0.3391326           0.6734826    0.1150109             0
#> 33  -0.313631732    0.3391326           0.6734826    0.1150109             0
#> 34  -0.187091845    0.3391326           0.6734826    0.1150109             0
#> 35  -0.887709484    0.3391326           0.6734826    0.1150109             0
#> 36  -0.760795908    0.3391326           0.6734826    0.1150109             0
#> 37   0.556943532    0.3391326           0.6734826    0.1150109             0
#> 38  -0.458666570    0.3391326           0.6734826    0.1150109             0
#> 39   0.514741536    0.3391326           0.6734826    0.1150109             0
#> 40   0.373009089    0.3391326           0.6734826    0.1150109             0
#> 41  -0.528550562    0.3391326           0.6734826    0.1150109             0
#> 42  -0.865864795    0.3391326           0.6734826    0.1150109             0
#> 43  -1.182344640    0.3391326           0.6734826    0.1150109             0
#> 44  -0.435334517    0.3391326           0.6734826    0.1150109             0
#> 45   0.306520860    0.3391326           0.6734826    0.1150109             0
#> 46   0.821604565    0.3391326           0.6734826    0.1150109             0
#> 47   1.213927875    0.3391326           0.6734826    0.1150109             0
#> 48  -0.851887996    0.3391326           0.6734826    0.1150109             0
#> 49  -0.085053749    0.3391326           0.6734826    0.1150109             0
#> 50  -0.508885873    0.3391326           0.6734826    0.1150109             0
#> 51   0.502467638    0.3391326           0.6734826    0.1150109             0
#> 52   0.284732253    0.3391326           0.6734826    0.1150109             0
#> 53   0.202677755    0.3391326           0.6734826    0.1150109             0
#> 54  -0.335953502    0.3391326           0.6734826    0.1150109             0
#> 55   0.556410369    0.3391326           0.6734826    0.1150109             0
#> 56  -0.058746970    0.3391326           0.6734826    0.1150109             0
#> 57  -0.066932487    0.3391326           0.6734826    0.1150109             0
#> 58   0.554230368    0.3391326           0.6734826    0.1150109             0
#> 59  -0.321761185    0.3391326           0.6734826    0.1150109             0
#> 60  -0.421834819    0.3391326           0.6734826    0.1150109             0
#> 61   0.345476529    0.3391326           0.6734826    0.1150109             0
#> 62   0.194809883    0.3391326           0.6734826    0.1150109             0
#> 63  -0.207870208    0.3391326           0.6734826    0.1150109             0
#> 64  -0.441658981    0.3391326           0.6734826    0.1150109             0
#> 65   0.102070958    0.3391326           0.6734826    0.1150109             0
#> 66   0.311198487    0.3391326           0.6734826    0.1150109             0
#> 67   0.676364229    0.3391326           0.6734826    0.1150109             0
#> 68   0.297858262    0.3391326           0.6734826    0.1150109             0
#> 69  -1.055487128    0.3391326           0.6734826    0.1150109             0
#> 70  -0.737997019    0.3391326           0.6734826    0.1150109             0
#> 71  -1.576099236    0.3391326           0.6734826    0.1150109             0
#> 72   0.534360181    0.3391326           0.6734826    0.1150109             0
#> 73  -0.105888156    0.3391326           0.6734826    0.1150109             0
#> 74   0.266237302    0.3391326           0.6734826    0.1150109             0
#> 75  -0.352427927    0.3391326           0.6734826    0.1150109             0
#> 76  -0.334783784    0.3391326           0.6734826    0.1150109             0
#> 77   0.133588508    0.3391326           0.6734826    0.1150109             0
#> 78  -1.035662965    0.3391326           0.6734826    0.1150109             0
#> 79   0.762507108    0.3391326           0.6734826    0.1150109             0
#> 80  -0.260699265    0.3391326           0.6734826    0.1150109             0
#> 81  -0.329095893    0.3391326           0.6734826    0.1150109             0
#> 82   0.752413211    0.3391326           0.6734826    0.1150109             0
#> 83   0.149268188    0.3391326           0.6734826    0.1150109             0
#> 84  -0.208880471    0.3391326           0.6734826    0.1150109             0
#> 85  -1.078285998    0.3391326           0.6734826    0.1150109             0
#> 86   0.306043760    0.3391326           0.6734826    0.1150109             0
#> 87   0.349677056    0.3391326           0.6734826    0.1150109             0
#> 88   0.165686549    0.3391326           0.6734826    0.1150109             0
#> 89   0.077307606    0.3391326           0.6734826    0.1150109             0
#> 90  -0.077401396    0.3391326           0.6734826    0.1150109             0
#> 91  -0.081863485    0.3391326           0.6734826    0.1150109             0
#> 92   0.106748566    0.3391326           0.6734826    0.1150109             0
#> 93  -0.211593616    0.3391326           0.6734826    0.1150109             0
#> 94  -0.926665153    0.3391326           0.6734826    0.1150109             0
#> 95  -0.739484382    0.3391326           0.6734826    0.1150109             0
#> 96   0.570387167    0.3391326           0.6734826    0.1150109             0
#> 97  -0.913642554    0.3391326           0.6734826    0.1150109             0
#> 98   0.547484887    0.3391326           0.6734826    0.1150109             0
#> 99  -0.602850599    0.3391326           0.6734826    0.1150109             0
#> 100  0.225794270    0.3391326           0.6734826    0.1150109             0
#> 101  0.620447015    0.3391326           0.6734826    0.1150109             0
#> 102  0.158885005    0.3391326           0.6734826    0.1150109             0
#> 103 -0.127938344    0.3391326           0.6734826    0.1150109             0
#> 104 -0.420347455    0.3391326           0.6734826    0.1150109             0
#> 105  1.327978307    0.3391326           0.6734826    0.1150109             0
#> 106  0.181843348    0.3391326           0.6734826    0.1150109             0
#> 107 -0.148932224    0.3391326           0.6734826    0.1150109             0
#> 108  0.612373626    0.3391326           0.6734826    0.1150109             0
#> 109 -0.066558798    0.3391326           0.6734826    0.1150109             0
#> 110 -0.420880619    0.3391326           0.6734826    0.1150109             0
#> 111  1.127036295    0.3391326           0.6734826    0.1150109             0
#> 112  0.237591068    0.3391326           0.6734826    0.1150109             0
#> 113  0.853758689    0.3391326           0.6734826    0.1150109             0
#> 114 -0.143618023    0.3391326           0.6734826    0.1150109             0
#> 115  0.475206679    0.3391326           0.6734826    0.1150109             0
#> 116 -0.670554590    0.3391326           0.6734826    0.1150109             0
#> 117  0.022672257    0.3391326           0.6734826    0.1150109             0
#> 118  0.302002707    0.3391326           0.6734826    0.1150109             0
#> 119  0.151392125    0.3391326           0.6734826    0.1150109             0
#> 120 -0.475300449    0.3391326           0.6734826    0.1150109             0
#> 121 -0.346740056    0.3391326           0.6734826    0.1150109             0
#> 122 -0.078888759    0.3391326           0.6734826    0.1150109             0
#> 123  1.197237913    0.3391326           0.6734826    0.1150109             0
#> 124  0.539243306    0.3391326           0.6734826    0.1150109             0
#> 125  0.867258388    0.3391326           0.6734826    0.1150109             0
#> 126  0.592287901    0.3391326           0.6734826    0.1150109             0
#> 127 -0.500540901    0.3391326           0.6734826    0.1150109             0
#> 128 -0.361193954    0.3391326           0.6734826    0.1150109             0
#> 129  0.626883588    0.3391326           0.6734826    0.1150109             0
#> 130 -0.437514518    0.3391326           0.6734826    0.1150109             0
#> 131  0.695972854    0.3391326           0.6734826    0.1150109             0
#> 132  0.424715775    0.3391326           0.6734826    0.1150109             0
#> 133 -0.203725744    0.3391326           0.6734826    0.1150109             0
#> 134 -0.441499507    0.3391326           0.6734826    0.1150109             0
#> 135  0.735619838    0.3391326           0.6734826    0.1150109             0
#> 136  0.783874697    0.3391326           0.6734826    0.1150109             0
#> 137  0.565709540    0.3391326           0.6734826    0.1150109             0
#> 138  0.258425494    0.3391326           0.6734826    0.1150109             0
#> 139  0.861093397    0.3391326           0.6734826    0.1150109             0
#> 140 -0.059757233    0.3391326           0.6734826    0.1150109             0
#> 141 -0.920340689    0.3391326           0.6734826    0.1150109             0
#> 142  0.845629236    0.3391326           0.6734826    0.1150109             0
#> 143  1.227427574    0.3391326           0.6734826    0.1150109             0
#> 144  1.054223601    0.3391326           0.6734826    0.1150109             0
#> 145 -1.246596805    0.3391326           0.6734826    0.1150109             0
#> 146 -0.473120468    0.3391326           0.6734826    0.1150109             0
#> 147 -0.560171503    0.3391326           0.6734826    0.1150109             0
#> 148 -0.365394462    0.3391326           0.6734826    0.1150109             0
#> 149  0.084744422    0.3391326           0.6734826    0.1150109             0
#> 150  0.910676146    0.3391326           0.6734826    0.1150109             0
#> 151  1.094189533    0.3391326           0.6734826    0.1150109             0
#> 152 -0.013149231    0.3391326           0.6734826    0.1150109             0
#> 153 -0.166472976    0.3391326           0.6734826    0.1150109             0
#> 154  0.008695459    0.3391326           0.6734826    0.1150109             0
#> 155 -0.094989494    0.3391326           0.6734826    0.1150109             0
#> 156 -0.457123143    0.3391326           0.6734826    0.1150109             0
#> 
#> $`Grant-White`
#>        fs_visual se_fs_visual visual_by_fs_visual ev_fs_visual int_fs_visual
#> 1   -0.915287109     0.311828           0.6990509   0.09723667             0
#> 2    0.035963597     0.311828           0.6990509   0.09723667             0
#> 3    0.355636604     0.311828           0.6990509   0.09723667             0
#> 4   -0.387353871     0.311828           0.6990509   0.09723667             0
#> 5   -0.622393942     0.311828           0.6990509   0.09723667             0
#> 6    0.195944561     0.311828           0.6990509   0.09723667             0
#> 7    1.353023831     0.311828           0.6990509   0.09723667             0
#> 8   -0.341506254     0.311828           0.6990509   0.09723667             0
#> 9   -0.199493575     0.311828           0.6990509   0.09723667             0
#> 10  -0.689869149     0.311828           0.6990509   0.09723667             0
#> 11  -0.463929554     0.311828           0.6990509   0.09723667             0
#> 12  -0.423001505     0.311828           0.6990509   0.09723667             0
#> 13   0.279743296     0.311828           0.6990509   0.09723667             0
#> 14  -0.916908219     0.311828           0.6990509   0.09723667             0
#> 15   0.589344501     0.311828           0.6990509   0.09723667             0
#> 16   0.191474701     0.311828           0.6990509   0.09723667             0
#> 17   0.935275715     0.311828           0.6990509   0.09723667             0
#> 18   0.393715904     0.311828           0.6990509   0.09723667             0
#> 19   0.086569994     0.311828           0.6990509   0.09723667             0
#> 20   0.555606898     0.311828           0.6990509   0.09723667             0
#> 21  -0.558217193     0.311828           0.6990509   0.09723667             0
#> 22   0.766715894     0.311828           0.6990509   0.09723667             0
#> 23   0.115548801     0.311828           0.6990509   0.09723667             0
#> 24   0.901249191     0.311828           0.6990509   0.09723667             0
#> 25   0.174316971     0.311828           0.6990509   0.09723667             0
#> 26  -0.078980322     0.311828           0.6990509   0.09723667             0
#> 27  -0.581882977     0.311828           0.6990509   0.09723667             0
#> 28  -0.661179262     0.311828           0.6990509   0.09723667             0
#> 29  -0.245341176     0.311828           0.6990509   0.09723667             0
#> 30  -0.195801662     0.311828           0.6990509   0.09723667             0
#> 31  -0.281221524     0.311828           0.6990509   0.09723667             0
#> 32  -0.293909378     0.311828           0.6990509   0.09723667             0
#> 33  -0.604192958     0.311828           0.6990509   0.09723667             0
#> 34  -0.738437335     0.311828           0.6990509   0.09723667             0
#> 35  -0.304109345     0.311828           0.6990509   0.09723667             0
#> 36   0.104931733     0.311828           0.6990509   0.09723667             0
#> 37  -0.025781487     0.311828           0.6990509   0.09723667             0
#> 38  -0.897318824     0.311828           0.6990509   0.09723667             0
#> 39  -0.892560027     0.311828           0.6990509   0.09723667             0
#> 40  -0.078402465     0.311828           0.6990509   0.09723667             0
#> 41  -0.379063934     0.311828           0.6990509   0.09723667             0
#> 42  -0.324926380     0.311828           0.6990509   0.09723667             0
#> 43  -0.684299797     0.311828           0.6990509   0.09723667             0
#> 44  -0.304109345     0.311828           0.6990509   0.09723667             0
#> 45   0.622793169     0.311828           0.6990509   0.09723667             0
#> 46  -0.152835419     0.311828           0.6990509   0.09723667             0
#> 47  -0.421902013     0.311828           0.6990509   0.09723667             0
#> 48  -0.060883872     0.311828           0.6990509   0.09723667             0
#> 49  -0.303298790     0.311828           0.6990509   0.09723667             0
#> 50   0.425021826     0.311828           0.6990509   0.09723667             0
#> 51   0.131478875     0.311828           0.6990509   0.09723667             0
#> 52  -0.914998172     0.311828           0.6990509   0.09723667             0
#> 53   0.324226132     0.311828           0.6990509   0.09723667             0
#> 54  -0.086170767     0.311828           0.6990509   0.09723667             0
#> 55   0.428424818     0.311828           0.6990509   0.09723667             0
#> 56   0.188465179     0.311828           0.6990509   0.09723667             0
#> 57  -0.306958111     0.311828           0.6990509   0.09723667             0
#> 58   0.581736955     0.311828           0.6990509   0.09723667             0
#> 59  -0.743485051     0.311828           0.6990509   0.09723667             0
#> 60   0.263580524     0.311828           0.6990509   0.09723667             0
#> 61   0.178786831     0.311828           0.6990509   0.09723667             0
#> 62  -0.064832113     0.311828           0.6990509   0.09723667             0
#> 63   0.499976414     0.311828           0.6990509   0.09723667             0
#> 64  -0.092839593     0.311828           0.6990509   0.09723667             0
#> 65  -0.263702931     0.311828           0.6990509   0.09723667             0
#> 66  -0.983966325     0.311828           0.6990509   0.09723667             0
#> 67   1.434912536     0.311828           0.6990509   0.09723667             0
#> 68  -1.037582228     0.311828           0.6990509   0.09723667             0
#> 69  -0.047569849     0.311828           0.6990509   0.09723667             0
#> 70   1.084767775     0.311828           0.6990509   0.09723667             0
#> 71   0.092011181     0.311828           0.6990509   0.09723667             0
#> 72  -0.562687052     0.311828           0.6990509   0.09723667             0
#> 73  -0.304919900     0.311828           0.6990509   0.09723667             0
#> 74   1.038920175     0.311828           0.6990509   0.09723667             0
#> 75  -0.789854287     0.311828           0.6990509   0.09723667             0
#> 76  -0.602282928     0.311828           0.6990509   0.09723667             0
#> 77  -0.894630830     0.311828           0.6990509   0.09723667             0
#> 78   0.532614527     0.311828           0.6990509   0.09723667             0
#> 79  -0.548955945     0.311828           0.6990509   0.09723667             0
#> 80  -0.221514635     0.311828           0.6990509   0.09723667             0
#> 81  -0.095849115     0.311828           0.6990509   0.09723667             0
#> 82  -0.122235502     0.311828           0.6990509   0.09723667             0
#> 83   0.892276864     0.311828           0.6990509   0.09723667             0
#> 84   0.328439663     0.311828           0.6990509   0.09723667             0
#> 85   1.217391042     0.311828           0.6990509   0.09723667             0
#> 86   0.574513902     0.311828           0.6990509   0.09723667             0
#> 87   0.160168762     0.311828           0.6990509   0.09723667             0
#> 88   0.654909662     0.311828           0.6990509   0.09723667             0
#> 89  -0.509777155     0.311828           0.6990509   0.09723667             0
#> 90   1.201493560     0.311828           0.6990509   0.09723667             0
#> 91   0.584874625     0.311828           0.6990509   0.09723667             0
#> 92   0.075142371     0.311828           0.6990509   0.09723667             0
#> 93   0.550976266     0.311828           0.6990509   0.09723667             0
#> 94  -0.886308302     0.311828           0.6990509   0.09723667             0
#> 95   0.552075757     0.311828           0.6990509   0.09723667             0
#> 96   1.415972940     0.311828           0.6990509   0.09723667             0
#> 97   0.298650301     0.311828           0.6990509   0.09723667             0
#> 98  -0.143028906     0.311828           0.6990509   0.09723667             0
#> 99   0.245195154     0.311828           0.6990509   0.09723667             0
#> 100  0.247072593     0.311828           0.6990509   0.09723667             0
#> 101  0.817322291     0.311828           0.6990509   0.09723667             0
#> 102  0.651771976     0.311828           0.6990509   0.09723667             0
#> 103  1.338875623     0.311828           0.6990509   0.09723667             0
#> 104 -1.160005528     0.311828           0.6990509   0.09723667             0
#> 105  0.163306449     0.311828           0.6990509   0.09723667             0
#> 106 -0.387353871     0.311828           0.6990509   0.09723667             0
#> 107 -0.517128372     0.311828           0.6990509   0.09723667             0
#> 108  0.065103160     0.311828           0.6990509   0.09723667             0
#> 109 -0.115438510     0.311828           0.6990509   0.09723667             0
#> 110  0.094049376     0.311828           0.6990509   0.09723667             0
#> 111  0.396725409     0.311828           0.6990509   0.09723667             0
#> 112  0.672356312     0.311828           0.6990509   0.09723667             0
#> 113  1.165974090     0.311828           0.6990509   0.09723667             0
#> 114 -0.483518949     0.311828           0.6990509   0.09723667             0
#> 115  0.035024877     0.311828           0.6990509   0.09723667             0
#> 116  0.741974248     0.311828           0.6990509   0.09723667             0
#> 117 -0.170386603     0.311828           0.6990509   0.09723667             0
#> 118 -0.205873481     0.311828           0.6990509   0.09723667             0
#> 119  0.714777307     0.311828           0.6990509   0.09723667             0
#> 120 -0.620772831     0.311828           0.6990509   0.09723667             0
#> 121 -0.313626938     0.311828           0.6990509   0.09723667             0
#> 122 -0.157466035     0.311828           0.6990509   0.09723667             0
#> 123  0.118269386     0.311828           0.6990509   0.09723667             0
#> 124  0.101111673     0.311828           0.6990509   0.09723667             0
#> 125 -0.625403463     0.311828           0.6990509   0.09723667             0
#> 126  0.486638761     0.311828           0.6990509   0.09723667             0
#> 127 -0.178676540     0.311828           0.6990509   0.09723667             0
#> 128  0.274013189     0.311828           0.6990509   0.09723667             0
#> 129 -0.316347523     0.311828           0.6990509   0.09723667             0
#> 130 -0.026752814     0.311828           0.6990509   0.09723667             0
#> 131  0.245323318     0.311828           0.6990509   0.09723667             0
#> 132 -0.356336853     0.311828           0.6990509   0.09723667             0
#> 133 -0.581594057     0.311828           0.6990509   0.09723667             0
#> 134  0.263002667     0.311828           0.6990509   0.09723667             0
#> 135 -0.864680712     0.311828           0.6990509   0.09723667             0
#> 136 -0.377964443     0.311828           0.6990509   0.09723667             0
#> 137 -0.112717909     0.311828           0.6990509   0.09723667             0
#> 138  0.114449326     0.311828           0.6990509   0.09723667             0
#> 139  0.001287274     0.311828           0.6990509   0.09723667             0
#> 140  0.597634438     0.311828           0.6990509   0.09723667             0
#> 141 -0.252531637     0.311828           0.6990509   0.09723667             0
#> 142 -0.472901881     0.311828           0.6990509   0.09723667             0
#> 143 -0.187255397     0.311828           0.6990509   0.09723667             0
#> 144 -0.542415283     0.311828           0.6990509   0.09723667             0
#> 145  0.358774274     0.311828           0.6990509   0.09723667             0
#> 
#> attr(,"ld")
#>           visual               
#> fs_visual "visual_by_fs_visual"
#> attr(,"ev")
#>           fs_visual     
#> fs_visual "ev_fs_visual"
#> attr(,"int")
#> [1] "int_fs_visual"