lagseq has one
plotting verb, plot(fit, type = ), plus dedicated plots for
the resampling and comparison results. Every view of a fit displays the
same quantity – the adjusted residual, the departure of a transition
from chance – and differs only in geometry. The single fit used
throughout is the bundled engagement data (138 students,
three engagement states).
| view | call | backend |
|---|---|---|
| residual heatmap | plot(fit) |
ggplot2 |
| residual network | plot(fit, type = "network") |
cograph |
| transition (TNA) network | plot(fit, type = "network", weights = "prob") |
tna |
| chord diagram | plot(fit, type = "chord") |
cograph |
| polar sunburst | plot(fit, type = "sunburst") |
ggplot2 |
| uncertainty forest | plot(bootstrap_lsa(fit)),
plot(certainty_lsa(fit)) |
ggplot2 |
| group barrel | plot(compare_lsa(g)),
plot(bayes_compare_lsa(g)) |
ggplot2 |
Colour. Two conventions are used, by purpose. The
residual heatmap, chord, and sunburst use the
residual diverging scale (warm = over- represented, cool = avoided). The
network and group comparison plots follow the wider
TNA / Nestimate convention – blue = more than chance,
red = less (avoided edges dashed) – so an
lsa network reads like any other transition network in that
ecosystem.
The default. Rows are the current state, columns the next; colour is
the adjusted residual. which selects the matrix.
The same residuals as a directed graph: blue edges (solid) are over-represented, red edges (dashed, with a soft halo) are avoided.
Weight the edges by probability and the view becomes the familiar
transition network: lagseq builds a tna object
on the fly and renders it with tna’s styling. This shows what happens,
where the residual network shows what is surprising.
A chord diagram of the transition flow, and a polar sunburst of each state’s outgoing distribution.
A fitted edge is one estimate; the forest shows its interval. Both the resampling bootstrap and the analytic certainty plot as a circular forest of per-edge intervals.
For a real grouping we use a long event log,
tna::group_regulation_long, and fit one model per
achievement group.
gfit <- lsa(tna::group_regulation_long, actor = "Actor",
action = "Action", time = "Time", group = "Achiever")plot() on a comparison draws a back-to-back
barrel: each group’s bar runs to one side, the higher
group’s bar is bordered (darker for a larger difference), and the centre
chip carries the difference p-value.
The Bayesian comparison reuses the same barrel, with the credible posterior in place of the permutation p-value.
Every type works on a grouped fit, drawing one panel per
group (combined = FALSE, the default) or a single tiled
figure (combined = TRUE).
plot(fit, type = ) is a front door over exported
workers, each with its own full argument list:
plot(fit) # residual heatmap (default)
plot(fit, type = "network") # residual network (blue = more)
plot(fit, type = "network", weights = "prob") # transition network (a TNA model)
plot(fit, type = "chord"); plot(fit, type = "sunburst")
plot(bootstrap_lsa(fit)); plot(certainty_lsa(fit)) # uncertainty forests
plot(compare_lsa(gfit)); plot(bayes_compare_lsa(gfit)) # group barrels
plot(gfit) # grouped: one panel per group