Frequency tables for categorical variables and related statistics.

lavTables(object, dimension = 2L, type = "cells", categorical = NULL,
    group = NULL, statistic = "default", G2.min = 3, X2.min = 3,
    p.value = FALSE, output = "data.frame", patternAsString = TRUE)

Arguments

object

Either a data.frame, or an object of class lavaan.

dimension

Integer. If 0L, display all response patterns. If 1L, display one-dimensional (one-way) tables; if 2L, display two-dimensional (two-way or pairwise) tables. For the latter, we can change the information per row: if type = "cells", each row is a cell in a pairwise table; if type = "table", each row is a table.

type

If "cells", display information for each cell in the (one-way or two-way) table. If "table", display information per table. If "pattern", display response patterns (implying "dimension = 0L").

categorical

Only used if object is a data.frame. Specify variables that need to be treated as categorical.

group

Only used if object is a data.frame. Specify a grouping variable.

statistic

Either a character string, or a vector of character strings requesting one or more statistics for each cell, pattern or table. Always available are X2 and G2 for the Pearson and LRT based goodness-of-fit statistics. A distinction is made between the unrestricted and restricted model. The statistics based on the former have an extension *.un, as in X2.un and G2.un. If object is a data.frame, the unrestricted versions of the statistics are the only ones available. For one-way tables, additional statistics are the thresholds (th.un and th). For two-way tables and type = "table", the following statistics are available: X2, G2, cor (polychoric correlation), RMSEA and the corresponding unrestricted versions (X2.un etc). Additional statistics are G2.average, G2.nlarge and G2.plarge statistics based on the cell values G2: G2.average is the average of the G2 values in each cell of the two-way table; G2.nlarge is the number of cells with a G2 value larger than G2.min, and G2.plarge is the proportion of cells with a G2 value larger than G2.min. A similar set of statistics based on X2 is also available. If "default", the selection of statistics (if any) depends on the dim and type arguments, and if the object is a data.frame or a fitted lavaan object.

G2.min

Numeric. All cells with a G2 statistic larger than this number are considered `large', as reflected in the (optional) "G2.plarge" and "G2.nlarge" columns.

X2.min

Numeric. All cells with a X2 statistic larger than this number are considered `large', as reflected in the (optional) "X2.plarge" and "X2.nlarge" columns.

p.value

Logical. If "TRUE", p-values are computed for requested statistics (eg G2 or X2) if possible.

output

If "data.frame", the output is presented as a data.frame where each row is either a cell, a table, or a response pattern, depending on the "type" argument. If "table", the output is presented as a table (or matrix) or a list of tables. Only a single statistic can be shown in this case, and if the statistic is empty, the observed frequencies are shown.

patternAsString

Logical. Only used for response patterns (dimension = 0L). If "TRUE", response patterns are displayed as a compact string. If "FALSE", as many columns as observed variables are displayed.

Value

If output = "data.frame", the output is presented as a data.frame where each row is either a cell, a table, or a response pattern, depending on the "type" argument. If output = "table" (only for two-way tables), a list of tables (if type = "cells") where each list element corresponds to a pairwise table, or if type = "table", a single table (per group). In both cases, the table entries are determined by the (single) statistic argument.

References

Joreskog, K.G. & Moustaki, I. (2001). Factor analysis of ordinal variables: A comparison of three approaches. Multivariate Behavioral Research, 36, 347-387.

See also

Examples

HS9 <- HolzingerSwineford1939[,c("x1","x2","x3","x4","x5",
                                 "x6","x7","x8","x9")]
HSbinary <- as.data.frame( lapply(HS9, cut, 2, labels=FALSE) )

