meow: Conduct a full CAT simulation.

View source: R/meow.R

meowR Documentation

Conduct a full CAT simulation.

Description

meow() is the core function of this simulation framework. It exists to help users compare efficiency tradeoffs across different item selection algorithms, parameter update algorithms, and data generating processes. It takes as arguments an item selection function, a parameter update function, and a data loader function and uses these to carry out a simulation of a full CAT administration. Default behavior is to proceed until no further items are administered. Because the internal simulation logic stops as soon as an iteration administers no new items, early stopping conditions should be implemented within the item selection function (by declining to administer further items).

Usage

meow(
  select_fun,
  update_fun,
  data_loader,
  select_args = list(),
  update_args = list(),
  data_args = list(),
  init = NULL,
  fix = "none",
  keep_adj_mats = TRUE
)

Arguments

select_fun

A function that specifies the item selection algorithm.

update_fun

A function that specifies the parameter update algorithm.

data_loader

A function that specifies the data generating process.

select_args

A named list of arguments to be passed to select_fun.

update_args

A named list of arguments to be passed to update_fun.

data_args

A named list of arguments to be passed to data_loader.

init

A list of initialization values for estimated person and item parameters. Accepts a named list with two entries, pers and item, giving the initial estimated parameter data frames. Defaults to NULL, which initializes all estimated parameters to zero.

fix

Which estimated parameters to treat as fixed at their true values. One of none (the default), pers, item, or both.

keep_adj_mats

Logical; if TRUE (the default) an adjacency matrix is stored for every iteration. If FALSE, only the final adjacency matrix is retained, which saves memory for large item pools or long simulations.

Details

Simulation state

For speed, meow() represents responses with matrices rather than long data frames. Two matrices, each with one row per respondent and one column per item, are passed to the user-supplied modules:

  • R — the (potential) response of every respondent to every item. This is produced once from the long resp data frame returned by the data loader.

  • admin — an integer administration matrix. An entry of 0 means the item has not been administered to that respondent; a positive entry means it has, and the value encodes the order of administration. Use admin != 0 (or meow_administered()) as an administered mask.

Person and item parameters are kept as data frames (pers and item), each with an identifier column (id and item, respectively) followed by one column per parameter, so that users retain the flexibility to add arbitrary parameters.

Module contracts

An item selection function receives pers, item, R, admin, and adj_mat (plus any select_args) and returns an administration matrix with newly selected cells marked non-zero. The harness stamps the order of administration, so a function need only set newly selected cells to a positive value (or TRUE) while leaving previously administered cells unchanged.

A parameter update function receives pers, item, R, and admin (plus any update_args) and returns a list with updated pers and item data frames.

Module authors who prefer long data frames can convert with meow_long().

Value

A list of four named entities. results is a data frame with one row per iteration of the simulation. It contains an iter column for the iteration number and two columns per person and item parameter, one for the estimated parameter and one for the bias in that estimate. adj_mats is a list of item-item adjacency matrices, one per iteration (or, when keep_adj_mats = FALSE, a single-element list with the final matrix); edge weights count the number of respondents administered each pair of items. pers_tru and item_tru are the true person and item parameter data frames.

Examples

sim <- meow(
  select_fun = select_max_info,
  update_fun = update_theta_mle,
  data_loader = data_simple_1pl,
  data_args = list(N_persons = 20, N_items = 15),
  fix = "item"
)
head(sim$results)


meow documentation built on July 6, 2026, 5:11 p.m.