causal_agent.methods.linear_regression package
Submodules
causal_agent.methods.linear_regression.diagnostics module
Diagnostic checks for Linear Regression models.
causal_agent.methods.linear_regression.estimator module
Linear Regression Estimator for Causal Inference.
Uses Ordinary Least Squares (OLS) to estimate the treatment effect, potentially adjusting for covariates.
- causal_agent.methods.linear_regression.estimator.estimate_effect(df, treatment, outcome, covariates=None, query_str=None, llm=None, **kwargs)[source]
Estimates the causal effect using Linear Regression (OLS).
- Parameters:
df (DataFrame) – Input DataFrame.
treatment (str) – Name of the treatment variable column.
outcome (str) – Name of the outcome variable column.
covariates (List[str] | None) – Optional list of covariate names.
query_str (str | None) – Optional user query for context (e.g., for LLM).
llm (langchain.chat_models.base.BaseChatModel | None) – Optional Language Model instance.
**kwargs – Additional keyword arguments.
- Returns:
‘effect_estimate’: The estimated coefficient for the treatment variable.
’p_value’: The p-value associated with the treatment coefficient.
’confidence_interval’: The 95% confidence interval for the effect.
’standard_error’: The standard error of the treatment coefficient.
’formula’: The regression formula used.
’model_summary’: Summary object from statsmodels.
’diagnostics’: Placeholder for diagnostic results.
’interpretation’: Placeholder for LLM interpretation.
- Return type:
Dictionary containing estimation results
causal_agent.methods.linear_regression.llm_assist module
LLM assistance functions for Linear Regression analysis.
- causal_agent.methods.linear_regression.llm_assist.suggest_lr_covariates(df_cols, treatment, outcome, query, llm=None)[source]
(Placeholder) Use LLM to suggest relevant covariates for linear regression.
- Parameters:
- Returns:
List of suggested covariate names.
- Return type: