causal_agent.methods.propensity_score package
- causal_agent.methods.propensity_score.estimate_propensity_scores(df, treatment, covariates, model_type='logistic', **kwargs)[source]
Estimate propensity scores using a specified model.
- Parameters:
- Returns:
Array of propensity scores
- Return type:
- causal_agent.methods.propensity_score.estimate_matching_effect(df, treatment, outcome, covariates, **kwargs)
Estimate ATT using Propensity Score Matching. Tries DoWhy’s PSM first, falls back to custom implementation if DoWhy fails. Uses bootstrap SE based on the custom implementation regardless.
- causal_agent.methods.propensity_score.estimate_weighting_effect(df, treatment, outcome, covariates, **kwargs)
Generic propensity score weighting (IPW) implementation.
- Parameters:
- Returns:
Dictionary with effect estimate and diagnostics
- Return type:
- causal_agent.methods.propensity_score.assess_balance(df_original, df_matched_or_weighted, treatment, covariates, method, propensity_scores_original=None, propensity_scores_matched=None, weights=None)[source]
Assesses covariate balance before and after matching/weighting.
Placeholder: Returns dummy diagnostic data.
- causal_agent.methods.propensity_score.plot_overlap(df, treatment, propensity_scores, save_path='overlap_plot.png')[source]
Generates plot showing propensity score overlap. Placeholder: Does nothing.
- causal_agent.methods.propensity_score.plot_balance(balance_metrics_before, balance_metrics_after, save_path='balance_plot.png')[source]
Generates plot showing covariate balance before/after. Placeholder: Does nothing.
Submodules
causal_agent.methods.propensity_score.base module
- causal_agent.methods.propensity_score.base.select_propensity_model(df, treatment, covariates, query=None)[source]
Selects the appropriate propensity score model type (e.g., logistic, GBM).
Placeholder: Currently defaults to Logistic Regression.
causal_agent.methods.propensity_score.diagnostics module
- causal_agent.methods.propensity_score.diagnostics.assess_balance(df_original, df_matched_or_weighted, treatment, covariates, method, propensity_scores_original=None, propensity_scores_matched=None, weights=None)[source]
Assesses covariate balance before and after matching/weighting.
Placeholder: Returns dummy diagnostic data.
- causal_agent.methods.propensity_score.diagnostics.assess_weight_distribution(weights, treatment_indicator)[source]
Assesses the distribution of IPW weights.
Placeholder: Returns dummy diagnostic data.
causal_agent.methods.propensity_score.llm_assist module
- causal_agent.methods.propensity_score.llm_assist.determine_optimal_caliper(df, treatment, covariates, query=None)[source]
Determines optimal caliper for PSM using data or LLM.
Placeholder: Returns a default value.
- causal_agent.methods.propensity_score.llm_assist.determine_optimal_weight_type(df, treatment, query=None)[source]
Determines the optimal type of IPW weights (ATE, ATT, etc.).
Placeholder: Defaults to ATE.
causal_agent.methods.propensity_score.matching module
- causal_agent.methods.propensity_score.matching.estimate_effect(df, treatment, outcome, covariates, **kwargs)[source]
Estimate ATT using Propensity Score Matching. Tries DoWhy’s PSM first, falls back to custom implementation if DoWhy fails. Uses bootstrap SE based on the custom implementation regardless.