# using the data only
lavTables(HSbinary, dim = 0L, categorical = names(HSbinary))
#>       pattern nobs obs.freq obs.prop
#> 1   111111111  301       19    0.063
#> 2   211121111  301       11    0.037
#> 3   111121111  301        7    0.023
#> 4   211111111  301        7    0.023
#> 5   221111111  301        7    0.023
#> 6   221121111  301        7    0.023
#> 7   222221111  301        7    0.023
#> 8   221111211  301        6    0.020
#> 9   221221211  301        6    0.020
#> 10  221222111  301        6    0.020
#> 11  222121111  301        6    0.020
#> 12  111111211  301        5    0.017
#> 13  111221211  301        5    0.017
#> 14  121221211  301        5    0.017
#> 15  122111111  301        5    0.017
#> 16  221221111  301        5    0.017
#> 17  121111111  301        4    0.013
#> 18  211111211  301        4    0.013
#> 19  212111111  301        4    0.013
#> 20  212221111  301        4    0.013
#> 21  222221211  301        4    0.013
#> 22  222222111  301        4    0.013
#> 23  222222222  301        4    0.013
#> 24  111121212  301        3    0.010
#> 25  111221111  301        3    0.010
#> 26  121121111  301        3    0.010
#> 27  211211211  301        3    0.010
#> 28  211221111  301        3    0.010
#> 29  212111211  301        3    0.010
#> 30  212121111  301        3    0.010
#> 31  212221212  301        3    0.010
#> 32  212222111  301        3    0.010
#> 33  221221212  301        3    0.010
#> 34  222111111  301        3    0.010
#> 35  222221112  301        3    0.010
#> 36  222221212  301        3    0.010
#> 37  111111221  301        2    0.007
#> 38  111121211  301        2    0.007
#> 39  112111111  301        2    0.007
#> 40  121111212  301        2    0.007
#> 41  121121112  301        2    0.007
#> 42  121221111  301        2    0.007
#> 43  122111112  301        2    0.007
#> 44  211111122  301        2    0.007
#> 45  211111212  301        2    0.007
#> 46  211121211  301        2    0.007
#> 47  211211111  301        2    0.007
#> 48  211221112  301        2    0.007
#> 49  211221211  301        2    0.007
#> 50  211222112  301        2    0.007
#> 51  211222212  301        2    0.007
#> 52  221121112  301        2    0.007
#> 53  221222112  301        2    0.007
#> 54  222111112  301        2    0.007
#> 55  222111212  301        2    0.007
#> 56  222121211  301        2    0.007
#> 57  222221222  301        2    0.007
#> 58  222222112  301        2    0.007
#> 59  222222211  301        2    0.007
#> 60  111111112  301        1    0.003
#> 61  111111121  301        1    0.003
#> 62  111111212  301        1    0.003
#> 63  111121112  301        1    0.003
#> 64  111121222  301        1    0.003
#> 65  111211111  301        1    0.003
#> 66  111211211  301        1    0.003
#> 67  111211212  301        1    0.003
#> 68  111221212  301        1    0.003
#> 69  111222111  301        1    0.003
#> 70  112111211  301        1    0.003
#> 71  112111212  301        1    0.003
#> 72  112111222  301        1    0.003
#> 73  112121111  301        1    0.003
#> 74  112221111  301        1    0.003
#> 75  121121211  301        1    0.003
#> 76  121121212  301        1    0.003
#> 77  121122211  301        1    0.003
#> 78  121122221  301        1    0.003
#> 79  121211111  301        1    0.003
#> 80  121211211  301        1    0.003
#> 81  121212211  301        1    0.003
#> 82  121221212  301        1    0.003
#> 83  121222111  301        1    0.003
#> 84  122111211  301        1    0.003
#> 85  122111221  301        1    0.003
#> 86  122111222  301        1    0.003
#> 87  122121211  301        1    0.003
#> 88  122121212  301        1    0.003
#> 89  122221121  301        1    0.003
#> 90  122221222  301        1    0.003
#> 91  122222111  301        1    0.003
#> 92  211111112  301        1    0.003
#> 93  211111121  301        1    0.003
#> 94  211111221  301        1    0.003
#> 95  211121122  301        1    0.003
#> 96  211121221  301        1    0.003
#> 97  211122111  301        1    0.003
#> 98  211222111  301        1    0.003
#> 99  211222211  301        1    0.003
#> 100 212111112  301        1    0.003
#> 101 212111221  301        1    0.003
#> 102 212121211  301        1    0.003
#> 103 212121221  301        1    0.003
#> 104 212121222  301        1    0.003
#> 105 212211221  301        1    0.003
#> 106 212221222  301        1    0.003
#> 107 212222112  301        1    0.003
#> 108 212222211  301        1    0.003
#> 109 221111112  301        1    0.003
#> 110 221111221  301        1    0.003
#> 111 221121212  301        1    0.003
#> 112 221122222  301        1    0.003
#> 113 221211111  301        1    0.003
#> 114 221211212  301        1    0.003
#> 115 221221112  301        1    0.003
#> 116 221222211  301        1    0.003
#> 117 221222212  301        1    0.003
#> 118 222111122  301        1    0.003
#> 119 222111221  301        1    0.003
#> 120 222111222  301        1    0.003
#> 121 222121112  301        1    0.003
#> 122 222121222  301        1    0.003
#> 123 222122112  301        1    0.003
#> 124 222211111  301        1    0.003
#> 125 222211112  301        1    0.003
#> 126 222211121  301        1    0.003
#> 127 222211211  301        1    0.003
#> 128 222221121  301        1    0.003
#> 129 222221221  301        1    0.003
#> 130 222222121  301        1    0.003
#> 131 222222122  301        1    0.003
#> 132 222222212  301        1    0.003
#> 133 222222221  301        1    0.003
lavTables(HSbinary, dim = 1L, categorical = names(HSbinary), stat=c("th.un"))
#>    id lhs rhs nobs obs.freq obs.prop  th.un
#> 1   1  x1   1  301      105    0.349 -0.388
#> 2   1  x1   2  301      196    0.651    Inf
#> 3   2  x2   1  301      144    0.478 -0.054
#> 4   2  x2   2  301      157    0.522    Inf
#> 5   3  x3   1  301      188    0.625  0.318
#> 6   3  x3   2  301      113    0.375    Inf
#> 7   4  x4   1  301      172    0.571  0.180
#> 8   4  x4   2  301      129    0.429    Inf
#> 9   5  x5   1  301      120    0.399 -0.257
#> 10  5  x5   2  301      181    0.601    Inf
#> 11  6  x6   1  301      255    0.847  1.024
#> 12  6  x6   2  301       46    0.153    Inf
#> 13  7  x7   1  301      178    0.591  0.231
#> 14  7  x7   2  301      123    0.409    Inf
#> 15  8  x8   1  301      262    0.870  1.128
#> 16  8  x8   2  301       39    0.130    Inf
#> 17  9  x9   1  301      221    0.734  0.626
#> 18  9  x9   2  301       80    0.266    Inf
lavTables(HSbinary, dim = 2L, categorical = names(HSbinary), type = "table")
#>     lhs rhs nobs
#> 1    x1  x2  301
#> 5    x1  x3  301
#> 9    x1  x4  301
#> 13   x1  x5  301
#> 17   x1  x6  301
#> 21   x1  x7  301
#> 25   x1  x8  301
#> 29   x1  x9  301
#> 33   x2  x3  301
#> 37   x2  x4  301
#> 41   x2  x5  301
#> 45   x2  x6  301
#> 49   x2  x7  301
#> 53   x2  x8  301
#> 57   x2  x9  301
#> 61   x3  x4  301
#> 65   x3  x5  301
#> 69   x3  x6  301
#> 73   x3  x7  301
#> 77   x3  x8  301
#> 81   x3  x9  301
#> 85   x4  x5  301
#> 89   x4  x6  301
#> 93   x4  x7  301
#> 97   x4  x8  301
#> 101  x4  x9  301
#> 105  x5  x6  301
#> 109  x5  x7  301
#> 113  x5  x8  301
#> 117  x5  x9  301
#> 121  x6  x7  301
#> 125  x6  x8  301
#> 129  x6  x9  301
#> 133  x7  x8  301
#> 137  x7  x9  301
#> 141  x8  x9  301

