Skip to contents

fs_indiv() converts a get_fs() result into a single long data frame (one row per input row) carrying, for every observation, the individual-specific standard errors, implied loadings, and error variances and covariances of the factor scores, reusing get_fs()'s column naming. In shape this resembles mirt::fscores(full.scores.SE = TRUE) (a per-observation table pairing each score with its standard errors), but the quantities are read off the fsL/fsT/fsb attributes of a get_fs() result rather than estimated from a new model.

For lavaan models the per-row values are pattern-resolved: an observation's fsL/fsT/fsb depend only on its observed-indicator pattern, not on its response values, so rows within a group differ only when the data contain missing values (rows across groups may always differ). For merMod models there is one row per cluster, each carrying that cluster's own fsL/fsT.

Usage

fs_indiv(fs, include_intercept = FALSE, ...)

Arguments

fs

A factor-score object as returned by get_fs() (or get_fs_lavaan()/get_fs_lmer()): a unified data frame, a named list of per-group data frames (format = "list"), or a merMod result (one row per cluster).

include_intercept

Logical. When TRUE, also emit the factor score intercepts (the fsb attribute) as int_fs_<f> columns (q of them). Ignored for merMod results, which have no fsb (random effects are mean zero).

...

Currently unused.

Value

A data frame with nrow() equal to the number of rows of the input get_fs() result (one row per observation for lavaan models, one row per cluster for merMod models). Columns, in order: * the input's factor-score columns, kept unmodified (fs_<f>; for merMod models fs_u<k>, or the legacy u<k>_eb name when get_fs.merMod() was run with legacy_names = TRUE); * the per-observation standard errors (fs_<f>_se; the square root of the per-row fsT diagonal, NA where that entry is negative or non-finite); * the implied loadings of the latents on the factor scores (<latent_j>_by_fs_<f>, q^2 of them); * the error variances and error covariances of the factor scores (ev_fs_<f>, q of them, and ecov_fs_<a>_fs_<b>, q choose 2 of them), in the same lower-triangular order get_fs() uses; * optionally (when include_intercept = TRUE) the score intercepts (int_fs_<f>, q of them); * a trailing group column for multi-group lavaan results (the input's own group-column name in "unified" format, or group in "list" format); and * a trailing id column holding the cluster/subject id for merMod results.

See also

  • vignette("Scoring Matrices: lavaan CFA and lme4", package = "R2spa") for the scoring-matrix internals these per-row quantities come from.

Examples

