Stateless BWD Assignment with Automated History Parsing
Source:R/formr_wrapper.R
bwd_assign_next.RdHandles the full lifecycle of a BWD assignment in a stateless environment (like formr). It parses raw history data, replays events to synchronize state, assigns the next treatment, and formats the output for efficient storage (checkpointing).
Usage
bwd_assign_next(
current_covariates,
history = NULL,
bwd_settings,
history_covariate_cols = NULL,
checkpoint_interval = 20
)Arguments
- current_covariates
Numeric vector. The covariates for the current participant.
- history
The history object. Can be:
A
data.frame(result offormr_api_results).A
listof pre-parsed history entries.
- bwd_settings
List. Configuration for the balancer (e.g.
list(N=1000, D=5)).- history_covariate_cols
Character vector. Required if
historyis a data.frame. Specifies the column names in the dataframe that correspond tocurrent_covariates, in the exact same order.- checkpoint_interval
Integer. How often to save the full state (default 20). Interim entries will store NULL state to save bandwidth.