Skip to contents

Continue sampling from a BCF model, appending additional draws to the existing posterior samples. The training data must be re-supplied (it is not retained on the model). The sampler initializes every term (prognostic + treatment forests, variance forest, random effects, tau_0, and adaptive-coding b0/b1) from its last retained sample.

Usage

# S3 method for class 'bcfmodel'
continueSampling(
  object,
  X_train,
  Z_train,
  y_train,
  propensity_train = NULL,
  rfx_group_ids_train = NULL,
  rfx_basis_train = NULL,
  X_test = NULL,
  Z_test = NULL,
  propensity_test = NULL,
  rfx_group_ids_test = NULL,
  rfx_basis_test = NULL,
  num_burnin = 0,
  num_mcmc = 100,
  general_params = list(),
  prognostic_forest_params = list(),
  treatment_effect_forest_params = list(),
  variance_forest_params = list(),
  random_effects_params = list(),
  ...
)

Arguments

object

Fitted bcfmodel to continue sampling.

X_train

Training covariates (re-supplied; same structure used to fit the model).

Z_train

Training treatment assignments (re-supplied).

y_train

Training outcome (re-supplied).

propensity_train

(Optional) Training propensity scores. Required if the model used a propensity covariate and no internal propensity model is available to re-derive them.

rfx_group_ids_train

(Optional) Training random effects group labels (required if the model has rfx).

rfx_basis_train

(Optional) Training random effects basis (required for a custom rfx model).

X_test

(Optional) Test covariates. When supplied, test-set predictions are recomputed in full from all retained forests, so the test set need not match any test set used in the original fit (the model may have been fit with none). When omitted, any cached test predictions are dropped.

Z_test

(Optional) Test treatment assignments (required when X_test is provided).

propensity_test

(Optional) Test propensity scores. Required if the model used a propensity covariate and no internal propensity model is available to re-derive them.

rfx_group_ids_test

(Optional) Test random effects group labels (required when X_test is provided and the model has rfx).

rfx_basis_test

(Optional) Test random effects basis (required for a custom rfx model when X_test is provided).

num_burnin

Number of additional burn-in iterations to discard. Default 0.

num_mcmc

Number of additional retained MCMC draws. Default 100.

general_params

(Optional) List of changeable general parameters (e.g. random_seed, keep_every, keep_burnin, cutpoint_grid_size, sigma2_global_shape, sigma2_global_scale, num_threads, verbose). May also include variable_weights (per-covariate split weights); if omitted, the fit-time weights are reused.

prognostic_forest_params

(Optional) Changeable prognostic (mu) forest parameters (alpha, beta, min_samples_leaf, max_depth, num_features_subsample, sigma2_leaf_shape, sigma2_leaf_scale). May also include keep_vars / drop_vars to change which covariates this forest may split on; if omitted, the fit-time split-variable subset is reused.

treatment_effect_forest_params

(Optional) Changeable treatment (tau) forest parameters (same keys as prognostic, including keep_vars / drop_vars).

variance_forest_params

(Optional) Changeable variance forest parameters (alpha, beta, min_samples_leaf, max_depth, num_features_subsample, var_forest_prior_shape, var_forest_prior_scale, and keep_vars / drop_vars).

random_effects_params

(Optional) Changeable random effects parameters (variance_prior_shape, variance_prior_scale — the inverse-gamma prior on the random effects group-parameter variance). Ignored if the model has no random effects.

...

Other parameters (ignored).

Value

The updated bcfmodel (mutated in place; the sampled forests are extended).