simulate.fastglm_ordinal: Simulate categorical responses from an ordinal fit

View source: R/ordinal-methods.R

simulate.fastglm_ordinalR Documentation

Simulate categorical responses from an ordinal fit

Description

Generates independent categorical observations conditional on the retained predictors and offsets. Frequency rows are simulated as multinomial counts, so a frequency of ten generates ten observations at that predictor row.

Usage

## S3 method for class 'fastglm_ordinal'
simulate(object, nsim = 1L, seed = NULL, ...)

Arguments

object

a converged fastglm_ordinal model.

nsim

number of simulated response datasets, a positive integer.

seed

optional random seed. When supplied, the caller's random-number state is restored on exit.

...

further arguments; currently unused.

Details

The original category labels and their order are preserved. A collapsed category has fitted probability zero and therefore simulated count zero. This is simulation from the fitted distribution; it does not quantify uncertainty about a category absent from that distribution. Row totals are effective frequencies, including counts times fitting weights, and must not exceed .Machine$integer.max. Rows omitted under na.exclude are restored with missing values.

Value

For an individual response with unit frequency in every retained row, a data frame of ordered factors, one column per simulation. Otherwise a named list of count matrices, one per simulation, with rows matching the fitted design and columns in the declared category order. Count matrices already include the fitting frequencies and should be refitted with unit weights. They are not counts to which the original weights are reapplied.


fastglm documentation built on Nov. 11, 2026, 5:07 p.m.