aigroup-econ-mcp 1.3.3__py3-none-any.whl → 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- .gitignore +253 -0
- PKG-INFO +732 -0
- README.md +687 -0
- __init__.py +14 -0
- aigroup_econ_mcp-2.0.1.dist-info/METADATA +732 -0
- aigroup_econ_mcp-2.0.1.dist-info/RECORD +170 -0
- aigroup_econ_mcp-2.0.1.dist-info/entry_points.txt +2 -0
- aigroup_econ_mcp-2.0.1.dist-info/licenses/LICENSE +21 -0
- cli.py +32 -0
- econometrics/README.md +18 -0
- econometrics/__init__.py +191 -0
- econometrics/advanced_methods/modern_computing_machine_learning/__init__.py +30 -0
- econometrics/advanced_methods/modern_computing_machine_learning/causal_forest.py +253 -0
- econometrics/advanced_methods/modern_computing_machine_learning/double_ml.py +268 -0
- econometrics/advanced_methods/modern_computing_machine_learning/gradient_boosting.py +249 -0
- econometrics/advanced_methods/modern_computing_machine_learning/hierarchical_clustering.py +243 -0
- econometrics/advanced_methods/modern_computing_machine_learning/kmeans_clustering.py +293 -0
- econometrics/advanced_methods/modern_computing_machine_learning/neural_network.py +264 -0
- econometrics/advanced_methods/modern_computing_machine_learning/random_forest.py +195 -0
- econometrics/advanced_methods/modern_computing_machine_learning/support_vector_machine.py +226 -0
- econometrics/advanced_methods/modern_computing_machine_learning/test_all_modules.py +329 -0
- econometrics/advanced_methods/modern_computing_machine_learning/test_report.md +107 -0
- econometrics/basic_parametric_estimation/__init__.py +31 -0
- econometrics/basic_parametric_estimation/gmm/__init__.py +13 -0
- econometrics/basic_parametric_estimation/gmm/gmm_model.py +256 -0
- econometrics/basic_parametric_estimation/mle/__init__.py +13 -0
- econometrics/basic_parametric_estimation/mle/mle_model.py +241 -0
- econometrics/basic_parametric_estimation/ols/__init__.py +13 -0
- econometrics/basic_parametric_estimation/ols/ols_model.py +141 -0
- econometrics/causal_inference/__init__.py +66 -0
- econometrics/causal_inference/causal_identification_strategy/__init__.py +104 -0
- econometrics/causal_inference/causal_identification_strategy/control_function.py +112 -0
- econometrics/causal_inference/causal_identification_strategy/difference_in_differences.py +107 -0
- econometrics/causal_inference/causal_identification_strategy/event_study.py +119 -0
- econometrics/causal_inference/causal_identification_strategy/first_difference.py +89 -0
- econometrics/causal_inference/causal_identification_strategy/fixed_effects.py +103 -0
- econometrics/causal_inference/causal_identification_strategy/hausman_test.py +69 -0
- econometrics/causal_inference/causal_identification_strategy/instrumental_variables.py +145 -0
- econometrics/causal_inference/causal_identification_strategy/mediation_analysis.py +121 -0
- econometrics/causal_inference/causal_identification_strategy/moderation_analysis.py +109 -0
- econometrics/causal_inference/causal_identification_strategy/propensity_score_matching.py +140 -0
- econometrics/causal_inference/causal_identification_strategy/random_effects.py +100 -0
- econometrics/causal_inference/causal_identification_strategy/regression_discontinuity.py +98 -0
- econometrics/causal_inference/causal_identification_strategy/synthetic_control.py +111 -0
- econometrics/causal_inference/causal_identification_strategy/triple_difference.py +86 -0
- econometrics/distribution_analysis/__init__.py +28 -0
- econometrics/distribution_analysis/oaxaca_blinder.py +184 -0
- econometrics/distribution_analysis/time_series_decomposition.py +152 -0
- econometrics/distribution_analysis/variance_decomposition.py +179 -0
- econometrics/missing_data/__init__.py +18 -0
- econometrics/missing_data/imputation_methods.py +219 -0
- econometrics/missing_data/missing_data_measurement_error/__init__.py +0 -0
- econometrics/model_specification_diagnostics_robust_inference/README.md +173 -0
- econometrics/model_specification_diagnostics_robust_inference/__init__.py +78 -0
- econometrics/model_specification_diagnostics_robust_inference/diagnostic_tests/__init__.py +20 -0
- econometrics/model_specification_diagnostics_robust_inference/diagnostic_tests/diagnostic_tests_model.py +149 -0
- econometrics/model_specification_diagnostics_robust_inference/generalized_least_squares/__init__.py +15 -0
- econometrics/model_specification_diagnostics_robust_inference/generalized_least_squares/gls_model.py +130 -0
- econometrics/model_specification_diagnostics_robust_inference/model_selection/__init__.py +18 -0
- econometrics/model_specification_diagnostics_robust_inference/model_selection/model_selection_model.py +286 -0
- econometrics/model_specification_diagnostics_robust_inference/regularization/__init__.py +15 -0
- econometrics/model_specification_diagnostics_robust_inference/regularization/regularization_model.py +177 -0
- econometrics/model_specification_diagnostics_robust_inference/robust_errors/__init__.py +15 -0
- econometrics/model_specification_diagnostics_robust_inference/robust_errors/robust_errors_model.py +122 -0
- econometrics/model_specification_diagnostics_robust_inference/simultaneous_equations/__init__.py +15 -0
- econometrics/model_specification_diagnostics_robust_inference/simultaneous_equations/simultaneous_equations_model.py +246 -0
- econometrics/model_specification_diagnostics_robust_inference/weighted_least_squares/__init__.py +15 -0
- econometrics/model_specification_diagnostics_robust_inference/weighted_least_squares/wls_model.py +127 -0
- econometrics/nonparametric/__init__.py +35 -0
- econometrics/nonparametric/gam_model.py +117 -0
- econometrics/nonparametric/kernel_regression.py +161 -0
- econometrics/nonparametric/nonparametric_semiparametric_methods/__init__.py +0 -0
- econometrics/nonparametric/quantile_regression.py +249 -0
- econometrics/nonparametric/spline_regression.py +100 -0
- econometrics/spatial_econometrics/__init__.py +68 -0
- econometrics/spatial_econometrics/geographically_weighted_regression.py +211 -0
- econometrics/spatial_econometrics/gwr_simple.py +154 -0
- econometrics/spatial_econometrics/spatial_autocorrelation.py +356 -0
- econometrics/spatial_econometrics/spatial_durbin_model.py +177 -0
- econometrics/spatial_econometrics/spatial_econometrics_new/__init__.py +0 -0
- econometrics/spatial_econometrics/spatial_regression.py +315 -0
- econometrics/spatial_econometrics/spatial_weights.py +226 -0
- econometrics/specific_data_modeling/micro_discrete_limited_data/README.md +164 -0
- econometrics/specific_data_modeling/micro_discrete_limited_data/__init__.py +40 -0
- econometrics/specific_data_modeling/micro_discrete_limited_data/count_data_models.py +311 -0
- econometrics/specific_data_modeling/micro_discrete_limited_data/discrete_choice_models.py +294 -0
- econometrics/specific_data_modeling/micro_discrete_limited_data/limited_dependent_variable_models.py +282 -0
- econometrics/specific_data_modeling/survival_duration_data/__init__.py +0 -0
- econometrics/specific_data_modeling/time_series_panel_data/__init__.py +143 -0
- econometrics/specific_data_modeling/time_series_panel_data/arima_model.py +104 -0
- econometrics/specific_data_modeling/time_series_panel_data/cointegration_vecm.py +334 -0
- econometrics/specific_data_modeling/time_series_panel_data/dynamic_panel_models.py +653 -0
- econometrics/specific_data_modeling/time_series_panel_data/exponential_smoothing.py +176 -0
- econometrics/specific_data_modeling/time_series_panel_data/garch_model.py +198 -0
- econometrics/specific_data_modeling/time_series_panel_data/panel_diagnostics.py +125 -0
- econometrics/specific_data_modeling/time_series_panel_data/panel_var.py +60 -0
- econometrics/specific_data_modeling/time_series_panel_data/structural_break_tests.py +87 -0
- econometrics/specific_data_modeling/time_series_panel_data/time_varying_parameter_models.py +106 -0
- econometrics/specific_data_modeling/time_series_panel_data/unit_root_tests.py +204 -0
- econometrics/specific_data_modeling/time_series_panel_data/var_svar_model.py +372 -0
- econometrics/statistical_inference/__init__.py +21 -0
- econometrics/statistical_inference/bootstrap_methods.py +162 -0
- econometrics/statistical_inference/permutation_test.py +177 -0
- econometrics/statistical_inference/statistical_inference_techniques/__init__.py +0 -0
- econometrics/statistics/distribution_decomposition_methods/__init__.py +0 -0
- econometrics/survival_analysis/__init__.py +18 -0
- econometrics/survival_analysis/survival_models.py +259 -0
- econometrics/tests/basic_parametric_estimation_tests/__init__.py +3 -0
- econometrics/tests/basic_parametric_estimation_tests/test_gmm.py +128 -0
- econometrics/tests/basic_parametric_estimation_tests/test_mle.py +127 -0
- econometrics/tests/basic_parametric_estimation_tests/test_ols.py +100 -0
- econometrics/tests/causal_inference_tests/__init__.py +3 -0
- econometrics/tests/causal_inference_tests/detailed_test.py +441 -0
- econometrics/tests/causal_inference_tests/test_all_methods.py +418 -0
- econometrics/tests/causal_inference_tests/test_causal_identification_strategy.py +202 -0
- econometrics/tests/causal_inference_tests/test_difference_in_differences.py +53 -0
- econometrics/tests/causal_inference_tests/test_instrumental_variables.py +44 -0
- econometrics/tests/model_specification_diagnostics_tests/__init__.py +3 -0
- econometrics/tests/model_specification_diagnostics_tests/test_diagnostic_tests.py +86 -0
- econometrics/tests/model_specification_diagnostics_tests/test_robust_errors.py +89 -0
- econometrics/tests/specific_data_modeling_tests/__init__.py +3 -0
- econometrics/tests/specific_data_modeling_tests/test_arima.py +98 -0
- econometrics/tests/specific_data_modeling_tests/test_dynamic_panel.py +198 -0
- econometrics/tests/specific_data_modeling_tests/test_exponential_smoothing.py +105 -0
- econometrics/tests/specific_data_modeling_tests/test_garch.py +118 -0
- econometrics/tests/specific_data_modeling_tests/test_micro_discrete_limited_data.py +189 -0
- econometrics/tests/specific_data_modeling_tests/test_unit_root.py +156 -0
- econometrics/tests/specific_data_modeling_tests/test_var.py +124 -0
- econometrics//321/206/320/254/320/272/321/205/342/225/235/320/220/321/205/320/237/320/241/321/205/320/264/320/267/321/207/342/226/222/342/225/227/321/204/342/225/235/320/250/321/205/320/225/320/230/321/207/342/225/221/320/267/321/205/320/230/320/226/321/206/320/256/320/240.md +544 -0
- prompts/__init__.py +0 -0
- prompts/analysis_guides.py +43 -0
- pyproject.toml +85 -0
- resources/MCP_MASTER_GUIDE.md +422 -0
- resources/MCP_TOOLS_DATA_FORMAT_GUIDE.md +185 -0
- resources/__init__.py +0 -0
- server.py +97 -0
- tools/README.md +88 -0
- tools/__init__.py +119 -0
- tools/causal_inference_adapter.py +658 -0
- tools/data_loader.py +213 -0
- tools/decorators.py +38 -0
- tools/distribution_analysis_adapter.py +121 -0
- tools/econometrics_adapter.py +286 -0
- tools/gwr_simple_adapter.py +54 -0
- tools/machine_learning_adapter.py +567 -0
- tools/mcp_tool_groups/__init__.py +15 -0
- tools/mcp_tool_groups/basic_parametric_tools.py +173 -0
- tools/mcp_tool_groups/causal_inference_tools.py +643 -0
- tools/mcp_tool_groups/distribution_analysis_tools.py +169 -0
- tools/mcp_tool_groups/machine_learning_tools.py +422 -0
- tools/mcp_tool_groups/microecon_tools.py +325 -0
- tools/mcp_tool_groups/missing_data_tools.py +117 -0
- tools/mcp_tool_groups/model_specification_tools.py +402 -0
- tools/mcp_tool_groups/nonparametric_tools.py +225 -0
- tools/mcp_tool_groups/spatial_econometrics_tools.py +323 -0
- tools/mcp_tool_groups/statistical_inference_tools.py +131 -0
- tools/mcp_tool_groups/time_series_tools.py +494 -0
- tools/mcp_tools_registry.py +124 -0
- tools/microecon_adapter.py +412 -0
- tools/missing_data_adapter.py +73 -0
- tools/model_specification_adapter.py +369 -0
- tools/nonparametric_adapter.py +190 -0
- tools/output_formatter.py +563 -0
- tools/spatial_econometrics_adapter.py +318 -0
- tools/statistical_inference_adapter.py +90 -0
- tools/survival_analysis_adapter.py +46 -0
- tools/time_series_panel_data_adapter.py +858 -0
- tools/time_series_panel_data_tools.py +65 -0
- aigroup_econ_mcp/__init__.py +0 -19
- aigroup_econ_mcp/cli.py +0 -82
- aigroup_econ_mcp/config.py +0 -561
- aigroup_econ_mcp/server.py +0 -452
- aigroup_econ_mcp/tools/__init__.py +0 -19
- aigroup_econ_mcp/tools/base.py +0 -470
- aigroup_econ_mcp/tools/cache.py +0 -533
- aigroup_econ_mcp/tools/data_loader.py +0 -195
- aigroup_econ_mcp/tools/file_parser.py +0 -1027
- aigroup_econ_mcp/tools/machine_learning.py +0 -60
- aigroup_econ_mcp/tools/ml_ensemble.py +0 -210
- aigroup_econ_mcp/tools/ml_evaluation.py +0 -272
- aigroup_econ_mcp/tools/ml_models.py +0 -54
- aigroup_econ_mcp/tools/ml_regularization.py +0 -186
- aigroup_econ_mcp/tools/monitoring.py +0 -555
- aigroup_econ_mcp/tools/optimized_example.py +0 -229
- aigroup_econ_mcp/tools/panel_data.py +0 -619
- aigroup_econ_mcp/tools/regression.py +0 -214
- aigroup_econ_mcp/tools/statistics.py +0 -154
- aigroup_econ_mcp/tools/time_series.py +0 -698
- aigroup_econ_mcp/tools/timeout.py +0 -283
- aigroup_econ_mcp/tools/tool_descriptions.py +0 -410
- aigroup_econ_mcp/tools/tool_handlers.py +0 -1016
- aigroup_econ_mcp/tools/tool_registry.py +0 -478
- aigroup_econ_mcp/tools/validation.py +0 -482
- aigroup_econ_mcp-1.3.3.dist-info/METADATA +0 -525
- aigroup_econ_mcp-1.3.3.dist-info/RECORD +0 -30
- aigroup_econ_mcp-1.3.3.dist-info/entry_points.txt +0 -2
- /aigroup_econ_mcp-1.3.3.dist-info/licenses/LICENSE → /LICENSE +0 -0
- {aigroup_econ_mcp-1.3.3.dist-info → aigroup_econ_mcp-2.0.1.dist-info}/WHEEL +0 -0
PKG-INFO
ADDED
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aigroup_econ_mcp
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: 专业计量经济学MCP工具 - 支持CSV/JSON/TXT/Excel格式,让大模型更智能地进行数据分析
|
|
5
|
+
Project-URL: Homepage, https://github.com/jackdark425/aigroup-econ-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/jackdark425/aigroup-econ-mcp.git
|
|
7
|
+
Project-URL: Issues, https://github.com/ajackdark425/aigroup-econ-mcp/issues
|
|
8
|
+
Author-email: AIGroup <jackdark425@gmail.com>
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: data-analysis,econometrics,economics,mcp,panel-data,regression,statistics,time-series
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: arch>=6.0.0
|
|
24
|
+
Requires-Dist: click>=8.0.0
|
|
25
|
+
Requires-Dist: esda>=2.4.0
|
|
26
|
+
Requires-Dist: joblib>=1.2.0
|
|
27
|
+
Requires-Dist: libpysal>=4.7.0
|
|
28
|
+
Requires-Dist: lifelines>=0.27.0
|
|
29
|
+
Requires-Dist: linearmodels>=7.0
|
|
30
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
31
|
+
Requires-Dist: mcp>=1.0.0
|
|
32
|
+
Requires-Dist: numpy>=1.21.0
|
|
33
|
+
Requires-Dist: openpyxl>=3.0.0
|
|
34
|
+
Requires-Dist: pandas>=1.5.0
|
|
35
|
+
Requires-Dist: psutil>=5.9.0
|
|
36
|
+
Requires-Dist: pydantic>=2.0.0
|
|
37
|
+
Requires-Dist: pyyaml>=6.0
|
|
38
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
39
|
+
Requires-Dist: scipy>=1.7.0
|
|
40
|
+
Requires-Dist: spreg>=1.4.0
|
|
41
|
+
Requires-Dist: statsmodels>=0.13.0
|
|
42
|
+
Requires-Dist: uvicorn>=0.20.0
|
|
43
|
+
Requires-Dist: xgboost>=1.7.0
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# aigroup-econ-mcp - 专业计量经济学MCP工具
|
|
47
|
+
|
|
48
|
+
🎯 **66项专业计量经济学分析工具** - 提供完整计量功能覆盖,支持CSV/JSON/TXT/Excel多种数据格式
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+

