Skip to contents

This function allows external packages or user code to register new estimators into the process-local CausalStress estimator registry. Registered estimators must obey the estimator contract: the generator function must accept (df, config, tau, ...) and return typed outputs or a supported legacy list(att, qst, meta) shape. See vignette("estimator-extension", package = "CausalStress").

Usage

cs_register_estimator(
  estimator_id,
  type,
  generator,
  oracle = FALSE,
  oracle_columns = character(0),
  oracle_default_columns = character(0),
  supports_qst = FALSE,
  version = "0.0.0-local",
  description = "",
  source = "external",
  requires_pkgs = character(0)
)

Arguments

estimator_id

Character scalar, unique identifier for the estimator.

type

Character scalar describing the estimator family (e.g. "gcomp", "ipw", "dr", "rf", "external").

generator

Function that implements the estimator, taking at least arguments (df, config = list(), tau = cs_tau_oracle, ...).

oracle

Logical, whether this is an oracle estimator.

oracle_columns

Character vector of truth columns this estimator is eligible to receive through the runner airlock. Allowed values in v0.2.0 are "p" and "structural_te".

oracle_default_columns

Character vector of eligible truth columns the runner grants without a user config flag. This should be empty except for internal benchmark estimators that cannot function otherwise.

supports_qst

Logical, whether the estimator returns QST values.

version

Character scalar, version string for the estimator implementation. Defaults to "0.0.0-local".

description

Character scalar, short human-readable description.

source

Character scalar indicating where the estimator comes from, e.g. "external", "optional". Defaults to "external".

requires_pkgs

Character vector of package names that must be installed for the estimator to work. Defaults to character(0).

Value

Invisibly, the updated registry tibble (core + extra).