# fit a model
HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '

fit <- cfa(HS.model, data=HSbinary, ordered=names(HSbinary))
#> Warning: lavaan->lav_model_vcov():  
#>    The variance-covariance matrix of the estimated parameters (vcov) does not 
#>    appear to be positive definite! The smallest eigenvalue (= -1.233876e+00) 
#>    is smaller than zero. This may be a symptom that the model is not 
#>    identified.


lavTables(fit, 1L)
#>    id lhs rhs nobs obs.freq obs.prop est.prop X2
#> 1   1  x1   1  301      105    0.349    0.349  0
#> 2   1  x1   2  301      196    0.651    0.651  0
#> 3   2  x2   1  301      144    0.478    0.478  0
#> 4   2  x2   2  301      157    0.522    0.522  0
#> 5   3  x3   1  301      188    0.625    0.625  0
#> 6   3  x3   2  301      113    0.375    0.375  0
#> 7   4  x4   1  301      172    0.571    0.571  0
#> 8   4  x4   2  301      129    0.429    0.429  0
#> 9   5  x5   1  301      120    0.399    0.399  0
#> 10  5  x5   2  301      181    0.601    0.601  0
#> 11  6  x6   1  301      255    0.847    0.847  0
#> 12  6  x6   2  301       46    0.153    0.153  0
#> 13  7  x7   1  301      178    0.591    0.591  0
#> 14  7  x7   2  301      123    0.409    0.409  0
#> 15  8  x8   1  301      262    0.870    0.870  0
#> 16  8  x8   2  301       39    0.130    0.130  0
#> 17  9  x9   1  301      221    0.734    0.734  0
#> 18  9  x9   2  301       80    0.266    0.266  0
lavTables(fit, 2L, type="cells")
#>     id lhs rhs nobs row col obs.freq obs.prop est.prop    X2
#> 1    1  x1  x2  301   1   1       63    0.209    0.222 0.228
#> 2    1  x1  x2  301   2   1       81    0.269    0.256 0.198
#> 3    1  x1  x2  301   1   2       42    0.140    0.127 0.400
#> 4    1  x1  x2  301   2   2      115    0.382    0.395 0.128
#> 5    2  x1  x3  301   1   1       83    0.276    0.271 0.022
#> 6    2  x1  x3  301   2   1      105    0.349    0.353 0.017
#> 7    2  x1  x3  301   1   2       22    0.073    0.078 0.078
#> 8    2  x1  x3  301   2   2       91    0.302    0.298 0.020
#> 9    3  x1  x4  301   1   1       76    0.252    0.243 0.101
#> 10   3  x1  x4  301   2   1       96    0.319    0.328 0.075
#> 11   3  x1  x4  301   1   2       29    0.096    0.105 0.233
#> 12   3  x1  x4  301   2   2      100    0.332    0.323 0.076
#> 13   4  x1  x5  301   1   1       56    0.186    0.183 0.020
#> 14   4  x1  x5  301   2   1       64    0.213    0.216 0.017
#> 15   4  x1  x5  301   1   2       49    0.163    0.166 0.022
#> 16   4  x1  x5  301   2   2      132    0.439    0.435 0.009
#> 17   5  x1  x6  301   1   1       99    0.329    0.322 0.043
#> 18   5  x1  x6  301   2   1      156    0.518    0.525 0.027
#> 19   5  x1  x6  301   1   2        6    0.020    0.027 0.522
#> 20   5  x1  x6  301   2   2       40    0.133    0.126 0.111
#> 21   6  x1  x7  301   1   1       60    0.199    0.225 0.893
#> 22   6  x1  x7  301   2   1      118    0.392    0.366 0.549
#> 23   6  x1  x7  301   1   2       45    0.150    0.124 1.627
#> 24   6  x1  x7  301   2   2       78    0.259    0.285 0.706
#> 25   7  x1  x8  301   1   1       95    0.316    0.319 0.011
#> 26   7  x1  x8  301   2   1      167    0.555    0.551 0.006
#> 27   7  x1  x8  301   1   2       10    0.033    0.030 0.118
#> 28   7  x1  x8  301   2   2       29    0.096    0.100 0.035
#> 29   8  x1  x9  301   1   1       83    0.276    0.279 0.010
#> 30   8  x1  x9  301   2   1      138    0.458    0.455 0.006
#> 31   8  x1  x9  301   1   2       22    0.073    0.070 0.042
#> 32   8  x1  x9  301   2   2       58    0.193    0.196 0.015
#> 33   9  x2  x3  301   1   1      108    0.359    0.352 0.043
#> 34   9  x2  x3  301   2   1       80    0.266    0.273 0.056
#> 35   9  x2  x3  301   1   2       36    0.120    0.127 0.120
#> 36   9  x2  x3  301   2   2       77    0.256    0.249 0.061
#> 37  10  x2  x4  301   1   1       98    0.326    0.317 0.078
#> 38  10  x2  x4  301   2   1       74    0.246    0.255 0.097
#> 39  10  x2  x4  301   1   2       46    0.153    0.162 0.152
#> 40  10  x2  x4  301   2   2       83    0.276    0.267 0.093
#> 41  11  x2  x5  301   1   1       70    0.233    0.232 0.000
#> 42  11  x2  x5  301   2   1       50    0.166    0.166 0.000
#> 43  11  x2  x5  301   1   2       74    0.246    0.246 0.000
#> 44  11  x2  x5  301   2   2      107    0.355    0.355 0.000
#> 45  12  x2  x6  301   1   1      131    0.435    0.433 0.004
#> 46  12  x2  x6  301   2   1      124    0.412    0.414 0.005
#> 47  12  x2  x6  301   1   2       13    0.043    0.046 0.042
#> 48  12  x2  x6  301   2   2       33    0.110    0.107 0.018
#> 49  13  x2  x7  301   1   1       88    0.292    0.301 0.080
#> 50  13  x2  x7  301   2   1       90    0.299    0.290 0.083
#> 51  13  x2  x7  301   1   2       56    0.186    0.177 0.136
#> 52  13  x2  x7  301   2   2       67    0.223    0.232 0.104
#> 53  14  x2  x8  301   1   1      128    0.425    0.432 0.032
#> 54  14  x2  x8  301   2   1      134    0.445    0.438 0.031
#> 55  14  x2  x8  301   1   2       16    0.053    0.046 0.293
#> 56  14  x2  x8  301   2   2       23    0.076    0.083 0.164
#> 57  15  x2  x9  301   1   1      114    0.379    0.374 0.020
#> 58  15  x2  x9  301   2   1      107    0.355    0.360 0.021
#> 59  15  x2  x9  301   1   2       30    0.100    0.105 0.072
#> 60  15  x2  x9  301   2   2       50    0.166    0.161 0.047
#> 61  16  x3  x4  301   1   1      118    0.392    0.400 0.050
#> 62  16  x3  x4  301   2   1       54    0.179    0.171 0.118
#> 63  16  x3  x4  301   1   2       70    0.233    0.224 0.090
#> 64  16  x3  x4  301   2   2       59    0.196    0.204 0.099
#> 65  17  x3  x5  301   1   1       81    0.269    0.290 0.440
#> 66  17  x3  x5  301   2   1       39    0.130    0.109 1.170
#> 67  17  x3  x5  301   1   2      107    0.355    0.335 0.381
#> 68  17  x3  x5  301   2   2       74    0.246    0.266 0.479
#> 69  18  x3  x6  301   1   1      165    0.548    0.558 0.052
#> 70  18  x3  x6  301   2   1       90    0.299    0.289 0.101
#> 71  18  x3  x6  301   1   2       23    0.076    0.067 0.440
#> 72  18  x3  x6  301   2   2       23    0.076    0.086 0.340
#> 73  19  x3  x7  301   1   1      113    0.375    0.388 0.118
#> 74  19  x3  x7  301   2   1       65    0.216    0.204 0.225
#> 75  19  x3  x7  301   1   2       75    0.249    0.237 0.193
#> 76  19  x3  x7  301   2   2       48    0.159    0.172 0.266
#> 77  20  x3  x8  301   1   1      175    0.581    0.560 0.252
#> 78  20  x3  x8  301   2   1       87    0.289    0.311 0.454
#> 79  20  x3  x8  301   1   2       13    0.043    0.065 2.174
#> 80  20  x3  x8  301   2   2       26    0.086    0.065 2.176
#> 81  21  x3  x9  301   1   1      148    0.492    0.481 0.066
#> 82  21  x3  x9  301   2   1       73    0.243    0.253 0.126
#> 83  21  x3  x9  301   1   2       40    0.133    0.143 0.222
#> 84  21  x3  x9  301   2   2       40    0.133    0.123 0.260
#> 85  22  x4  x5  301   1   1      102    0.339    0.337 0.002
#> 86  22  x4  x5  301   2   1       18    0.060    0.061 0.012
#> 87  22  x4  x5  301   1   2       70    0.233    0.234 0.003
#> 88  22  x4  x5  301   2   2      111    0.369    0.367 0.002
#> 89  23  x4  x6  301   1   1      167    0.555    0.558 0.005
#> 90  23  x4  x6  301   2   1       88    0.292    0.289 0.009
#> 91  23  x4  x6  301   1   2        5    0.017    0.014 0.193
#> 92  23  x4  x6  301   2   2       41    0.136    0.139 0.019
#> 93  24  x4  x7  301   1   1      111    0.369    0.349 0.321
#> 94  24  x4  x7  301   2   1       67    0.223    0.242 0.464
#> 95  24  x4  x7  301   1   2       61    0.203    0.222 0.506
#> 96  24  x4  x7  301   2   2       62    0.206    0.187 0.601
#> 97  25  x4  x8  301   1   1      149    0.495    0.507 0.090
#> 98  25  x4  x8  301   2   1      113    0.375    0.363 0.125
#> 99  25  x4  x8  301   1   2       23    0.076    0.064 0.711
#> 100 25  x4  x8  301   2   2       16    0.053    0.065 0.696
#> 101 26  x4  x9  301   1   1      132    0.439    0.434 0.016
#> 102 26  x4  x9  301   2   1       89    0.296    0.300 0.023
#> 103 26  x4  x9  301   1   2       40    0.133    0.138 0.050
#> 104 26  x4  x9  301   2   2       40    0.133    0.128 0.054
#> 105 27  x5  x6  301   1   1      119    0.395    0.394 0.001
#> 106 27  x5  x6  301   2   1      136    0.452    0.453 0.001
#> 107 27  x5  x6  301   1   2        1    0.003    0.005 0.100
#> 108 27  x5  x6  301   2   2       45    0.150    0.148 0.003
#> 109 28  x5  x7  301   1   1       72    0.239    0.247 0.070
#> 110 28  x5  x7  301   2   1      106    0.352    0.345 0.050
#> 111 28  x5  x7  301   1   2       48    0.159    0.152 0.114
#> 112 28  x5  x7  301   2   2       75    0.249    0.257 0.068
#> 113 29  x5  x8  301   1   1      103    0.342    0.356 0.168
#> 114 29  x5  x8  301   2   1      159    0.528    0.514 0.116
#> 115 29  x5  x8  301   1   2       17    0.056    0.042 1.408
#> 116 29  x5  x8  301   2   2       22    0.073    0.087 0.685
#> 117 30  x5  x9  301   1   1       95    0.316    0.306 0.088
#> 118 30  x5  x9  301   2   1      126    0.419    0.428 0.063
#> 119 30  x5  x9  301   1   2       25    0.083    0.093 0.292
#> 120 30  x5  x9  301   2   2       55    0.183    0.173 0.156
#> 121 31  x6  x7  301   1   1      150    0.498    0.509 0.061
#> 122 31  x6  x7  301   2   1       28    0.093    0.083 0.377
#> 123 31  x6  x7  301   1   2      105    0.349    0.339 0.092
#> 124 31  x6  x7  301   2   2       18    0.060    0.070 0.446
#> 125 32  x6  x8  301   1   1      225    0.748    0.744 0.004
#> 126 32  x6  x8  301   2   1       37    0.123    0.126 0.025
#> 127 32  x6  x8  301   1   2       30    0.100    0.103 0.031
#> 128 32  x6  x8  301   2   2        9    0.030    0.027 0.120
#> 129 33  x6  x9  301   1   1      193    0.641    0.631 0.045
#> 130 33  x6  x9  301   2   1       28    0.093    0.103 0.276
#> 131 33  x6  x9  301   1   2       62    0.206    0.216 0.131
#> 132 33  x6  x9  301   2   2       18    0.060    0.050 0.566
#> 133 34  x7  x8  301   1   1      167    0.555    0.544 0.059
#> 134 34  x7  x8  301   2   1       95    0.316    0.326 0.098
#> 135 34  x7  x8  301   1   2       11    0.037    0.047 0.684
#> 136 34  x7  x8  301   2   2       28    0.093    0.083 0.388
#> 137 35  x7  x9  301   1   1      144    0.478    0.477 0.002
#> 138 35  x7  x9  301   2   1       77    0.256    0.258 0.004
#> 139 35  x7  x9  301   1   2       34    0.113    0.115 0.008
#> 140 35  x7  x9  301   2   2       46    0.153    0.151 0.006
#> 141 36  x8  x9  301   1   1      202    0.671    0.681 0.040
#> 142 36  x8  x9  301   2   1       19    0.063    0.054 0.512
#> 143 36  x8  x9  301   1   2       60    0.199    0.190 0.144
#> 144 36  x8  x9  301   2   2       20    0.066    0.076 0.361
lavTables(fit, 2L, type="table", stat=c("cor.un", "G2", "cor"))
#>     lhs rhs nobs df   cor cor.un    G2
#> 1    x1  x2  301  0 0.367  0.284 0.944
#> 5    x1  x3  301  0 0.383  0.415 0.139
#> 9    x1  x4  301  0 0.303  0.364 0.491
#> 13   x1  x5  301  0 0.296  0.319 0.069
#> 17   x1  x6  301  0 0.327  0.422 0.752
#> 21   x1  x7  301  0 0.132 -0.048 3.718
#> 25   x1  x8  301  0 0.207  0.159 0.167
#> 29   x1  x9  301  0 0.191  0.165 0.073
#> 33   x2  x3  301  0 0.345  0.389 0.283
#> 37   x2  x4  301  0 0.273  0.328 0.422
#> 41   x2  x5  301  0 0.266  0.268 0.001
#> 45   x2  x6  301  0 0.294  0.322 0.069
#> 49   x2  x7  301  0 0.119  0.061 0.403
#> 53   x2  x8  301  0 0.186  0.105 0.511
#> 57   x2  x9  301  0 0.172  0.210 0.160
#> 61   x3  x4  301  0 0.285  0.232 0.355
#> 65   x3  x5  301  0 0.278  0.138 2.418
#> 69   x3  x6  301  0 0.307  0.206 0.926
#> 73   x3  x7  301  0 0.124  0.041 0.802
#> 77   x3  x8  301  0 0.195  0.439 5.147
#> 81   x3  x9  301  0 0.180  0.258 0.674
#> 85   x4  x5  301  0 0.680  0.688 0.019
#> 89   x4  x6  301  0 0.751  0.720 0.214
#> 93   x4  x7  301  0 0.076  0.200 1.894
#> 97   x4  x8  301  0 0.119 -0.029 1.628
#> 101  x4  x9  301  0 0.109  0.146 0.143
#> 105  x5  x6  301  0 0.733  0.761 0.115
#> 109  x5  x7  301  0 0.074  0.023 0.302
#> 113  x5  x8  301  0 0.116 -0.059 2.284
#> 117  x5  x9  301  0 0.107  0.183 0.607
#> 121  x6  x7  301  0 0.081 -0.029 0.985
#> 125  x6  x8  301  0 0.128  0.183 0.177
#> 129  x6  x9  301  0 0.118  0.230 0.995
#> 133  x7  x8  301  0 0.348  0.464 1.271
#> 137  x7  x9  301  0 0.322  0.335 0.020
#> 141  x8  x9  301  0 0.505  0.403 1.043
lavTables(fit, 2L, type="table", output="table", stat="X2")
#>        x1     x2     x3     x4     x5     x6     x7     x8     x9
#> x1      .                                                        
#> x2  0.954      .                                                 
#> x3  0.138  0.281      .                                          
#> x4  0.485  0.420  0.356      .                                   
#> x5  0.069  0.001  2.469  0.019      .                            
#> x6  0.703  0.069  0.934  0.226  0.105      .                     
#> x7  3.775  0.404  0.802  1.892  0.302  0.977      .              
#> x8  0.171  0.520  5.055  1.622  2.377  0.181  1.229      .       
#> x9  0.073  0.159  0.675  0.143  0.600  1.018  0.020  1.057      .