diff_diff.PlaceboTestResults

class diff_diff.PlaceboTestResults[source]

Bases: object

Results from a placebo test for DiD assumption validation.

test_type

Type of placebo test performed.

Type:

str

placebo_effect

Estimated placebo treatment effect.

Type:

float

se

Standard error of the placebo effect.

Type:

float

t_stat

T-statistic for the placebo effect.

Type:

float

p_value

P-value for testing placebo_effect = 0.

Type:

float

conf_int

Confidence interval for the placebo effect.

Type:

tuple

n_obs

Number of observations used in the test.

Type:

int

is_significant

Whether the placebo effect is significant at alpha=0.05.

Type:

bool

original_effect

Original ATT estimate for comparison.

Type:

float, optional

original_se

Original SE for comparison.

Type:

float, optional

permutation_distribution

Distribution of permuted effects (for permutation test).

Type:

np.ndarray, optional

leave_one_out_effects

Unit-specific effects (for leave-one-out test).

Type:

dict, optional

fake_period

The fake treatment period used (for timing test).

Type:

any, optional

fake_group

The fake treatment group used (for group test).

Type:

list, optional

__init__(test_type, placebo_effect, se, t_stat, p_value, conf_int, n_obs, is_significant, alpha=0.05, original_effect=None, original_se=None, permutation_distribution=None, leave_one_out_effects=None, fake_period=None, fake_group=None, n_permutations=None)
Parameters:
Return type:

None

Methods

__init__(test_type, placebo_effect, se, ...)

print_summary()

Print summary to stdout.

summary()

Generate formatted summary of placebo test results.

to_dataframe()

Convert results to a DataFrame.

to_dict()

Convert results to a dictionary.

Attributes

alpha

fake_group

fake_period

leave_one_out_effects

n_permutations

original_effect

original_se

permutation_distribution

significance_stars

Return significance stars based on p-value.

test_type

placebo_effect

se

t_stat

p_value

conf_int

n_obs

is_significant

test_type: str
placebo_effect: float
se: float
t_stat: float
p_value: float
conf_int: Tuple[float, float]
n_obs: int
is_significant: bool
alpha: float = 0.05
original_effect: float | None = None
original_se: float | None = None
permutation_distribution: ndarray | None = None
leave_one_out_effects: Dict[Any, float] | None = None
fake_period: Any | None = None
fake_group: List[Any] | None = None
n_permutations: int | None = None
property significance_stars: str

Return significance stars based on p-value.

summary()[source]

Generate formatted summary of placebo test results.

Return type:

str

print_summary()[source]

Print summary to stdout.

Return type:

None

to_dict()[source]

Convert results to a dictionary.

Return type:

Dict[str, Any]

to_dataframe()[source]

Convert results to a DataFrame.

Return type:

DataFrame

__init__(test_type, placebo_effect, se, t_stat, p_value, conf_int, n_obs, is_significant, alpha=0.05, original_effect=None, original_se=None, permutation_distribution=None, leave_one_out_effects=None, fake_period=None, fake_group=None, n_permutations=None)
Parameters:
Return type:

None