Skip to contents

lagdynamics fits lag sequential analysis models, reads them as lag transition networks, and assesses, compares and plots them. Lag sequential analysis (LSA; Sackett, 1979; Bakeman & Gottman, 1997) tests whether, in a stream of coded events, one behaviour follows another more or less often than chance would predict.

The observed transitions at a given lag are counted into a contingency table of antecedent by consequent states, an expected table is derived under the hypothesis that the two are independent, and each cell is tested with an adjusted residual (Haberman, 1979). The cells that depart from independence form a lag transition network: a directed graph whose edges are the over- and under-represented sequential contingencies.

The model is fitted with one constructor, lsa(), which accepts event sequences, wide sequence tables, transition-count matrices, long event logs and sequence objects from tna, Nestimate and TraMineR. Results are read with verbs that return tidy data frames, assessed with resampling and analytic inference, compared across groups, and drawn as heatmaps, networks, chord diagrams and polar displays.

The documentation site, with tutorials and case studies, is at https://pak.dynasite.org/lagdynamics/.

Workflow

  1. Fit a model with lsa(): choose the lag, the engine (the classical test of Bakeman & Quera, 1995, or the two-cell, bidirectional and dominance tests of Sackett, 1979, and Wampold, 1984), and any structurally forbidden transitions. A group argument fits one model per group on a shared state set.

  2. Read the fit with transitions(), nodes(), tests(), initial(), transition_probabilities() and summary().

  3. Evaluate how far the transitions can be trusted: bootstrap_lsa(), certainty_lsa(), permute_lsa(), stability_lsa() and reliability_lsa().

  4. Compare groups with compare_lsa() (permutation test) or bayes_compare_lsa() (Dirichlet-multinomial posterior).

  5. Plot the fit or a comparison: plot.lsa(), plot_transitions(), plot_chords(), plot_polar(), plot_forest() and plot.lsa_comparison().

  6. Go beyond LSA with multi-lag profiles (lsa_lags(), lag_profile()), directed transfer entropy (transfer_entropy()) and Transition Network Analysis through lsa_to_tna().

Data

engagement (engagement states of 138 students over 15 time points), group_regulation and group_regulation_long (collaborative regulation actions, as a wide sequence table and as a long event log), and ai_long (coded AI behaviours in human-AI programming sessions).

Formulas and sources

Each formula the package implements is listed with its primary source, page and equation number in the file REFERENCES.md installed with the package; its location is given by system.file("REFERENCES.md", package = "lagdynamics").

Fits are objects of class c("lsa", "cograph_network"), so the network functions of cograph accept them directly.

References

Bakeman, R., & Gottman, J. M. (1997). Observing interaction: An introduction to sequential analysis (2nd ed.). Cambridge University Press.

Bakeman, R., & Quera, V. (1995). Analyzing interaction: Sequential analysis with SDIS and GSEQ. Cambridge University Press.

Christensen, R. (1997). Log-linear models and logistic regression (2nd ed.). Springer.

Haberman, S. J. (1979). Analysis of qualitative data: Volume 2, New developments. Academic Press.

Sackett, G. P. (1979). The lag sequential analysis of contingency and cyclicity in behavioral interaction research. In J. D. Osofsky (Ed.), Handbook of infant development (pp. 623-649). Wiley.

Wampold, B. E. (1984). Tests of dominance in sequential categorical data. Psychological Bulletin, 96(2), 424-429.

Wickens, T. D. (1989). Multiway contingency tables analysis for the social sciences. Lawrence Erlbaum.

See also

lsa() to start; https://pak.dynasite.org/lagdynamics/ for the tutorials.

Author

Maintainer: Mohammed Saqr [email protected] (ORCID) [copyright holder]

Authors: