bartz.debug.sample_data

bartz.debug.sample_data(key, state)[source]

Draw the data from the model given the parameters.

Replaces the outcome State.y, and the latent outcome State.z in binary regression. The predictors and the missing datapoints are left unchanged. State.resid is updated incrementally rather than recomputed, so any inconsistency it had with the other fields persists.

Parameters:
  • key (Key[Array, '']) – A jax random key.

  • state (StateT) – A BART MCMC state. If it has multiple chains, it must be a ChainDataState, to draw separate data for each chain.

Returns:

StateT – The state with new data.

Raises:

Notes

The memory of the input state is re-used for the output state, so the input state can not be used any more, like with bartz.mcmcstep.step.