Extracts multiplicative latent factor positions (U and V) from a fitted
ame, lame or ame_als model and returns them as a
tidy data frame suitable for plotting and analysis. Optionally applies
Procrustes alignment for dynamic models and includes posterior standard
deviations when posterior samples are available.
Usage
latent_positions(object, ...)
# S3 method for class 'ame'
latent_positions(object, align = FALSE, ...)
# S3 method for class 'lame'
latent_positions(object, align = TRUE, ...)
# S3 method for class 'ame_als'
latent_positions(object, align = FALSE, ...)Value
A data frame with columns:
- actor
Character. Actor name (from rownames of U or V).
- dimension
Integer. Latent dimension index (1 to R).
- time
Character. Time period label. Dynamic fits use the time labels from the input; static (cross-sectional) fits return
"1"for every row so downstream filtering bytimebehaves the same in both cases.- value
Numeric. The posterior mean latent position.
- posterior_sd
Numeric. Posterior standard deviation of the latent position, or
NAif posterior samples are not available. To enable, fit the model withposterior_opts = posterior_options(save_UV = TRUE).- type
Character.
"U"for sender/row positions,"V"for receiver/column positions. Symmetric models have only"U".
Returns a zero-row data frame with correct column names if R = 0.
See also
procrustes_align for standalone Procrustes alignment,
uv_plot for visualizing latent positions,
posterior_options for enabling posterior sampling of U/V
Examples
# \donttest{
data(YX_nrm)
fit <- ame(YX_nrm$Y, Xdyad = YX_nrm$X, R = 2,
burn = 5, nscan = 5, odens = 1, verbose = FALSE)
lp <- latent_positions(fit)
#> ℹ `posterior_sd` is "NA" because U/V samples were not saved.
#> ℹ To get posterior SDs, refit with `posterior_opts = posterior_options(save_UV
#> = TRUE)`.
#> This message is displayed once per session.
head(lp)
#> actor dimension time value posterior_sd type
#> 1 node1 1 1 -0.1288226 NA U
#> 2 node2 1 1 0.4080307 NA U
#> 3 node3 1 1 0.4575497 NA U
#> 4 node4 1 1 -0.1090946 NA U
#> 5 node5 1 1 0.1460432 NA U
#> 6 node6 1 1 0.1578961 NA U
# }