R MCP 服务器
模型上下文协议 (MCP) 服务器通过 R 提供高级计量经济学建模和数据分析功能。该服务器使 AI 助手能够无缝执行复杂的计量经济学和统计分析,帮助您快速从数据中获得洞察。
特征
- **线性回归:**运行具有可选稳健标准误差的线性模型。
- **面板数据分析:**估计固定效应、随机效应、合并、之间和一阶差分模型。
- **工具变量:**建立和估计 IV 回归模型。
- **诊断测试:**评估异方差性、自相关性和模型错误指定。
- **描述性统计:**使用 R 的 summary() 功能为数据集生成汇总统计数据。
- **相关性分析:**计算变量之间的皮尔逊或斯皮尔曼相关性。
- **分组聚合:**按指定列对数据进行分组,并使用 dplyr 计算汇总统计数据。
- **资源:**访问各种计量经济学技术的参考文献。
- **提示:**使用预定义的提示模板进行常见的计量经济学分析。
安装
使用 Docker(推荐)
- 构建 Docker 镜像:
- 运行容器:
手动安装
安装所需的 Python 包:
安装所需的 R 包(如果在容器外运行服务器):
运行服务器:
用法
服务器通过标准输入/输出进行通信。运行以下命令:
它启动后会等待标准输入的 JSON 消息。要手动测试服务器,请创建一个包含紧凑(单行)JSON 消息的文件(例如,test_request.json)。
示例测试
创建具有以下内容的 test_request.json(单行 JSON):
然后运行:
输出
与 Claude Desktop 一起使用
- 启动 Claude Desktop
- 打开 MCP 服务器面板
- 添加具有以下配置的新服务器:
- 姓名:R计量经济学
- 传输:stdio
- 命令:path/to/python r_econometrics_mcp.py
- (或者如果使用 Docker):docker run -i r-econometrics-mcp
示例查询
以下是服务器连接后可以与 Claude 一起使用的一些示例查询:
线性回归
面板数据分析
工具变量
诊断测试
工具参考
线性模型
运行线性回归模型。
参数:
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 许可证
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
通过 R 提供计量经济学建模功能,使 AI 助手能够执行复杂的分析,包括线性回归、面板数据模型、工具变量回归和诊断测试。
Related MCP Servers
- AsecurityAlicenseAqualityAllows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.Last updated -1580PythonMIT License
- -securityAlicense-qualityServes as a guardian of development knowledge, providing AI assistants with curated access to latest documentation and best practices.Last updated -48752TypeScriptMIT License
- -securityFlicense-qualityEnables AI models to interact with Linear for issue tracking and project management through capabilities like creating/searching issues, managing sprints, and retrieving workflow states.Last updated -TypeScript
- AsecurityFlicenseAqualityEnables AI assistants to interact with the World Bank open data API, allowing for listing and analysis of indicators across available countries.Last updated -18Python