cleverly.interventions.Static#

class cleverly.interventions.Static(level: Any, name: str = '')[source]#

Set the treatment to one level for everybody: \(g^\star = \mathbb 1\{a = v\}\).

The degenerate regime, and the one the arm-keyed path has always estimated. It is here for two reasons beyond completeness: it is the reference a rule is usually contrasted against, and a fit whose regimes are all Static must reproduce the ordinary arm fit exactly, which is what tests/unit/test_regimes.py asserts.

Parameters:
levelAny

The treatment level to assign to every row, as the caller spells it.

namestr

Label used in reported parameter names. Empty builds "always <level>".

Attributes:
density_kind{“known”, “estimated”} or None

"known" when the exact type is Static, and None for a subclass.

Methods#

Static.density(data: CausalData) → ndarray[tuple[Any, ...], dtype[float64]][source]#

Evaluate this regime’s arm probabilities for every row.

Parameters:
dataCausalData

Validated study data, which supplies the covariates and the arm order.

Returns:
ndarray

(n, K) density, columns in arm-code order.

Attributes#

Static.density_kind#

"known" when the exact type is Static, and None for a subclass.

A level is not a function of the sample, so Static needs no declaration. A subclass can override density(), so it reads as undeclared, by the exact-type rule that MSM.linear also follows, until it declares density_kind itself.

Static.name: str = ''#
Static.level: Any#