simulate_event_log: Simulate grouped educational event logs

View source: R/educational_sequences.R

simulate_event_logR Documentation

Simulate grouped educational event logs

Description

Simulate grouped educational event logs

Usage

simulate_event_log(
  groups = 5L,
  actors = 10L,
  courses = 1L,
  states = NULL,
  n_states = 8L,
  state_categories = "all",
  sequence_length = c(10L, 30L),
  achievement_levels = c("low", "medium", "high"),
  achievement_probabilities = NULL,
  start_time = as.POSIXct("2020-01-01", tz = "UTC"),
  interval_range = c(60, 600),
  transitions = NULL,
  initial = NULL,
  seed = NULL,
  ...,
  batch = NULL
)

Arguments

groups

Number of groups.

actors

Actors per group.

courses

Number or labels of courses.

states, n_states, state_categories

State-space options.

sequence_length

Fixed length or minimum/maximum range.

achievement_levels

Achievement labels.

achievement_probabilities

Achievement probabilities, one per level and summing to one. When NULL, the levels are equally likely.

start_time

Initial timestamp. Every actor's first event is placed at this time.

interval_range

Minimum and maximum seconds between an actor's consecutive events, drawn uniformly.

transitions

Common matrix, one matrix per group, or NULL.

initial

Initial probabilities.

seed

Optional random seed.

...

Advanced options passed to simulate_group_sequences().

batch

Optional single positive whole number. When given, the simulator runs batch times and returns a plain list of batch results, each exactly what the same call without batch returns. With a seed, every dataset gets its own seed drawn from seed, so the whole batch is reproducible; without one the datasets are consecutive draws from the session's random-number stream. The default NULL returns a single result.

Value

A long-form simulab_sim base data.frame with one row per actor event and columns group, id, course, achievement, period, state, and timestamp. as.data.frame(x, what = ) also returns transitions (group, from, to, probability), actors (group, id, course, achievement), groups (group, actors), wide (one row per actor, columns id, S1, ..., plus actor metadata), and one_hot (the event log with state replaced by indicator columns).

Examples

result <- simulate_event_log(groups = 2, actors = 10, sequence_length = 8, seed = 1)
head(result)
components(result)

simulab documentation built on Oct. 15, 2026, 5:08 p.m.