diff_diff.SimulationPowerResults#

class diff_diff.SimulationPowerResults[source]#

Bases: object

Results from simulation-based power analysis.

power#

Estimated power (proportion of simulations rejecting H0).

Type:

float

power_se#

Standard error of power estimate.

Type:

float

power_ci#

Confidence interval for power estimate.

Type:

Tuple[float, float]

rejection_rate#

Proportion of simulations with p-value < alpha.

Type:

float

mean_estimate#

Mean treatment effect estimate across simulations.

Type:

float

std_estimate#

Standard deviation of estimates across simulations.

Type:

float

mean_se#

Mean standard error across simulations.

Type:

float

coverage#

Proportion of CIs containing true effect.

Type:

float

n_simulations#

Number of simulations performed (successful count; see n_simulation_failures for failed-replicate count).

Type:

int

n_simulation_failures#

Number of simulations at the primary effect size whose estimator.fit (or result extraction) raised an exception and was skipped. Lets callers programmatically detect fragile DGP/estimator pairings; a proportional warning is also emitted above a 10% failure rate.

Type:

int

effect_sizes#

Effect sizes tested (if multiple).

Type:

List[float]

powers#

Power at each effect size (if multiple).

Type:

List[float]

true_effect#

True treatment effect used in simulation.

Type:

float

alpha#

Significance level.

Type:

float

estimator_name#

Name of the estimator used.

Type:

str

effective_n_units#

Effective sample size when it differs from the requested n_units (e.g., due to DDD grid rounding). None when no rounding occurred.

Type:

int or None

Methods

__init__(power, power_se, power_ci, ...[, ...])

power_curve_df()

Get power curve data as a DataFrame.

print_summary()

Print the summary to stdout.

summary()

Generate a formatted summary of simulation power results.

to_dataframe()

Convert results to a pandas DataFrame.

to_dict()

Convert results to a dictionary.

Attributes

__init__(power, power_se, power_ci, rejection_rate, mean_estimate, std_estimate, mean_se, coverage, n_simulations, effect_sizes, powers, true_effect, alpha, estimator_name, simulation_results=None, effective_n_units=None, survey_config=None, mean_deff=None, mean_icc_realized=None, n_simulation_failures=0)#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#