diff_diff.QUGTestResults#

class diff_diff.QUGTestResults[source]#

Bases: object

Result of qug_test() (paper Theorem 4).

The QUG test rejects H_0: d_lower = 0 when the order-statistic ratio T = D_{(1)} / (D_{(2)} - D_{(1)}) exceeds 1/alpha - 1. Under the null, the asymptotic limit law of T is the ratio of two independent Exp(1) random variables, with CDF F(t) = t / (1 + t), so p_value = 1 / (1 + T).

t_stat#

D_{(1)} / (D_{(2)} - D_{(1)}). NaN when fewer than 2 non-zero observations remain or when the two smallest doses tie.

Type:

float

p_value#

1 / (1 + t_stat) under the null. NaN when t_stat is NaN.

Type:

float

reject#

True iff t_stat > critical_value. False on NaN statistic.

Type:

bool

alpha#

Significance level used.

Type:

float

critical_value#

1 / alpha - 1. Populated even when the statistic is NaN so downstream readers can inspect the decision threshold.

Type:

float

n_obs#

Number of observations after filtering to d > 0.

Type:

int

n_excluded_zero#

Number of zero-dose observations excluded from the sample.

Type:

int

d_order_1#

Smallest positive dose D_{(1)}. NaN when n_obs < 2.

Type:

float

d_order_2#

Second-smallest positive dose D_{(2)}. NaN when n_obs < 2.

Type:

float

Methods

__init__(t_stat, p_value, reject, alpha, ...)

print_summary()

Print the summary to stdout.

summary()

Formatted summary table.

to_dataframe()

Return a one-row DataFrame of the result dict.

to_dict()

Return results as a JSON-safe dict.

Attributes

__init__(t_stat, p_value, reject, alpha, critical_value, n_obs, n_excluded_zero, d_order_1, d_order_2)#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#