cleverly.validation.GaussianAdjustmentOutcome#

class cleverly.validation.GaussianAdjustmentOutcome(effect: float = 1.0, adjustment_scale: float = 1.0, noise: GaussianNoise = GaussianNoise(mean=0.0, standard_deviation=1.0))[source]#

Declare f(W) + effect * A + epsilon with Gaussian noise.

The adjustment function standardizes each nonconstant covariate, sums the standardized columns, divides by the square root of how many columns it summed, and multiplies the result by adjustment_scale. The root-count divisor holds the adjustment standard deviation at about adjustment_scale for any number of approximately independent covariates, so the confounding signal does not shrink against the fixed noise scale as the adjustment set widens. Correlated columns raise that standard deviation instead, which only makes a failure to adjust easier to detect. The known binary arm contrast is effect because the treatment term is additive.

Parameters:
effectfloat

Declared effect of treatment code one against code zero.

adjustment_scalefloat

Multiplier on the root-count normalized standardized covariate sum.

noiseGaussianNoise

Gaussian law for epsilon.

Methods#

GaussianAdjustmentOutcome.adjustment(covariates: Any) → ndarray[source]#

Evaluate the declared adjustment function.

Parameters:
covariatesarray_like

Covariate matrix with one row per observation.

Returns:
ndarray

Adjustment value for each row.

GaussianAdjustmentOutcome.draw(data: Any, *, seed: int) → ndarray[source]#

Draw one adjustment-dependent outcome vector.

Parameters:
dataCausalData

Analysis rows that supply covariates and treatment.

seedint

Child seed for the Gaussian noise.

Returns:
ndarray

One generated outcome per analysis row.

Attributes#

GaussianAdjustmentOutcome.adjustment_function: str = 'scaled_standardized_covariate_sum_over_root_count'#
GaussianAdjustmentOutcome.adjustment_scale: float = 1.0#
GaussianAdjustmentOutcome.effect: float = 1.0#
GaussianAdjustmentOutcome.family: str = 'gaussian'#
GaussianAdjustmentOutcome.known_effect#

Return the derived code-one against code-zero mean contrast.

GaussianAdjustmentOutcome.name: str = 'gaussian_adjustment_dependent'#
GaussianAdjustmentOutcome.noise: GaussianNoise = GaussianNoise(mean=0.0, standard_deviation=1.0)#
GaussianAdjustmentOutcome.noise_law#

Return the recorded Gaussian noise declaration.

GaussianAdjustmentOutcome.treatment_term: str = 'effect_times_treatment_code'#