|
|
52
|
+

|
|
53
|
+

|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
## 📋 目录
|
|
57
|
+
|
|
58
|
+
- [🚀 快速开始](#-快速开始)
|
|
59
|
+
- [✨ 核心功能](#-核心功能)
|
|
60
|
+
- [🔧 工具列表](#-工具列表)
|
|
61
|
+
- [📁 文件输入支持](#-文件输入支持)
|
|
62
|
+
- [⚙️ 安装配置](#️-安装配置)
|
|
63
|
+
- [📚 使用示例](#-使用示例)
|
|
64
|
+
- [🔍 故障排除](#-故障排除)
|
|
65
|
+
- [🏗️ 项目架构](#️-项目架构)
|
|
66
|
+
- [🤝 贡献指南](#-贡献指南)
|
|
67
|
+
- [📄 许可证](#-许可证)
|
|
68
|
+
|
|
69
|
+
## 🚀 快速开始
|
|
70
|
+
|
|
71
|
+
### 一键启动(推荐)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# 使用uvx快速启动(无需安装)
|
|
75
|
+
uvx aigroup-econ-mcp
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Roo-Code、通义灵码、Claude code配置
|
|
79
|
+
|
|
80
|
+
MCP设置中添加:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"aigroup-econ-mcp": {
|
|
86
|
+
"command": "uvx",
|
|
87
|
+
"args": ["aigroup-econ-mcp"],
|
|
88
|
+
"alwaysAllow": [
|
|
89
|
+
"basic_parametric_estimation_ols", "basic_parametric_estimation_mle", "basic_parametric_estimation_gmm",
|
|
90
|
+
"causal_difference_in_differences", "causal_instrumental_variables", "causal_propensity_score_matching",
|
|
91
|
+
"causal_fixed_effects", "causal_random_effects", "causal_regression_discontinuity",
|
|
92
|
+
"causal_synthetic_control", "causal_event_study", "causal_triple_difference",
|
|
93
|
+
"causal_mediation_analysis", "causal_moderation_analysis", "causal_control_function",
|
|
94
|
+
"causal_first_difference", "ml_random_forest", "ml_gradient_boosting",
|
|
95
|
+
"ml_support_vector_machine", "ml_neural_network", "ml_kmeans_clustering",
|
|
96
|
+
"ml_hierarchical_clustering", "ml_double_machine_learning", "ml_causal_forest",
|
|
97
|
+
"micro_logit", "micro_probit", "micro_multinomial_logit",
|
|
98
|
+
"micro_poisson", "micro_negative_binomial", "micro_tobit",
|
|
99
|
+
"micro_heckman", "model_diagnostic_tests", "generalized_least_squares",
|
|
100
|
+
"weighted_least_squares", "robust_errors_regression", "model_selection_criteria",
|
|
101
|
+
"regularized_regression", "simultaneous_equations_model", "time_series_arima_model",
|
|
102
|
+
"time_series_exponential_smoothing", "time_series_garch_model", "time_series_unit_root_tests",
|
|
103
|
+
"time_series_var_svar_model", "time_series_cointegration_analysis", "panel_data_dynamic_model",
|
|
104
|
+
"panel_data_diagnostics", "panel_var_model", "structural_break_tests",
|
|
105
|
+
"time_varying_parameter_models"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## ✨ 核心功能 - 66项专业工具
|
|
113
|
+
|
|
114
|
+
### 1. 基础参数估计 (3项)
|
|
115
|
+
|
|
116
|
+
解决建立变量间的基础参数化关系并进行估计的问题。
|
|
117
|
+
|
|
118
|
+
- **普通最小二乘法 (OLS)** - `basic_parametric_estimation_ols`
|
|
119
|
+
- **最大似然估计 (MLE)** - `basic_parametric_estimation_mle`
|
|
120
|
+
- **广义矩估计 (GMM)** - `basic_parametric_estimation_gmm`
|
|
121
|
+
|
|
122
|
+
### 2. 因果识别策略 (13项)
|
|
123
|
+
|
|
124
|
+
在非实验数据中,识别变量间的因果关系(解决内生性问题)。
|
|
125
|
+
|
|
126
|
+
- **双重差分法 (DID)** - `causal_difference_in_differences`
|
|
127
|
+
- **工具变量法 (IV/2SLS)** - `causal_instrumental_variables`
|
|
128
|
+
- **倾向得分匹配 (PSM)** - `causal_propensity_score_matching`
|
|
129
|
+
- **固定效应模型** - `causal_fixed_effects`
|
|
130
|
+
- **随机效应模型** - `causal_random_effects`
|
|
131
|
+
- **回归断点设计 (RDD)** - `causal_regression_discontinuity`
|
|
132
|
+
- **合成控制法** - `causal_synthetic_control`
|
|
133
|
+
- **事件研究法** - `causal_event_study`
|
|
134
|
+
- **三重差分法 (DDD)** - `causal_triple_difference`
|
|
135
|
+
- **中介效应分析** - `causal_mediation_analysis`
|
|
136
|
+
- **调节效应分析** - `causal_moderation_analysis`
|
|
137
|
+
- **控制函数法** - `causal_control_function`
|
|
138
|
+
- **一阶差分模型** - `causal_first_difference`
|
|
139
|
+
|
|
140
|
+
### 3. 分解分析 (3项)
|
|
141
|
+
|
|
142
|
+
分析变量差异的来源和构成。
|
|
143
|
+
|
|
144
|
+
- **Oaxaca-Blinder分解** - `decomposition_oaxaca_blinder`
|
|
145
|
+
- **方差分解 (ANOVA)** - `decomposition_variance_anova`
|
|
146
|
+
- **时间序列分解** - `decomposition_time_series`
|
|
147
|
+
|
|
148
|
+
### 4. 机器学习方法 (8项)
|
|
149
|
+
|
|
150
|
+
处理高维数据、复杂模式识别、预测以及为因果推断提供辅助工具。
|
|
151
|
+
|
|
152
|
+
- **随机森林** - `ml_random_forest`
|
|
153
|
+
- **梯度提升机** - `ml_gradient_boosting`
|
|
154
|
+
- **支持向量机** - `ml_support_vector_machine`
|
|
155
|
+
- **神经网络** - `ml_neural_network`
|
|
156
|
+
- **K均值聚类** - `ml_kmeans_clustering`
|
|
157
|
+
- **层次聚类** - `ml_hierarchical_clustering`
|
|
158
|
+
- **双重机器学习** - `ml_double_machine_learning`
|
|
159
|
+
- **因果森林** - `ml_causal_forest`
|
|
160
|
+
|
|
161
|
+
### 5. 微观计量模型 (7项)
|
|
162
|
+
|
|
163
|
+
针对因变量或数据结构的固有特性进行建模。
|
|
164
|
+
|
|
165
|
+
- **Logit模型** - `micro_logit`
|
|
166
|
+
- **Probit模型** - `micro_probit`
|
|
167
|
+
- **多项Logit** - `micro_multinomial_logit`
|
|
168
|
+
- **泊松回归** - `micro_poisson`
|
|
169
|
+
- **负二项回归** - `micro_negative_binomial`
|
|
170
|
+
- **Tobit模型** - `micro_tobit`
|
|
171
|
+
- **Heckman选择模型** - `micro_heckman`
|
|
172
|
+
|
|
173
|
+
### 6. 缺失数据处理 (2项)
|
|
174
|
+
|
|
175
|
+
处理数据缺失问题,保证分析的完整性。
|
|
176
|
+
|
|
177
|
+
- **简单插补** - `missing_data_simple_imputation`
|
|
178
|
+
- **多重插补 (MICE)** - `missing_data_multiple_imputation`
|
|
179
|
+
|
|
180
|
+
### 7. 模型规范、诊断与稳健推断 (7项)
|
|
181
|
+
|
|
182
|
+
当基础模型的理想假设不成立时,修正模型或调整推断;对模型进行诊断和选择。
|
|
183
|
+
|
|
184
|
+
- **模型诊断检验** - `model_diagnostic_tests`
|
|
185
|
+
- **广义最小二乘法 (GLS)** - `generalized_least_squares`
|
|
186
|
+
- **加权最小二乘法 (WLS)** - `weighted_least_squares`
|
|
187
|
+
- **稳健标准误回归** - `robust_errors_regression`
|
|
188
|
+
- **模型选择准则** - `model_selection_criteria`
|
|
189
|
+
- **正则化回归** - `regularized_regression`
|
|
190
|
+
- **联立方程模型** - `simultaneous_equations_model`
|
|
191
|
+
|
|
192
|
+
### 8. 非参数方法 (4项)
|
|
193
|
+
|
|
194
|
+
不依赖特定函数形式的灵活建模方法。
|
|
195
|
+
|
|
196
|
+
- **核回归** - `nonparametric_kernel_regression`
|
|
197
|
+
- **分位数回归** - `nonparametric_quantile_regression`
|
|
198
|
+
- **样条回归** - `nonparametric_spline_regression`
|
|
199
|
+
- **广义可加模型 (GAM)** - `nonparametric_gam_model`
|
|
200
|
+
|
|
201
|
+
### 9. 空间计量经济学 (6项)
|
|
202
|
+
|
|
203
|
+
分析具有空间依赖性的数据。
|
|
204
|
+
|
|
205
|
+
- **空间权重矩阵** - `spatial_weights_matrix`
|
|
206
|
+
- **Moran's I检验** - `spatial_morans_i_test`
|
|
207
|
+
- **Geary's C检验** - `spatial_gearys_c_test`
|
|
208
|
+
- **局部Moran's I (LISA)** - `spatial_local_moran_lisa`
|
|
209
|
+
- **空间回归模型** - `spatial_regression_model`
|
|
210
|
+
- **地理加权回归 (GWR)** - `spatial_gwr_model`
|
|
211
|
+
|
|
212
|
+
### 10. 统计推断 (2项)
|
|
213
|
+
|
|
214
|
+
基于重采样的统计推断方法。
|
|
215
|
+
|
|
216
|
+
- **Bootstrap方法** - `inference_bootstrap`
|
|
217
|
+
- **置换检验** - `inference_permutation_test`
|
|
218
|
+
|
|
219
|
+
### 11. 时间序列与面板数据 (11项)
|
|
220
|
+
|
|
221
|
+
分析具有时间维度数据的动态依赖、预测和非平稳性。
|
|
222
|
+
|
|
223
|
+
- **ARIMA模型** - `time_series_arima_model`
|
|
224
|
+
- **指数平滑法** - `time_series_exponential_smoothing`
|
|
225
|
+
- **GARCH波动率模型** - `time_series_garch_model`
|
|
226
|
+
- **单位根检验** - `time_series_unit_root_tests`
|
|
227
|
+
- **VAR/SVAR模型** - `time_series_var_svar_model`
|
|
228
|
+
- **协整分析** - `time_series_cointegration_analysis`
|
|
229
|
+
- **动态面板模型** - `panel_data_dynamic_model`
|
|
230
|
+
- **面板数据诊断** - `panel_data_diagnostics`
|
|
231
|
+
- **面板VAR模型** - `panel_var_model`
|
|
232
|
+
- **结构突变检验** - `structural_break_tests`
|
|
233
|
+
- **时变参数模型** - `time_varying_parameter_models`
|
|
234
|
+
|
|
235
|
+
## 🔧 完整工具列表 (66项)
|
|
236
|
+
|
|
237
|
+
### 基础参数估计 (3项)
|
|
238
|
+
|
|
239
|
+
| 工具 | 功能 | 主要参数 | 输出 |
|
|
240
|
+
| ----------------------------------- | ------------ | ----------------------------- | --------------------------------- |
|
|
241
|
+
| `basic_parametric_estimation_ols` | OLS回归分析 | y_data, x_data, file_path | R²、系数、t统计量、p值、置信区间 |
|
|
242
|
+
| `basic_parametric_estimation_mle` | 最大似然估计 | data, file_path, distribution | 参数估计、标准误、置信区间 |
|
|
243
|
+
| `basic_parametric_estimation_gmm` | 广义矩估计 | y_data, x_data, instruments | GMM系数、J统计量、p值 |
|
|
244
|
+
|
|
245
|
+
### 因果推断 (13项)
|
|
246
|
+
|
|
247
|
+
| 工具 | 功能 | 主要参数 | 输出 |
|
|
248
|
+
| ------------------------------------ | ------------ | -------------------------------------- | ----------------------- |
|
|
249
|
+
| `causal_difference_in_differences` | 双重差分法 | treatment, time_period, outcome | 处理效应、时间效应 |
|
|
250
|
+
| `causal_instrumental_variables` | 工具变量法 | y_data, x_data, instruments | 2SLS系数、弱工具检验 |
|
|
251
|
+
| `causal_propensity_score_matching` | 倾向得分匹配 | treatment, outcome, covariates | 处理效应、匹配统计 |
|
|
252
|
+
| `causal_fixed_effects` | 固定效应模型 | y_data, x_data, entity_ids | R²、系数、F统计量 |
|
|
253
|
+
| `causal_random_effects` | 随机效应模型 | y_data, x_data, entity_ids | R²、系数、随机效应方差 |
|
|
254
|
+
| `causal_regression_discontinuity` | 回归断点设计 | running_variable, outcome, cutoff | 局部平均处理效应 |
|
|
255
|
+
| `causal_synthetic_control` | 合成控制法 | outcome, treatment_period, donor_units | 合成权重、处理效应 |
|
|
256
|
+
| `causal_event_study` | 事件研究法 | outcome, treatment, event_time | 动态处理效应 |
|
|
257
|
+
| `causal_triple_difference` | 三重差分法 | outcome, treatment_group, cohort_group | 三重差分效应 |
|
|
258
|
+
| `causal_mediation_analysis` | 中介效应分析 | outcome, treatment, mediator | 直接效应、间接效应 |
|
|
259
|
+
| `causal_moderation_analysis` | 调节效应分析 | outcome, predictor, moderator | 交互效应、条件效应 |
|
|
260
|
+
| `causal_control_function` | 控制函数法 | y_data, x_data, z_data | 控制函数估计 |
|
|
261
|
+
| `causal_first_difference` | 一阶差分模型 | y_data, x_data, entity_ids | 差分系数、标准误 |
|
|
262
|
+
|
|
263
|
+
### 机器学习 (8项)
|
|
264
|
+
|
|
265
|
+
| 工具 | 功能 | 主要参数 | 输出 |
|
|
266
|
+
| ------------------------------ | ------------ | ---------------------------------- | -------------------------- |
|
|
267
|
+
| `ml_random_forest` | 随机森林 | X_data, y_data, problem_type | R²、特征重要性、预测精度 |
|
|
268
|
+
| `ml_gradient_boosting` | 梯度提升机 | X_data, y_data, algorithm | R²、特征重要性、预测精度 |
|
|
269
|
+
| `ml_support_vector_machine` | 支持向量机 | X_data, y_data, kernel | R²、支持向量、预测精度 |
|
|
270
|
+
| `ml_neural_network` | 神经网络 | X_data, y_data, hidden_layer_sizes | R²、网络权重、预测精度 |
|
|
271
|
+
| `ml_kmeans_clustering` | K均值聚类 | X_data, n_clusters | 聚类中心、簇标签、轮廓系数 |
|
|
272
|
+
| `ml_hierarchical_clustering` | 层次聚类 | X_data, n_clusters, linkage | 聚类树、簇标签 |
|
|
273
|
+
| `ml_double_machine_learning` | 双重机器学习 | X_data, y_data, d_data | 处理效应、置信区间 |
|
|
274
|
+
| `ml_causal_forest` | 因果森林 | X_data, y_data, w_data | 异质性处理效应、特征重要性 |
|
|
275
|
+
|
|
276
|
+
### 微观计量 (7项)
|
|
277
|
+
|
|
278
|
+
| 工具 | 功能 | 主要参数 | 输出 |
|
|
279
|
+
| --------------------------- | --------------- | ----------------------------- | -------------------------- |
|
|
280
|
+
| `micro_logit` | Logit回归 | X_data, y_data | 伪R²、系数、OR值、p值 |
|
|
281
|
+
| `micro_probit` | Probit回归 | X_data, y_data | 伪R²、系数、边际效应、p值 |
|
|
282
|
+
| `micro_multinomial_logit` | 多项Logit | X_data, y_data | 伪R²、系数、相对风险比 |
|
|
283
|
+
| `micro_poisson` | 泊松回归 | X_data, y_data | 伪R²、系数、发生率比 |
|
|
284
|
+
| `micro_negative_binomial` | 负二项回归 | X_data, y_data, distr | 伪R²、系数、过度离散参数 |
|
|
285
|
+
| `micro_tobit` | Tobit模型 | X_data, y_data, bounds | 系数、边际效应、p值 |
|
|
286
|
+
| `micro_heckman` | Heckman选择模型 | X_select_data, Z_data, s_data | 选择方程、结果方程系数 |
|
|
287
|
+
|
|
288
|
+
### 模型规范与诊断 (7项)
|
|
289
|
+
|
|
290
|
+
| 工具 | 功能 | 主要参数 | 输出 |
|
|
291
|
+
| -------------------------------- | ------------ | --------------------------- | ------------------------------- |
|
|
292
|
+
| `model_diagnostic_tests` | 模型诊断检验 | y_data, x_data | 异方差、自相关、正态性、VIF检验 |
|
|
293
|
+
| `generalized_least_squares` | GLS回归 | y_data, x_data, sigma | GLS系数、标准误、置信区间 |
|
|
294
|
+
| `weighted_least_squares` | WLS回归 | y_data, x_data, weights | WLS系数、权重统计 |
|
|
295
|
+
| `robust_errors_regression` | 稳健标准误 | y_data, x_data, cov_type | 稳健标准误、检验统计量 |
|
|
296
|
+
| `model_selection_criteria` | 模型选择 | y_data, x_data, cv_folds | AIC、BIC、HQIC、交叉验证 |
|
|
297
|
+
| `regularized_regression` | 正则化回归 | y_data, x_data, method | 正则化系数、特征选择 |
|
|
298
|
+
| `simultaneous_equations_model` | 联立方程模型 | y_data, x_data, instruments | 2SLS系数、方程系统 |
|
|
299
|
+
|
|
300
|
+
### 时间序列与面板数据 (11项)
|
|
301
|
+
|
|
302
|
+
| 工具 | 功能 | 主要参数 | 输出 |
|
|
303
|
+
| -------------------------------------- | ------------ | -------------------------- | -------------------------- |
|
|
304
|
+
| `time_series_arima_model` | ARIMA模型 | data, order | 模型系数、预测值、置信区间 |
|
|
305
|
+
| `time_series_exponential_smoothing` | 指数平滑 | data, trend, seasonal | 平滑参数、预测值 |
|
|
306
|
+
| `time_series_garch_model` | GARCH模型 | data, order | 波动率参数、条件方差 |
|
|
307
|
+
| `time_series_unit_root_tests` | 单位根检验 | data, test_type | 检验统计量、平稳性判断 |
|
|
308
|
+
| `time_series_var_svar_model` | VAR/SVAR模型 | data, model_type, lags | 系数矩阵、脉冲响应 |
|
|
309
|
+
| `time_series_cointegration_analysis` | 协整分析 | data, analysis_type | 协整向量、秩检验 |
|
|
310
|
+
| `panel_data_dynamic_model` | 动态面板模型 | y_data, x_data, entity_ids | GMM系数、标准误 |
|
|
311
|
+
| `panel_data_diagnostics` | 面板诊断 | test_type, residuals | Hausman检验、F检验、LM检验 |
|
|
312
|
+
| `panel_var_model` | 面板VAR模型 | data, entity_ids, lags | 面板VAR系数、脉冲响应 |
|
|
313
|
+
| `structural_break_tests` | 结构突变检验 | data, test_type | 断点检测、检验统计量 |
|
|
314
|
+
| `time_varying_parameter_models` | 时变参数模型 | y_data, x_data, model_type | 参数轨迹、机制转换 |
|
|
315
|
+
|
|
316
|
+
> **注意**: 所有工具均支持CSV/JSON/TXT/Excel格式输入,可通过 `file_path`、`file_content`或直接数据参数调用。**输出支持JSON/Markdown/TXT多种格式**。
|
|
317
|
+
|
|
318
|
+
## 📁 文件输入支持
|
|
319
|
+
|
|
320
|
+
### 支持的文件格式
|
|
321
|
+
|
|
322
|
+
#### 1. CSV文件(推荐)
|
|
323
|
+
|
|
324
|
+
- **格式**: 逗号、制表符、分号分隔
|
|
325
|
+
- **表头**: 自动识别(第一行非数值为表头)
|
|
326
|
+
- **特点**: 最通用,易于编辑和查看
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
GDP,CPI,失业率
|
|
330
|
+
3.2,2.1,4.5
|
|
331
|
+
2.8,2.3,4.2
|
|
332
|
+
3.5,1.9,4.0
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
#### 2. JSON文件
|
|
336
|
+
|
|
337
|
+
- **字典格式**: `{"变量名": [数据], ...}`
|
|
338
|
+
- **数组格式**: `[{"变量1": 值, ...}, ...]`
|
|
339
|
+
- **嵌套格式**: `{"data": {...}, "metadata": {...}}`
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"GDP": [3.2, 2.8, 3.5],
|
|
344
|
+
"CPI": [2.1, 2.3, 1.9],
|
|
345
|
+
"失业率": [4.5, 4.2, 4.0]
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### 3. Excel文件
|
|
350
|
+
|
|
351
|
+
- **格式**: .xlsx 或 .xls
|
|
352
|
+
- **表头**: 第一行作为变量名
|
|
353
|
+
- **工作表**: 自动读取第一个工作表,或指定sheet名称
|
|
354
|
+
- **特点**: 支持复杂数据结构,保留格式
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
# Excel文件示例结构
|
|
358
|
+
# Sheet1:
|
|
359
|
+
# A列: GDP, B列: CPI, C列: 失业率
|
|
360
|
+
# 第1行: 3.2, 2.1, 4.5
|
|
361
|
+
# 第2行: 2.8, 2.3, 4.2
|
|
362
|
+
# 第3行: 3.5, 1.9, 4.0
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### 4. TXT文件
|
|
366
|
+
|
|
367
|
+
- **单列数值**: 每行一个数值
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
100.5
|
|
371
|
+
102.3
|
|
372
|
+
101.8
|
|
373
|
+
103.5
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
- **多列数值**: 空格或制表符分隔
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
GDP CPI 失业率
|
|
380
|
+
3.2 2.1 4.5
|
|
381
|
+
2.8 2.3 4.2
|
|
382
|
+
3.5 1.9 4.0
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
- **键值对格式**: 变量名: 值列表
|
|
386
|
+
|
|
387
|
+
```
|
|
388
|
+
GDP: 3.2 2.8 3.5 2.9
|
|
389
|
+
CPI: 2.1 2.3 1.9 2.4
|
|
390
|
+
失业率: 4.5 4.2 4.0 4.3
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### 使用方式
|
|
394
|
+
|
|
395
|
+
#### 方式1:直接数据输入(程序化调用)
|
|
396
|
+
|
|
397
|
+
```
|
|
398
|
+
{
|
|
399
|
+
"data": {
|
|
400
|
+
"GDP增长率": [3.2, 2.8, 3.5, 2.9],
|
|
401
|
+
"通货膨胀率": [2.1, 2.3, 1.9, 2.4]
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
方式2:文件内容输入(字符串)
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
{
|
|
410
|
+
"file_content": "GDP,CPI\n3.2,2.1\n2.8,2.3\n3.5,1.9",
|
|
411
|
+
"file_format": "csv"
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
#### 方式3:文件路径输入(推荐✨)
|
|
416
|
+
|
|
417
|
+
```
|
|
418
|
+
{
|
|
419
|
+
"file_path": "./data/economic_data.csv"
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
或使用Excel文件:
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
{
|
|
427
|
+
"file_path": "./data/panel_data.xlsx"
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### 输出格式支持
|
|
432
|
+
|
|
433
|
+
所有工具支持多种输出格式,通过 `output_format` 参数指定:
|
|
434
|
+
|
|
435
|
+
- **json** (默认) - 结构化JSON格式,便于程序处理
|
|
436
|
+
- **markdown** - Markdown表格格式,适合文档展示
|
|
437
|
+
- **html** - HTML表格格式,适合网页展示
|
|
438
|
+
- **latex** - LaTeX表格格式,适合学术论文
|
|
439
|
+
- **text** - 纯文本格式,简洁易读
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
{
|
|
443
|
+
"file_path": "./data/economic_data.csv",
|
|
444
|
+
"output_format": "json"
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### 自动格式检测
|
|
449
|
+
|
|
450
|
+
系统会智能检测文件格式:
|
|
451
|
+
|
|
452
|
+
1. 文件扩展名(.csv/.json/.txt/.xlsx/.xls)
|
|
453
|
+
2. 文件内容特征(逗号、JSON结构、纯数值、Excel二进制)
|
|
454
|
+
3. 建议使用 `"file_format": "auto"` 让系统自动识别
|
|
455
|
+
|
|
456
|
+
## ⚙️ 安装配置
|
|
457
|
+
|
|
458
|
+
### 跨平台兼容性
|
|
459
|
+
|
|
460
|
+
✅ **完全跨平台支持** - 支持 Windows、macOS、Linux 系统
|
|
461
|
+
✅ **纯Python实现** - 无平台特定依赖
|
|
462
|
+
✅ **ARM架构支持** - 兼容 Apple Silicon (M1/M2/M3)
|
|
463
|
+
|
|
464
|
+
### 方式1:uvx安装(推荐)
|
|
465
|
+
|
|
466
|
+
```
|
|
467
|
+
# 直接运行最新版本
|
|
468
|
+
uvx aigroup-econ-mcp
|
|
469
|
+
|
|
470
|
+
# 指定版本
|
|
471
|
+
uvx aigroup-econ-mcp@2.0.0
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### 方式2:pip安装
|
|
475
|
+
|
|
476
|
+
```
|
|
477
|
+
# 安装包
|
|
478
|
+
pip install aigroup-econ-mcp
|
|
479
|
+
|
|
480
|
+
# 运行服务
|
|
481
|
+
aigroup-econ-mcp
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### macOS 特定说明
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
# 如果遇到权限问题,使用用户安装
|
|
488
|
+
pip install --user aigroup-econ-mcp
|
|
489
|
+
|
|
490
|
+
# 或者使用虚拟环境
|
|
491
|
+
python -m venv econ_env
|
|
492
|
+
source econ_env/bin/activate
|
|
493
|
+
pip install aigroup-econ-mcp
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### 依赖说明
|
|
497
|
+
|
|
498
|
+
- **核心依赖**: pandas >= 1.5.0, numpy >= 1.21.0, scipy >= 1.7.0
|
|
499
|
+
- **统计分析**: statsmodels >= 0.13.0
|
|
500
|
+
- **面板数据**: linearmodels >= 7.0
|
|
501
|
+
- **机器学习**: scikit-learn >= 1.0.0, xgboost >= 1.7.0, joblib >= 1.2.0
|
|
502
|
+
- **时间序列**: arch >= 6.0.0
|
|
503
|
+
- **空间计量**: libpysal >= 4.7.0, esda >= 2.4.0, spreg >= 1.4.0
|
|
504
|
+
- **可视化**: matplotlib >= 3.5.0
|
|
505
|
+
- **轻量级**: 无需torch或其他重型框架
|
|
506
|
+
|
|
507
|
+
## 📚 使用示例
|
|
508
|
+
|
|
509
|
+
### 示例1:OLS回归分析
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
# 使用文件路径
|
|
513
|
+
result = await basic_parametric_estimation_ols(
|
|
514
|
+
file_path="./data/economic_indicators.csv"
|
|
515
|
+
)
|
|
516
|
+
|
|
517
|
+
# 使用直接数据输入
|
|
518
|
+
result = await basic_parametric_estimation_ols(
|
|
519
|
+
y_data=[12, 13, 15, 18, 20],
|
|
520
|
+
x_data=[[100, 50], [120, 48], [110, 52], [130, 45], [125, 47]],
|
|
521
|
+
feature_names=["广告支出", "价格"]
|
|
522
|
+
)
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### 示例2:因果推断 - 双重差分法
|
|
526
|
+
|
|
527
|
+
```
|
|
528
|
+
result = await causal_difference_in_differences(
|
|
529
|
+
treatment=[0, 0, 1, 1],
|
|
530
|
+
time_period=[0, 1, 0, 1],
|
|
531
|
+
outcome=[10, 12, 11, 15],
|
|
532
|
+
output_format="json"
|
|
533
|
+
)
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### 示例3:机器学习 - 随机森林
|
|
537
|
+
|
|
538
|
+
```
|
|
539
|
+
result = await ml_random_forest(
|
|
540
|
+
X_data=[[100, 50, 3], [120, 48, 3], [110, 52, 4], [130, 45, 3]],
|
|
541
|
+
y_data=[12, 13, 15, 18],
|
|
542
|
+
feature_names=["广告支出", "价格", "竞争对手数"],
|
|
543
|
+
problem_type="regression",
|
|
544
|
+
n_estimators=100
|
|
545
|
+
)
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### 示例4:时间序列 - ARIMA模型
|
|
549
|
+
|
|
550
|
+
```
|
|
551
|
+
result = await time_series_arima_model(
|
|
552
|
+
data=[100.5, 102.3, 101.8, 103.5, 104.2],
|
|
553
|
+
order=(1, 1, 1),
|
|
554
|
+
forecast_steps=5
|
|
555
|
+
)
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### 示例5:微观计量 - Logit回归
|
|
559
|
+
|
|
560
|
+
```
|
|
561
|
+
result = await micro_logit(
|
|
562
|
+
X_data=[[1.5, 2.5], [1.7, 2.7], [1.9, 2.9], [2.1, 3.1]],
|
|
563
|
+
y_data=[0, 0, 1, 1],
|
|
564
|
+
feature_names=["收入", "教育年限"]
|
|
565
|
+
)
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
## 🔍 故障排除
|
|
569
|
+
|
|
570
|
+
### 常见问题
|
|
571
|
+
|
|
572
|
+
#### Q: uvx安装卡住
|
|
573
|
+
|
|
574
|
+
```
|
|
575
|
+
# 清除缓存重试
|
|
576
|
+
uvx --no-cache aigroup-econ-mcp
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
#### Q: 工具返回错误
|
|
580
|
+
|
|
581
|
+
- ✅ 检查数据格式(CSV/JSON/TXT)
|
|
582
|
+
- ✅ 确保没有缺失值(NaN)
|
|
583
|
+
- ✅ 验证数据类型(所有数值必须是浮点数)
|
|
584
|
+
- ✅ 查看详细错误信息
|
|
585
|
+
|
|
586
|
+
#### Q: MCP服务连接失败
|
|
587
|
+
|
|
588
|
+
- ✅ 检查网络连接
|
|
589
|
+
- ✅ 确保Python版本 >= 3.8
|
|
590
|
+
- ✅ 查看VSCode输出面板的详细日志
|
|
591
|
+
- ✅ 尝试重启RooCode
|
|
592
|
+
|
|
593
|
+
### 数据要求
|
|
594
|
+
|
|
595
|
+
| 分析类型 | 最小样本量 | 推荐样本量 | 特殊要求 |
|
|
596
|
+
| ---------- | ---------- | ----------- | ----------------- |
|
|
597
|
+
| 描述性统计 | 5 | 20+ | 无缺失值 |
|
|
598
|
+
| OLS回归 | 变量数+2 | 30+ | 无多重共线性 |
|
|
599
|
+
| 时间序列 | 10 | 40+ | 时间顺序,等间隔 |
|
|
600
|
+
| 面板数据 | 实体数×3 | 实体数×10+ | 平衡或非平衡面板 |
|
|
601
|
+
| 机器学习 | 20 | 100+ | 训练集/测试集分割 |
|
|
602
|
+
|
|
603
|
+
## 🏗️ 项目架构
|
|
604
|
+
|
|
605
|
+
### 核心模块结构
|
|
606
|
+
|
|
607
|
+
```
|
|
608
|
+
aigroup-econ-mcp/
|
|
609
|
+
├── econometrics/ # 核心计量经济学算法
|
|
610
|
+
│ ├── basic_parametric_estimation/ # 基础参数估计(3个模型)
|
|
611
|
+
│ ├── causal_inference/ # 因果推断(13个方法)
|
|
612
|
+
│ ├── advanced_methods/ # 机器学习(8个模型)
|
|
613
|
+
│ ├── specific_data_modeling/ # 微观+时序(18个模型)
|
|
614
|
+
│ └── model_specification_diagnostics_robust_inference/ # 模型规范(7个工具)
|
|
615
|
+
├── tools/ # MCP工具适配器
|
|
616
|
+
│ ├── mcp_tool_groups/ # 工具组定义
|
|
617
|
+
│ │ ├── basic_parametric_tools.py # 基础参数估计工具
|
|
618
|
+
│ │ ├── causal_inference_tools.py # 因果推断工具
|
|
619
|
+
│ │ ├── machine_learning_tools.py # 机器学习工具
|
|
620
|
+
│ │ ├── microecon_tools.py # 微观计量工具
|
|
621
|
+
│ │ ├── model_specification_tools.py # 模型规范工具
|
|
622
|
+
│ │ └── time_series_tools.py # 时间序列工具
|
|
623
|
+
│ ├── data_loader.py # 数据加载器
|
|
624
|
+
│ └── output_formatter.py # 输出格式化
|
|
625
|
+
└── server.py # MCP服务器入口
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### 设计特点
|
|
629
|
+
|
|
630
|
+
- **🎯 十一大工具组** - 基础参数估计(3) + 因果推断(13) + 分解分析(3) + 机器学习(8) + 微观计量(7) + 缺失数据处理(2) + 模型规范诊断(7) + 非参数方法(4) + 空间计量(6) + 统计推断(2) + 时序面板(11) = 66项工具
|
|
631
|
+
- **🔄 统一接口** - 所有工具支持CSV/JSON/TXT/Excel四种格式输入
|
|
632
|
+
- **📊 多格式输出** - 支持JSON/Markdown/TXT三种输出格式
|
|
633
|
+
- **⚡ 异步处理** - 基于asyncio的异步设计,支持并发请求
|
|
634
|
+
- **🛡️ 错误处理** - 统一的错误处理和详细的错误信息
|
|
635
|
+
- **📝 完整文档** - 每个工具都有详细的参数说明和使用示例
|
|
636
|
+
- **🧪 全面测试** - 单元测试和集成测试覆盖
|
|
637
|
+
|
|
638
|
+
### 新增特性
|
|
639
|
+
|
|
640
|
+
- 🎯 **66项专业工具** - 完整覆盖计量经济学核心方法
|
|
641
|
+
- ✨ **11大工具组** - 基础参数估计(3) + 因果推断(13) + 分解分析(3) + 机器学习(8) + 微观计量(7) + 缺失数据处理(2) + 模型规范诊断(7) + 非参数方法(4) + 空间计量(6) + 统计推断(2) + 时序面板(11)
|
|
642
|
+
- 🔬 **13种因果方法** - DID、IV、PSM、RDD、合成控制等完整因果推断工具链
|
|
643
|
+
- 📊 **8种机器学习** - 随机森林、梯度提升、神经网络、聚类、因果森林等
|
|
644
|
+
- ⚙️ **7种微观模型** - Logit、Probit、Tobit、Heckman等离散选择和受限因变量模型
|
|
645
|
+
- 📈 **11种时序模型** - ARIMA、GARCH、VAR、协整、动态面板等时间序列工具
|
|
646
|
+
- ✨ **多格式输入** - 支持CSV/JSON/TXT/Excel(.xlsx/.xls)四种输入格式
|
|
647
|
+
- 📊 **多格式输出** - 支持JSON/Markdown/TXT三种输出格式
|
|
648
|
+
- 📝 **完善参数描述** - 所有66个工具的MCP参数都有详细说明
|
|
649
|
+
- 🔍 **智能格式检测** - 自动识别CSV/JSON/TXT/Excel格式
|
|
650
|
+
- 📂 **文件路径支持** - 支持直接传入文件路径(.txt/.csv/.json/.xlsx/.xls)
|
|
651
|
+
|
|
652
|
+
## 🤝 贡献指南
|
|
653
|
+
|
|
654
|
+
### 开发环境设置
|
|
655
|
+
|
|
656
|
+
```
|
|
657
|
+
# 克隆项目
|
|
658
|
+
git clone https://github.com/jackdark425/aigroup-econ-mcp
|
|
659
|
+
cd aigroup-econ-mcp
|
|
660
|
+
|
|
661
|
+
# 安装所有依赖(包括新添加的空间计量、生存分析等包)
|
|
662
|
+
uv sync
|
|
663
|
+
|
|
664
|
+
# 安装开发依赖
|
|
665
|
+
uv add --dev pytest pytest-asyncio black isort mypy ruff
|
|
666
|
+
|
|
667
|
+
# 运行测试
|
|
668
|
+
uv run pytest
|
|
669
|
+
|
|
670
|
+
# 代码格式化
|
|
671
|
+
uv run black src/
|
|
672
|
+
uv run isort src/
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
### 提交贡献
|
|
676
|
+
|
|
677
|
+
1. Fork项目
|
|
678
|
+
2. 创建功能分支 (`git checkout -b feature/AmazingFeature`)
|
|
679
|
+
3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
|
|
680
|
+
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
|
681
|
+
5. 开启Pull Request
|
|
682
|
+
|
|
683
|
+
### 代码规范
|
|
684
|
+
|
|
685
|
+
- 遵循PEP 8编码规范
|
|
686
|
+
- 使用类型注解(Type Hints)
|
|
687
|
+
- 添加单元测试(覆盖率>80%)
|
|
688
|
+
- 更新相关文档和示例
|
|
689
|
+
|
|
690
|
+
## 📄 许可证
|
|
691
|
+
|
|
692
|
+
MIT License - 查看 [LICENSE](LICENSE) 文件了解详情
|
|
693
|
+
|
|
694
|
+
## 🙏 致谢
|
|
695
|
+
|
|
696
|
+
- **Model Context Protocol (MCP)** - 模型上下文协议框架
|
|
697
|
+
- **Roo-Code** - 强大的AI编程助手
|
|
698
|
+
- **statsmodels** - 专业的统计分析库
|
|
699
|
+
- **pandas** - 高效的数据处理库
|
|
700
|
+
- **scikit-learn** - 全面的机器学习库
|
|
701
|
+
- **linearmodels** - 面板数据分析专用库
|
|
702
|
+
- **计量经济学社区** - 提供方法参考和实现指导
|
|
703
|
+
- **开源社区** - 所有依赖库的开发者们
|
|
704
|
+
|
|
705
|
+
## 📞 支持
|
|
706
|
+
|
|
707
|
+
- 💬 **GitHub Issues**: [提交问题](https://github.com/jackdark425/aigroup-econ-mcp/issues)
|
|
708
|
+
- 📧 **邮箱**: jackdark425@gmail.com
|
|
709
|
+
- 📚 **文档**: 查看[详细文档](https://github.com/jackdark425/aigroup-econ-mcp/tree/main/docs)
|
|
710
|
+
- 🌟 **Star项目**: 如果觉得有用,请给个⭐️
|
|
711
|
+
|
|
712
|
+
## 📈 工具统计
|
|
713
|
+
|
|
714
|
+
**总计 66 项专业工具**:
|
|
715
|
+
|
|
716
|
+
- 基础参数估计: 3项
|
|
717
|
+
- 因果推断: 13项
|
|
718
|
+
- 分解分析: 3项
|
|
719
|
+
- 机器学习: 8项
|
|
720
|
+
- 微观计量: 7项
|
|
721
|
+
- 缺失数据处理: 2项
|
|
722
|
+
- 模型规范诊断: 7项
|
|
723
|
+
- 非参数方法: 4项
|
|
724
|
+
- 空间计量: 6项
|
|
725
|
+
- 统计推断: 2项
|
|
726
|
+
- 时间序列与面板数据: 11项
|
|
727
|
+
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
**立即开始**: `uvx aigroup-econ-mcp` 🚀
|
|
731
|
+
|
|
732
|
+
让AI大模型成为你的专业计量经济学分析助手!66项专业工具,一站式解决方案!
|