residuals.RprobitB_fit: Extract choice residuals

View source: R/prediction.R

residuals.RprobitB_fitR Documentation

Extract choice residuals

Description

Computes observed choice indicators minus posterior mean occasion-level choice probabilities.

Usage

## S3 method for class 'RprobitB_fit'
residuals(object, ...)

Arguments

object

[RprobitB_fit]
Fitted choice model.

...

Further arguments passed to predict().

Value

A numeric matrix with one row per choice occasion and one column per alternative. Rows with a missing response contain NA. For ranked data, the indicator represents the first-ranked alternative.

Examples

set.seed(1)
model <- fit(
  choice ~ x | 0, dgp_parameters = list(beta = c(x = 1)), chains = 1
)
head(residuals(model))

RprobitB documentation built on Sept. 20, 2026, 9:07 a.m.