library(lavaan)
fit <- cfa("visual =~ x1 + x2 + x3", data = HolzingerSwineford1939)
# For a lavaan result the per-row se / loading / ev columns are the same
# ones get_fs() already carries; include_intercept = TRUE adds the score
# intercepts (int_fs_*) from the fsb attribute (non-NULL under mean
# scoring or with prior_mean/prior_cov).
fs_indiv(get_fs(fit, method = "mean"), include_intercept = TRUE)
#>     fs_visual fs_visual_se visual_by_fs_visual ev_fs_visual int_fs_visual
#> 1    3.819444    0.5304431           0.9616955    0.2813699      4.424742
#> 2    4.236111    0.5304431           0.9616955    0.2813699      4.424742
#> 3    3.875000    0.5304431           0.9616955    0.2813699      4.424742
#> 4    5.361111    0.5304431           0.9616955    0.2813699      4.424742
#> 5    3.486111    0.5304431           0.9616955    0.2813699      4.424742
#> 6    4.194444    0.5304431           0.9616955    0.2813699      4.424742
#> 7    3.277778    0.5304431           0.9616955    0.2813699      4.424742
#> 8    4.597222    0.5304431           0.9616955    0.2813699      4.424742
#> 9    3.916667    0.5304431           0.9616955    0.2813699      4.424742
#> 10   3.166667    0.5304431           0.9616955    0.2813699      4.424742
#> 11   3.805556    0.5304431           0.9616955    0.2813699      4.424742
#> 12   4.902778    0.5304431           0.9616955    0.2813699      4.424742
#> 13   4.763889    0.5304431           0.9616955    0.2813699      4.424742
#> 14   4.416667    0.5304431           0.9616955    0.2813699      4.424742
#> 15   5.069444    0.5304431           0.9616955    0.2813699      4.424742
#> 16   3.930556    0.5304431           0.9616955    0.2813699      4.424742
#> 17   3.527778    0.5304431           0.9616955    0.2813699      4.424742
#> 18   4.666667    0.5304431           0.9616955    0.2813699      4.424742
#> 19   4.972222    0.5304431           0.9616955    0.2813699      4.424742
#> 20   6.027778    0.5304431           0.9616955    0.2813699      4.424742
#> 21   5.277778    0.5304431           0.9616955    0.2813699      4.424742
#> 22   6.430556    0.5304431           0.9616955    0.2813699      4.424742
#> 23   4.375000    0.5304431           0.9616955    0.2813699      4.424742
#> 24   3.652778    0.5304431           0.9616955    0.2813699      4.424742
#> 25   4.138889    0.5304431           0.9616955    0.2813699      4.424742
#> 26   4.236111    0.5304431           0.9616955    0.2813699      4.424742
#> 27   5.083333    0.5304431           0.9616955    0.2813699      4.424742
#> 28   4.375000    0.5304431           0.9616955    0.2813699      4.424742
#> 29   4.972222    0.5304431           0.9616955    0.2813699      4.424742
#> 30   3.416667    0.5304431           0.9616955    0.2813699      4.424742
#> 31   3.541667    0.5304431           0.9616955    0.2813699      4.424742
#> 32   3.083333    0.5304431           0.9616955    0.2813699      4.424742
#> 33   4.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 34   4.180556    0.5304431           0.9616955    0.2813699      4.424742
#> 35   2.861111    0.5304431           0.9616955    0.2813699      4.424742
#> 36   3.527778    0.5304431           0.9616955    0.2813699      4.424742
#> 37   5.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 38   3.527778    0.5304431           0.9616955    0.2813699      4.424742
#> 39   4.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 40   5.361111    0.5304431           0.9616955    0.2813699      4.424742
#> 41   3.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 42   3.138889    0.5304431           0.9616955    0.2813699      4.424742
#> 43   2.694444    0.5304431           0.9616955    0.2813699      4.424742
#> 44   3.763889    0.5304431           0.9616955    0.2813699      4.424742
#> 45   4.861111    0.5304431           0.9616955    0.2813699      4.424742
#> 46   5.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 47   6.555556    0.5304431           0.9616955    0.2813699      4.424742
#> 48   3.097222    0.5304431           0.9616955    0.2813699      4.424742
#> 49   4.194444    0.5304431           0.9616955    0.2813699      4.424742
#> 50   3.958333    0.5304431           0.9616955    0.2813699      4.424742
#> 51   5.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 52   5.041667    0.5304431           0.9616955    0.2813699      4.424742
#> 53   4.861111    0.5304431           0.9616955    0.2813699      4.424742
#> 54   3.888889    0.5304431           0.9616955    0.2813699      4.424742
#> 55   5.041667    0.5304431           0.9616955    0.2813699      4.424742
#> 56   4.347222    0.5304431           0.9616955    0.2813699      4.424742
#> 57   4.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 58   4.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 59   4.111111    0.5304431           0.9616955    0.2813699      4.424742
#> 60   3.888889    0.5304431           0.9616955    0.2813699      4.424742
#> 61   4.819444    0.5304431           0.9616955    0.2813699      4.424742
#> 62   4.541667    0.5304431           0.9616955    0.2813699      4.424742
#> 63   4.486111    0.5304431           0.9616955    0.2813699      4.424742
#> 64   3.861111    0.5304431           0.9616955    0.2813699      4.424742
#> 65   4.347222    0.5304431           0.9616955    0.2813699      4.424742
#> 66   5.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 67   5.750000    0.5304431           0.9616955    0.2813699      4.424742
#> 68   4.680556    0.5304431           0.9616955    0.2813699      4.424742
#> 69   2.902778    0.5304431           0.9616955    0.2813699      4.424742
#> 70   3.472222    0.5304431           0.9616955    0.2813699      4.424742
#> 71   1.972222    0.5304431           0.9616955    0.2813699      4.424742
#> 72   5.652778    0.5304431           0.9616955    0.2813699      4.424742
#> 73   4.041667    0.5304431           0.9616955    0.2813699      4.424742
#> 74   4.750000    0.5304431           0.9616955    0.2813699      4.424742
#> 75   3.847222    0.5304431           0.9616955    0.2813699      4.424742
#> 76   3.819444    0.5304431           0.9616955    0.2813699      4.424742
#> 77   4.930556    0.5304431           0.9616955    0.2813699      4.424742
#> 78   2.930556    0.5304431           0.9616955    0.2813699      4.424742
#> 79   5.319444    0.5304431           0.9616955    0.2813699      4.424742
#> 80   3.916667    0.5304431           0.9616955    0.2813699      4.424742
#> 81   4.083333    0.5304431           0.9616955    0.2813699      4.424742
#> 82   5.638889    0.5304431           0.9616955    0.2813699      4.424742
#> 83   5.111111    0.5304431           0.9616955    0.2813699      4.424742
#> 84   4.361111    0.5304431           0.9616955    0.2813699      4.424742
#> 85   2.958333    0.5304431           0.9616955    0.2813699      4.424742
#> 86   5.027778    0.5304431           0.9616955    0.2813699      4.424742
#> 87   5.125000    0.5304431           0.9616955    0.2813699      4.424742
#> 88   4.694444    0.5304431           0.9616955    0.2813699      4.424742
#> 89   4.611111    0.5304431           0.9616955    0.2813699      4.424742
#> 90   4.250000    0.5304431           0.9616955    0.2813699      4.424742
#> 91   4.375000    0.5304431           0.9616955    0.2813699      4.424742
#> 92   4.486111    0.5304431           0.9616955    0.2813699      4.424742
#> 93   4.013889    0.5304431           0.9616955    0.2813699      4.424742
#> 94   2.902778    0.5304431           0.9616955    0.2813699      4.424742
#> 95   3.513889    0.5304431           0.9616955    0.2813699      4.424742
#> 96   5.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 97   3.194444    0.5304431           0.9616955    0.2813699      4.424742
#> 98   5.708333    0.5304431           0.9616955    0.2813699      4.424742
#> 99   3.375000    0.5304431           0.9616955    0.2813699      4.424742
#> 100  4.833333    0.5304431           0.9616955    0.2813699      4.424742
#> 101  4.763889    0.5304431           0.9616955    0.2813699      4.424742
#> 102  4.958333    0.5304431           0.9616955    0.2813699      4.424742
#> 103  4.652778    0.5304431           0.9616955    0.2813699      4.424742
#> 104  3.847222    0.5304431           0.9616955    0.2813699      4.424742
#> 105  6.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 106  4.708333    0.5304431           0.9616955    0.2813699      4.424742
#> 107  4.694444    0.5304431           0.9616955    0.2813699      4.424742
#> 108  5.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 109  4.486111    0.5304431           0.9616955    0.2813699      4.424742
#> 110  3.555556    0.5304431           0.9616955    0.2813699      4.424742
#> 111  6.430556    0.5304431           0.9616955    0.2813699      4.424742
#> 112  4.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 113  5.555556    0.5304431           0.9616955    0.2813699      4.424742
#> 114  4.472222    0.5304431           0.9616955    0.2813699      4.424742
#> 115  5.180556    0.5304431           0.9616955    0.2813699      4.424742
#> 116  3.638889    0.5304431           0.9616955    0.2813699      4.424742
#> 117  4.472222    0.5304431           0.9616955    0.2813699      4.424742
#> 118  4.527778    0.5304431           0.9616955    0.2813699      4.424742
#> 119  4.708333    0.5304431           0.9616955    0.2813699      4.424742
#> 120  3.680556    0.5304431           0.9616955    0.2813699      4.424742
#> 121  4.111111    0.5304431           0.9616955    0.2813699      4.424742
#> 122  4.291667    0.5304431           0.9616955    0.2813699      4.424742
#> 123  6.250000    0.5304431           0.9616955    0.2813699      4.424742
#> 124  4.902778    0.5304431           0.9616955    0.2813699      4.424742
#> 125  5.680556    0.5304431           0.9616955    0.2813699      4.424742
#> 126  5.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 127  4.111111    0.5304431           0.9616955    0.2813699      4.424742
#> 128  4.319444    0.5304431           0.9616955    0.2813699      4.424742
#> 129  5.583333    0.5304431           0.9616955    0.2813699      4.424742
#> 130  3.708333    0.5304431           0.9616955    0.2813699      4.424742
#> 131  5.513889    0.5304431           0.9616955    0.2813699      4.424742
#> 132  4.888889    0.5304431           0.9616955    0.2813699      4.424742
#> 133  4.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 134  3.666667    0.5304431           0.9616955    0.2813699      4.424742
#> 135  5.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 136  5.763889    0.5304431           0.9616955    0.2813699      4.424742
#> 137  4.861111    0.5304431           0.9616955    0.2813699      4.424742
#> 138  4.888889    0.5304431           0.9616955    0.2813699      4.424742
#> 139  5.583333    0.5304431           0.9616955    0.2813699      4.424742
#> 140  4.222222    0.5304431           0.9616955    0.2813699      4.424742
#> 141  2.805556    0.5304431           0.9616955    0.2813699      4.424742
#> 142  5.666667    0.5304431           0.9616955    0.2813699      4.424742
#> 143  6.680556    0.5304431           0.9616955    0.2813699      4.424742
#> 144  6.027778    0.5304431           0.9616955    0.2813699      4.424742
#> 145  2.708333    0.5304431           0.9616955    0.2813699      4.424742
#> 146  3.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 147  3.805556    0.5304431           0.9616955    0.2813699      4.424742
#> 148  4.013889    0.5304431           0.9616955    0.2813699      4.424742
#> 149  4.402778    0.5304431           0.9616955    0.2813699      4.424742
#> 150  5.513889    0.5304431           0.9616955    0.2813699      4.424742
#> 151  6.111111    0.5304431           0.9616955    0.2813699      4.424742
#> 152  4.236111    0.5304431           0.9616955    0.2813699      4.424742
#> 153  4.069444    0.5304431           0.9616955    0.2813699      4.424742
#> 154  4.513889    0.5304431           0.9616955    0.2813699      4.424742
#> 155  4.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 156  3.944444    0.5304431           0.9616955    0.2813699      4.424742
#> 157  3.027778    0.5304431           0.9616955    0.2813699      4.424742
#> 158  4.375000    0.5304431           0.9616955    0.2813699      4.424742
#> 159  4.805556    0.5304431           0.9616955    0.2813699      4.424742
#> 160  3.902778    0.5304431           0.9616955    0.2813699      4.424742
#> 161  3.388889    0.5304431           0.9616955    0.2813699      4.424742
#> 162  4.583333    0.5304431           0.9616955    0.2813699      4.424742
#> 163  6.250000    0.5304431           0.9616955    0.2813699      4.424742
#> 164  4.013889    0.5304431           0.9616955    0.2813699      4.424742
#> 165  4.208333    0.5304431           0.9616955    0.2813699      4.424742
#> 166  3.444444    0.5304431           0.9616955    0.2813699      4.424742
#> 167  3.916667    0.5304431           0.9616955    0.2813699      4.424742
#> 168  3.861111    0.5304431           0.9616955    0.2813699      4.424742
#> 169  5.194444    0.5304431           0.9616955    0.2813699      4.424742
#> 170  2.944444    0.5304431           0.9616955    0.2813699      4.424742
#> 171  5.222222    0.5304431           0.9616955    0.2813699      4.424742
#> 172  4.722222    0.5304431           0.9616955    0.2813699      4.424742
#> 173  5.666667    0.5304431           0.9616955    0.2813699      4.424742
#> 174  4.972222    0.5304431           0.9616955    0.2813699      4.424742
#> 175  4.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 176  5.250000    0.5304431           0.9616955    0.2813699      4.424742
#> 177  3.250000    0.5304431           0.9616955    0.2813699      4.424742
#> 178  5.472222    0.5304431           0.9616955    0.2813699      4.424742
#> 179  4.458333    0.5304431           0.9616955    0.2813699      4.424742
#> 180  5.708333    0.5304431           0.9616955    0.2813699      4.424742
#> 181  4.750000    0.5304431           0.9616955    0.2813699      4.424742
#> 182  4.236111    0.5304431           0.9616955    0.2813699      4.424742
#> 183  3.680556    0.5304431           0.9616955    0.2813699      4.424742
#> 184  3.583333    0.5304431           0.9616955    0.2813699      4.424742
#> 185  4.097222    0.5304431           0.9616955    0.2813699      4.424742
#> 186  4.680556    0.5304431           0.9616955    0.2813699      4.424742
#> 187  3.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 188  3.875000    0.5304431           0.9616955    0.2813699      4.424742
#> 189  3.472222    0.5304431           0.9616955    0.2813699      4.424742
#> 190  3.222222    0.5304431           0.9616955    0.2813699      4.424742
#> 191  3.805556    0.5304431           0.9616955    0.2813699      4.424742
#> 192  4.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 193  4.638889    0.5304431           0.9616955    0.2813699      4.424742
#> 194  3.041667    0.5304431           0.9616955    0.2813699      4.424742
#> 195  2.888889    0.5304431           0.9616955    0.2813699      4.424742
#> 196  4.208333    0.5304431           0.9616955    0.2813699      4.424742
#> 197  3.902778    0.5304431           0.9616955    0.2813699      4.424742
#> 198  4.013889    0.5304431           0.9616955    0.2813699      4.424742
#> 199  3.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 200  3.805556    0.5304431           0.9616955    0.2813699      4.424742
#> 201  5.208333    0.5304431           0.9616955    0.2813699      4.424742
#> 202  4.361111    0.5304431           0.9616955    0.2813699      4.424742
#> 203  3.888889    0.5304431           0.9616955    0.2813699      4.424742
#> 204  3.916667    0.5304431           0.9616955    0.2813699      4.424742
#> 205  3.847222    0.5304431           0.9616955    0.2813699      4.424742
#> 206  4.819444    0.5304431           0.9616955    0.2813699      4.424742
#> 207  4.736111    0.5304431           0.9616955    0.2813699      4.424742
#> 208  3.013889    0.5304431           0.9616955    0.2813699      4.424742
#> 209  4.555556    0.5304431           0.9616955    0.2813699      4.424742
#> 210  4.263889    0.5304431           0.9616955    0.2813699      4.424742
#> 211  5.305556    0.5304431           0.9616955    0.2813699      4.424742
#> 212  4.625000    0.5304431           0.9616955    0.2813699      4.424742
#> 213  4.027778    0.5304431           0.9616955    0.2813699      4.424742
#> 214  5.597222    0.5304431           0.9616955    0.2813699      4.424742
#> 215  3.388889    0.5304431           0.9616955    0.2813699      4.424742
#> 216  4.847222    0.5304431           0.9616955    0.2813699      4.424742
#> 217  4.611111    0.5304431           0.9616955    0.2813699      4.424742
#> 218  4.111111    0.5304431           0.9616955    0.2813699      4.424742
#> 219  4.722222    0.5304431           0.9616955    0.2813699      4.424742
#> 220  4.347222    0.5304431           0.9616955    0.2813699      4.424742
#> 221  3.694444    0.5304431           0.9616955    0.2813699      4.424742
#> 222  2.652778    0.5304431           0.9616955    0.2813699      4.424742
#> 223  6.791667    0.5304431           0.9616955    0.2813699      4.424742
#> 224  2.597222    0.5304431           0.9616955    0.2813699      4.424742
#> 225  4.486111    0.5304431           0.9616955    0.2813699      4.424742
#> 226  5.819444    0.5304431           0.9616955    0.2813699      4.424742
#> 227  4.555556    0.5304431           0.9616955    0.2813699      4.424742
#> 228  3.388889    0.5304431           0.9616955    0.2813699      4.424742
#> 229  3.763889    0.5304431           0.9616955    0.2813699      4.424742
#> 230  5.708333    0.5304431           0.9616955    0.2813699      4.424742
#> 231  3.222222    0.5304431           0.9616955    0.2813699      4.424742
#> 232  3.541667    0.5304431           0.9616955    0.2813699      4.424742
#> 233  2.500000    0.5304431           0.9616955    0.2813699      4.424742
#> 234  4.666667    0.5304431           0.9616955    0.2813699      4.424742
#> 235  3.611111    0.5304431           0.9616955    0.2813699      4.424742
#> 236  3.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 237  4.250000    0.5304431           0.9616955    0.2813699      4.424742
#> 238  4.569444    0.5304431           0.9616955    0.2813699      4.424742
#> 239  5.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 240  5.083333    0.5304431           0.9616955    0.2813699      4.424742
#> 241  5.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 242  4.972222    0.5304431           0.9616955    0.2813699      4.424742
#> 243  4.875000    0.5304431           0.9616955    0.2813699      4.424742
#> 244  5.097222    0.5304431           0.9616955    0.2813699      4.424742
#> 245  3.805556    0.5304431           0.9616955    0.2813699      4.424742
#> 246  6.361111    0.5304431           0.9616955    0.2813699      4.424742
#> 247  5.361111    0.5304431           0.9616955    0.2813699      4.424742
#> 248  4.569444    0.5304431           0.9616955    0.2813699      4.424742
#> 249  5.069444    0.5304431           0.9616955    0.2813699      4.424742
#> 250  3.152778    0.5304431           0.9616955    0.2813699      4.424742
#> 251  5.097222    0.5304431           0.9616955    0.2813699      4.424742
#> 252  6.416667    0.5304431           0.9616955    0.2813699      4.424742
#> 253  4.916667    0.5304431           0.9616955    0.2813699      4.424742
#> 254  4.041667    0.5304431           0.9616955    0.2813699      4.424742
#> 255  5.180556    0.5304431           0.9616955    0.2813699      4.424742
#> 256  4.597222    0.5304431           0.9616955    0.2813699      4.424742
#> 257  5.430556    0.5304431           0.9616955    0.2813699      4.424742
#> 258  5.333333    0.5304431           0.9616955    0.2813699      4.424742
#> 259  6.375000    0.5304431           0.9616955    0.2813699      4.424742
#> 260  2.500000    0.5304431           0.9616955    0.2813699      4.424742
#> 261  4.638889    0.5304431           0.9616955    0.2813699      4.424742
#> 262  3.902778    0.5304431           0.9616955    0.2813699      4.424742
#> 263  3.513889    0.5304431           0.9616955    0.2813699      4.424742
#> 264  4.819444    0.5304431           0.9616955    0.2813699      4.424742
#> 265  4.152778    0.5304431           0.9616955    0.2813699      4.424742
#> 266  4.291667    0.5304431           0.9616955    0.2813699      4.424742
#> 267  5.069444    0.5304431           0.9616955    0.2813699      4.424742
#> 268  5.055556    0.5304431           0.9616955    0.2813699      4.424742
#> 269  5.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 270  3.819444    0.5304431           0.9616955    0.2813699      4.424742
#> 271  4.666667    0.5304431           0.9616955    0.2813699      4.424742
#> 272  5.138889    0.5304431           0.9616955    0.2813699      4.424742
#> 273  4.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 274  4.277778    0.5304431           0.9616955    0.2813699      4.424742
#> 275  5.416667    0.5304431           0.9616955    0.2813699      4.424742
#> 276  3.472222    0.5304431           0.9616955    0.2813699      4.424742
#> 277  4.111111    0.5304431           0.9616955    0.2813699      4.424742
#> 278  4.180556    0.5304431           0.9616955    0.2813699      4.424742
#> 279  4.569444    0.5304431           0.9616955    0.2813699      4.424742
#> 280  4.597222    0.5304431           0.9616955    0.2813699      4.424742
#> 281  3.291667    0.5304431           0.9616955    0.2813699      4.424742
#> 282  4.888889    0.5304431           0.9616955    0.2813699      4.424742
#> 283  4.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 284  4.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 285  4.000000    0.5304431           0.9616955    0.2813699      4.424742
#> 286  4.277778    0.5304431           0.9616955    0.2813699      4.424742
#> 287  4.847222    0.5304431           0.9616955    0.2813699      4.424742
#> 288  3.763889    0.5304431           0.9616955    0.2813699      4.424742
#> 289  3.666667    0.5304431           0.9616955    0.2813699      4.424742
#> 290  4.875000    0.5304431           0.9616955    0.2813699      4.424742
#> 291  2.986111    0.5304431           0.9616955    0.2813699      4.424742
#> 292  3.930556    0.5304431           0.9616955    0.2813699      4.424742
#> 293  4.263889    0.5304431           0.9616955    0.2813699      4.424742
#> 294  4.430556    0.5304431           0.9616955    0.2813699      4.424742
#> 295  4.694444    0.5304431           0.9616955    0.2813699      4.424742
#> 296  5.222222    0.5304431           0.9616955    0.2813699      4.424742
#> 297  4.125000    0.5304431           0.9616955    0.2813699      4.424742
#> 298  3.541667    0.5304431           0.9616955    0.2813699      4.424742
#> 299  4.013889    0.5304431           0.9616955    0.2813699      4.424742
#> 300  3.861111    0.5304431           0.9616955    0.2813699      4.424742
#> 301  4.569444    0.5304431           0.9616955    0.2813699      4.424742

