causal_agent
Causal Agent - Automated Causal Inference with Large Language Models.
The causal_agent module provides an LLM-powered tool for generating data-driven answers to natural language causal queries. It automatically:
Parses natural language causal questions
Analyzes dataset characteristics and variables
Selects appropriate causal inference methods
Executes causal analysis with proper diagnostics
Interprets results in plain language
Example
>>> from causal_agent import run_causal_analysis
>>> result = run_causal_analysis(
... query="What is the effect of education on income?",
... dataset_path="data.csv",
... dataset_description="Education and income dataset"
... )
>>> print(f"Effect: {result['results']['results']['effect_estimate']}")
The module supports various causal inference methods including: - Randomized Controlled Trials (RCT) - Difference-in-Differences (DiD) - Instrumental Variables (IV) - Regression Discontinuity Design (RDD) - Propensity Score Matching/Weighting - Backdoor Adjustment - Linear Regression with controls
Functions
|
Analyze a dataset to identify important characteristics for causal inference. |
|
Create a standardized workflow state update dictionary. |
|
Format final results including numerical estimates and explanations. |
|
Generates a comprehensive explanation text for the causal analysis. |
|
Interpret query using hybrid heuristic/LLM approach to identify variables. |
|
Parse the user's causal query using LLM and regex. |
|
Run causal analysis on a dataset based on a user query. |
|
Validate the selected causal method against dataset characteristics. |