Skip to main content
Glama

R Econometrics MCP Server

by gojiplus

R MCP サーバー

R を通じて高度な計量経済モデリングとデータ分析機能を提供するモデル コンテキスト プロトコル (MCP) サーバー。このサーバーにより、AI アシスタントは高度な計量経済分析と統計分析をシームレスに実行できるようになり、データから迅速に洞察を得ることができます。

特徴

  • **線形回帰:**オプションの堅牢な標準誤差を使用して線形モデルを実行します。
  • **パネル データ分析:**固定効果、ランダム効果、プーリング、間、および一次差分モデルを推定します。
  • 操作変数: IV 回帰モデルを構築して推定します。
  • **診断テスト:**異分散性、自己相関、モデルの誤指定を評価します。
  • 記述統計: R の summary() 機能を使用してデータセットの要約統計を生成します。
  • **相関分析:**変数間のピアソンまたはスピアマンの相関を計算します。
  • **グループ集計:**指定された列でデータをグループ化し、dplyr を使用して要約統計を計算します。
  • **リソース:**さまざまな計量経済学的手法の参考資料にアクセスします。
  • **プロンプト:**一般的な計量経済分析には、事前定義されたプロンプト テンプレートを使用します。

インストール

Dockerの使用(推奨)

  1. Docker イメージをビルドします。
    docker build -t r-econometrics-mcp .
  2. コンテナを実行します。
docker run -it r-econometrics-mcp

手動インストール

必要な Python パッケージをインストールします。

pip install -r requirements.txt

必要な R パッケージをインストールします (コンテナー外でサーバーを実行する場合)。

install.packages(c("plm", "lmtest", "sandwich", "AER", "jsonlite"), repos="https://cloud.r-project.org/")

サーバーを実行します。

python rmcp.py

使用法

サーバーは標準入出力を介して通信します。以下を実行すると、

python rmcp.py

起動すると、標準入力からJSONメッセージが送られてくるのを待ちます。サーバーを手動でテストするには、コンパクトな(1行の)JSONメッセージを含むファイル(例:test_request.json)を作成してください。

例テスト

次の内容 (1 行の JSON) を含む test_request.json を作成します。

{"tool": "linear_model", "args": {"formula": "y ~ x1", "data": {"x1": [1,2,3,4,5], "y": [1,3,5,7,9]}, "robust": false}}

次に以下を実行します:

cat test_request.json | python rmcp.py

出力

{"coefficients": {"(Intercept)": -1, "x1": 2}, "std_errors": {"(Intercept)": 2.8408e-16, "x1": 8.5654e-17}, "t_values": {"(Intercept)": -3520120717017444, "x1": 23349839270207356}, "p_values": {"(Intercept)": 5.0559e-47, "x1": 1.7323e-49}, "r_squared": 1, "adj_r_squared": 1, "sigma": 2.7086e-16, "df": [2, 3, 2], "model_call": "lm(formula = formula, data = data)", "robust": false}

Claude Desktopでの使用

  1. Claudeデスクトップを起動
  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 (文字列、オプション): 効果の種類: 'individual'、'time'、または 'twoways'
  • 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 によるパネルデータ分析ガイド

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

ライセンス

MITライセンス

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

R を通じて計量経済モデリング機能を提供し、AI アシスタントが線形回帰、パネル データ モデル、操作変数回帰、診断テストなどの高度な分析を実行できるようにします。

  1. 特徴
    1. インストール
      1. Dockerの使用(推奨)
      2. 手動インストール
    2. 使用法
      1. 例テスト
    3. Claude Desktopでの使用
      1. クエリの例
        1. 線形回帰
        2. パネルデータ分析
        3. 操作変数
        4. 診断テスト
      2. ツールリファレンス
        1. 線形モデル
        2. パネルモデル
        3. 診断
        4. iv\_回帰
      3. リソース
        1. 貢献
          1. ライセンス

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              Allows 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 -
              1
              580
              Python
              MIT License
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              Serves as a guardian of development knowledge, providing AI assistants with curated access to latest documentation and best practices.
              Last updated -
              4
              87
              52
              TypeScript
              MIT License
            • -
              security
              F
              license
              -
              quality
              Enables 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
            • A
              security
              F
              license
              A
              quality
              Enables AI assistants to interact with the World Bank open data API, allowing for listing and analysis of indicators across available countries.
              Last updated -
              1
              8
              Python

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/gojiplus/rmcp'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server