Skip to contents

Regresses the next state of a sequence on covariates, separately for every current state: one multinomial logit per row of the transition matrix, $$P(X_{t+1} = j \mid X_t = i, z) = \frac{\exp(\alpha_{ij} + \beta_{ij}^\top z)}{\sum_k \exp(\alpha_{ik} + \beta_{ik}^\top z)}.$$ Row \(i\) is fitted only on the transitions that leave \(i\). With no covariates the fitted probabilities are the observed row proportions, the relative TNA weights. Effects are read from the fitted model with transition_effects(), predicted_network() and transition_curve().

Usage

transition_regression(
  x,
  covariates = NULL,
  actor = NULL,
  estimator = c("auto", "penalized", "firth", "multinom"),
  drop_missing = FALSE,
  covariate_data = NULL,
  by = NULL,
  session_progress = NULL
)

# S3 method for class 'net_transition_regression'
print(x, ...)

# S3 method for class 'net_transition_regression'
summary(object, ...)

# S3 method for class 'net_transition_regression'
plot(x, term = NULL, value = NULL, ...)

Arguments

x

A network (see transition_data()) or a table returned by transition_data().

covariates

Character vector of covariate columns. Numeric columns enter as a slope, character or factor columns as one slope per level against the first. NULL fits intercepts only, which reproduces TNA.

actor

Character or NULL. The column whose units the bootstraps of transition_effects() and transition_curve() resample, such as the student when each student holds several sequences. NULL resamples sequences. The fit itself does not use it.

estimator

"auto" (default): maximum likelihood with nnet::multinom(), refitted penalized for a row whose fit does not converge or has a slope above 10 in absolute value (separation). "penalized": every row with a normal(0, 5) prior on the coefficients (multinom(decay = 0.02)). "firth": Firth's bias reduction (brglm2::brmultinom()), slow with continuous covariates. "multinom": maximum likelihood only.

drop_missing

Logical. FALSE (default) stops when a transition has a missing covariate (class nestimate_missing_covariate); TRUE leaves those transitions out with a message.

covariate_data

Optional data frame of covariates kept outside the network, such as one row per student, joined to the transitions by by.

by

Character. The key column(s) shared by the network's metadata and covariate_data. Each key must appear once in covariate_data.

session_progress

Optional c(session = , within = ), two column names. Adds session_progress: the position of a session among the sessions of its within unit, divided by their number. Sessions are ordered by the number that ends their id.

object, ...

For the summary() method: an object of class net_transition_regression; further arguments are ignored. For the plot() method, ... is passed to cograph::splot().

term, value

For the plot() method: the covariate and its value(s), as in predicted_network(). With term and no value, the networks at its two default values are drawn side by side.

Value

An object of class net_transition_regression: a list with fits (one fitted model per current state), transitions (the table that was fitted), covariates, actor, estimator (per state), converged (per state) and call, so that update(fit, covariates = ...) refits with one argument changed. summary() returns a data frame with one row per current state: from, transitions, targets (next states reached), parameters, deviance, estimator, converged. print() returns x invisibly; plot() draws the predicted network(s) with cograph and returns x invisibly.

Details

A row that does not converge raises a warning of class nestimate_no_converge. The penalized fit is the maximum a posteriori estimate under independent normal(0, 5) priors; it keeps the estimates finite under separation and moves a well-identified slope little.

References

Saqr, M., López-Pernas, S., Törmänen, T., Kaliisa, R., Misiejuk, K., & Tikka, S. (2025). Transition network analysis: A novel framework for modeling, visualizing, and identifying the temporal patterns of learners and learning processes. Proceedings of LAK 2025, 351-361. doi:10.1145/3706468.3706513

Examples

net <- build_ftna(group_regulation_long, action = "Action", actor = "Actor",
                  time = "Time")
fit <- transition_regression(net, covariates = c("Achiever", "progress"),
                             actor = "Group")
fit
#> Transition regression: 25533 transitions from 9 states
#>   Covariates: Achiever, progress
#>   Resampling unit: Group
#>   Rows fitted: 5 multinom, 4 penalized
#>   Converged: 9 of 9 rows
#>   summary() gives the fit of every row; transition_effects() and predicted_network() read the model.
summary(fit)
#>         from transitions targets parameters  deviance estimator converged
#> 1      adapt         509       7         18  1402.313 penalized      TRUE
#> 2   cohesion        1695       9         24  5119.741 penalized      TRUE
#> 3  consensus        6329       9         24 20831.347  multinom      TRUE
#> 4 coregulate        1970       9         24  7160.190  multinom      TRUE
#> 5    discuss        3951       9         24 14453.671  multinom      TRUE
#> 6    emotion        2837       9         24  9346.956 penalized      TRUE
#> 7    monitor        1433       9         24  4928.519  multinom      TRUE
#> 8       plan        6157       9         24 19170.103  multinom      TRUE
#> 9  synthesis         652       8         21  1938.772 penalized      TRUE