Produces a variety of ggplot2 visualisations for a stacked-trait
multivariate GLLVM. Dispatches on type to one of five panels:
Arguments
- x
A
gllvmTMB_multifit.- type
One of
"correlation","loadings","integration","variance","ordination".- level
"unit"(between-unit) or"unit_obs"(within-unit). Legacy aliases"B"and"W"are accepted with a deprecation warning. Used by"loadings"(which level to plot; the defaultc("unit", "unit_obs")means "both available levels, faceted side-by-side"; pass a length-1 string to plot one tier) and"ordination"(single level required, default"unit"). Ignored for"correlation"(which always shows both if available),"integration", and"variance".Note: the default
level = c("unit", "unit_obs")is intentionally a length-2 vector, not the usualmatch.argshortcut. The dispatcher does not callmatch.arg(level)itself; each helper inspectsleveland decides whether to plot one tier or both. If you copy one of these helpers into your own code, mirror that pattern rather than reflexively callingmatch.arg(level)(which would silently collapse the default to"B"and drop the W panel).- boot
Optional bootstrap object (currently a list with elements
repeatability,communality_B,communality_W, each a data frame with columnstrait,lower,upper) used to add whiskers to the"integration"plot. DefaultNULLskips whiskers.- axes
Length-2 integer vector for
"ordination"whend >= 2. Defaultc(1, 2). Ignored whend = 1.- ...
Currently unused.
Details
"correlation"Combined heatmap of trait correlations. Upper triangle = between-unit correlations (
level = "unit"), lower triangle = within-unit correlations (level = "unit_obs"), diagonal = 1. Falls back to whichever level is present if the other tier is absent."loadings"Tile heatmap of
Lambda_B(andLambda_Wif present), faceted by level. Rows = traits, columns = factors. Pinned cells (fromlambda_constraint) are drawn with a heavy outline."integration"Dot-and-whisker plot of repeatability (ICC), between-tier communality and within-tier communality per trait, sorted by repeatability. Optional whiskers from a
bootobject (skipped ifboot = NULL)."variance"Stacked-bar variance partition per trait, using
extract_proportions(format = "long"). One bar per trait, stacks summing to 1."ordination"Two-axis biplot of latent scores plus loading arrows. 1D fits (
d = 1) get a horizontal lollipop; 2D fits get a standard biplot; ford >= 3pick the axis pair viaaxes.
