diff_diff.trop.TROPResults
- class diff_diff.trop.TROPResults[source]
Bases:
objectResults from a Triply Robust Panel (TROP) estimation.
TROP combines nuclear norm regularized factor estimation with exponential distance-based unit weights and time decay weights.
- lambda_time
Selected time weight decay parameter from grid. 0.0 = uniform time weights (disabled) per Eq. 3.
- Type:
- lambda_unit
Selected unit weight decay parameter from grid. 0.0 = uniform unit weights (disabled) per Eq. 3.
- Type:
- lambda_nn
Selected nuclear norm regularization parameter from grid. inf = factor model disabled (L=0); converted to 1e10 internally for computation.
- Type:
- factor_matrix
Estimated low-rank factor matrix L (n_periods x n_units).
- Type:
np.ndarray
- bootstrap_distribution
Bootstrap distribution of estimates.
- Type:
np.ndarray, optional
- __init__(att, se, t_stat, p_value, conf_int, n_obs, n_treated, n_control, n_treated_obs, unit_effects, time_effects, treatment_effects, lambda_time, lambda_unit, lambda_nn, factor_matrix, effective_rank, loocv_score, alpha=0.05, n_pre_periods=0, n_post_periods=0, n_bootstrap=None, bootstrap_distribution=None)
- Parameters:
att (float)
se (float)
t_stat (float)
p_value (float)
n_obs (int)
n_treated (int)
n_control (int)
n_treated_obs (int)
lambda_time (float)
lambda_unit (float)
lambda_nn (float)
factor_matrix (ndarray)
effective_rank (float)
loocv_score (float)
alpha (float)
n_pre_periods (int)
n_post_periods (int)
n_bootstrap (int | None)
bootstrap_distribution (ndarray | None)
- Return type:
None
Methods
__init__(att, se, t_stat, p_value, conf_int, ...)Get time fixed effects as a DataFrame.
Get individual treatment effects as a DataFrame.
Get unit fixed effects as a DataFrame.
print_summary([alpha])Print the summary to stdout.
summary([alpha])Generate a formatted summary of the estimation results.
Convert results to a pandas DataFrame.
to_dict()Convert results to a dictionary.
Attributes
Check if the ATT is statistically significant at the alpha level.
Return significance stars based on p-value.
- __init__(att, se, t_stat, p_value, conf_int, n_obs, n_treated, n_control, n_treated_obs, unit_effects, time_effects, treatment_effects, lambda_time, lambda_unit, lambda_nn, factor_matrix, effective_rank, loocv_score, alpha=0.05, n_pre_periods=0, n_post_periods=0, n_bootstrap=None, bootstrap_distribution=None)
- Parameters:
att (float)
se (float)
t_stat (float)
p_value (float)
n_obs (int)
n_treated (int)
n_control (int)
n_treated_obs (int)
lambda_time (float)
lambda_unit (float)
lambda_nn (float)
factor_matrix (ndarray)
effective_rank (float)
loocv_score (float)
alpha (float)
n_pre_periods (int)
n_post_periods (int)
n_bootstrap (int | None)
bootstrap_distribution (ndarray | None)
- Return type:
None
- print_summary(alpha=None)[source]
Print the summary to stdout.
- Parameters:
alpha (float | None)
- Return type:
None
- to_dict()[source]
Convert results to a dictionary.
- Returns:
Dictionary containing all estimation results.
- Return type:
Dict[str, Any]
- to_dataframe()[source]
Convert results to a pandas DataFrame.
- Returns:
DataFrame with estimation results.
- Return type:
pd.DataFrame
- get_treatment_effects_df()[source]
Get individual treatment effects as a DataFrame.
- Returns:
DataFrame with unit, time, and treatment effect columns.
- Return type:
pd.DataFrame
- get_unit_effects_df()[source]
Get unit fixed effects as a DataFrame.
- Returns:
DataFrame with unit and effect columns.
- Return type:
pd.DataFrame