# merMod: one row per cluster, with a trailing id column holding the
# cluster (Subject) level
library(lme4)
#> Loading required package: Matrix
lmod <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
fs_indiv(get_fs(lmod))
#>          fs_u0       fs_u1 fs_u0_se fs_u1_se u0_by_fs_u0 u0_by_fs_u1
#> 1    2.2585509   9.1989758 9.741415 1.909779   0.7512951  0.03757244
#> 2  -40.3987381  -8.6196806 9.741415 1.909779   0.7512951  0.03757244
#> 3  -38.9604090  -5.4488565 9.741415 1.909779   0.7512951  0.03757244
#> 4   23.6906196  -4.8143503 9.741415 1.909779   0.7512951  0.03757244
#> 5   22.2603126  -3.0699116 9.741415 1.909779   0.7512951  0.03757244
#> 6    9.0395679  -0.2721770 9.741415 1.909779   0.7512951  0.03757244
#> 7   16.8405086  -0.2236361 9.741415 1.909779   0.7512951  0.03757244
#> 8   -7.2326151   1.0745816 9.741415 1.909779   0.7512951  0.03757244
#> 9   -0.3336684 -10.7521652 9.741415 1.909779   0.7512951  0.03757244
#> 10  34.8904868   8.6282652 9.741415 1.909779   0.7512951  0.03757244
#> 11 -25.2102286   1.1734322 9.741415 1.909779   0.7512951  0.03757244
#> 12 -13.0700342   6.6142178 9.741415 1.909779   0.7512951  0.03757244
#> 13   4.5778642  -3.0152621 9.741415 1.909779   0.7512951  0.03757244
#> 14  20.8636782   3.5360011 9.741415 1.909779   0.7512951  0.03757244
#> 15   3.2754656   0.8722149 9.741415 1.909779   0.7512951  0.03757244
#> 16 -25.6129993   4.8224850 9.741415 1.909779   0.7512951  0.03757244
#> 17   0.8070461  -0.9881562 9.741415 1.909779   0.7512951  0.03757244
#> 18  12.3145921   1.2840221 9.741415 1.909779   0.7512951  0.03757244
#>    u1_by_fs_u0 u1_by_fs_u1 ev_fs_u0 ecov_fs_u1_fs_u0 ev_fs_u1  id
#> 1    0.6795552   0.8382416 94.89517        -12.50116 3.647254 308
#> 2    0.6795552   0.8382416 94.89517        -12.50116 3.647254 309
#> 3    0.6795552   0.8382416 94.89517        -12.50116 3.647254 310
#> 4    0.6795552   0.8382416 94.89517        -12.50116 3.647254 330
#> 5    0.6795552   0.8382416 94.89517        -12.50116 3.647254 331
#> 6    0.6795552   0.8382416 94.89517        -12.50116 3.647254 332
#> 7    0.6795552   0.8382416 94.89517        -12.50116 3.647254 333
#> 8    0.6795552   0.8382416 94.89517        -12.50116 3.647254 334
#> 9    0.6795552   0.8382416 94.89517        -12.50116 3.647254 335
#> 10   0.6795552   0.8382416 94.89517        -12.50116 3.647254 337
#> 11   0.6795552   0.8382416 94.89517        -12.50116 3.647254 349
#> 12   0.6795552   0.8382416 94.89517        -12.50116 3.647254 350
#> 13   0.6795552   0.8382416 94.89517        -12.50116 3.647254 351
#> 14   0.6795552   0.8382416 94.89517        -12.50116 3.647254 352
#> 15   0.6795552   0.8382416 94.89517        -12.50116 3.647254 369
#> 16   0.6795552   0.8382416 94.89517        -12.50116 3.647254 370
#> 17   0.6795552   0.8382416 94.89517        -12.50116 3.647254 371
#> 18   0.6795552   0.8382416 94.89517        -12.50116 3.647254 372