R Econometrics MCP Server

Integrations

  • Provides containerized deployment of the R Econometrics MCP server, allowing for easier setup and isolation of the required R environment and dependencies.

  • Uses Python as the interface language for the MCP server that connects R's econometric capabilities to AI assistants.

R计量经济学MCP服务器

模型上下文协议 (MCP) 服务器通过 R 提供计量经济学建模功能。该服务器使 AI 助手能够执行复杂的计量经济学分析,包括线性回归、面板数据模型、工具变量回归和诊断测试。

特征

  • 线性回归:运行具有可选稳健标准误差的线性模型
  • 面板数据分析:固定效应、随机效应、合并、组间和一阶差分模型
  • 工具变量:估计IV回归模型
  • 诊断测试:异方差性、自相关性和函数形式检验
  • 资源:计量经济学技术参考文献
  • 提示:用于常见计量经济学分析的预定义提示模板

安装

先决条件

  • Python 3.8+
  • R 4.0+
  • R 包:plm、lmtest、sandwich、AER、jsonlite

使用 Docker(推荐)

  1. 构建 Docker 镜像:
    docker build -t r-econometrics-mcp .
  2. 运行容器:
    docker run -it r-econometrics-mcp

手动安装

  1. 安装所需的 Python 包:
    pip install -r requirements.txt
  2. 安装所需的 R 包:
    install.packages(c("plm", "lmtest", "sandwich", "AER", "jsonlite"))
  3. 运行服务器:
    python r_econometrics_mcp.py

与 Claude Desktop 一起使用

  1. 启动 Claude Desktop
  2. 打开 MCP 服务器面板
  3. 添加具有以下配置的新服务器:
    • 姓名:R计量经济学
    • 传输:stdio
    • 命令:path/to/python r_econometrics_mcp.py
    • (或者如果使用 Docker):docker run -i r-econometrics-mcp

示例查询

以下是服务器连接后可以与 Claude 一起使用的一些示例查询:

线性回归

Can you analyze the relationship between price and mpg in the mtcars dataset using linear regression?

面板数据分析

I have panel data with variables gdp, investment, and trade for 30 countries over 20 years. Can you help me determine if a fixed effects or random effects model is more appropriate?

工具变量

I'm trying to estimate the causal effect of education on wages, but I'm concerned about endogeneity. Can you help me set up an instrumental variables regression?

诊断测试

After running my regression model, I'm concerned about heteroskedasticity. Can you run appropriate diagnostic tests and suggest corrections if needed?

工具参考

线性模型

运行线性回归模型。

参数

  • formula (字符串):回归公式(例如,'y ~ x1 + x2')
  • data (对象):作为字典/JSON 对象的数据集
  • robust (布尔值,可选):是否使用稳健标准误差

面板模型

运行面板数据模型。

参数

  • formula (字符串):回归公式(例如,'y ~ x1 + x2')
  • data (对象):作为字典/JSON 对象的数据集
  • index (数组):面板索引变量(例如,['individual','time'])
  • effect (字符串,可选):效果类型:“个体”、“时间”或“双向”
  • model (字符串,可选):模型类型:'within'、'random'、'pooling'、'between' 或 'fd'

诊断

执行模型诊断。

参数

  • formula (字符串):回归公式(例如,'y ~ x1 + x2')
  • data (对象):作为字典/JSON 对象的数据集
  • tests (数组):要运行的测试(例如,['bp','reset','dw'])

iv_回归

估计工具变量回归。

参数

  • formula (字符串):回归公式(例如,'y ~ x1 + x2 | z1 + z2')
  • data (对象):作为字典/JSON 对象的数据集

资源

  • econometrics:formulas :有关常见计量经济学模型公式的信息
  • econometrics:diagnostics :诊断测试参考
  • econometrics:panel_data :R 面板数据分析指南

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

MIT 许可证

致谢

  • R 项目和 R 核心团队
  • plm、lmtest、sandwich 和 AER 软件包的开发人员
  • 人类学模型上下文协议
-
security - not tested
A
license - permissive license
-
quality - not tested

通过 R 提供计量经济学建模功能,使 AI 助手能够执行复杂的分析,包括线性回归、面板数据模型、工具变量回归和诊断测试。

  1. Features
    1. Installation
      1. Prerequisites
      2. Using Docker (Recommended)
      3. Manual Installation
    2. Usage with Claude Desktop
      1. Example Queries
        1. Linear Regression
        2. Panel Data Analysis
        3. Instrumental Variables
        4. Diagnostic Tests
      2. Tools Reference
        1. linear_model
        2. panel_model
        3. diagnostics
        4. iv_regression
      3. Resources
        1. Contributing
          1. License
            1. Acknowledgments
              ID: qiqzedafdr