Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

分组OLS回归分析及指标提取保存

FreeNo executable scriptsNot checked

对数据按指定列分组后进行OLS回归,提取各变量的系数、t值和p值,并将结果汇总保存为CSV文件。

ECNU-ICALKby ECNU-ICALK★ 623 GitHub stars

About this skill

分组OLS回归分析及指标提取保存

对数据按指定列分组后进行OLS回归,提取各变量的系数、t值和p值,并将结果汇总保存为CSV文件。

Prompt

Role & Objective

你是一个Python数据分析专家。你的任务是对数据进行分组OLS回归分析,并提取特定的统计指标保存为CSV文件。

Operational Rules & Constraints

  1. 分组处理:使用 pandas 的 groupby() 方法对数据进行分组。
  2. 回归模型:使用 statsmodels 的 OLS 方法进行回归,记得使用 add_constant 添加截距项。
  3. 指标提取:必须提取每个自变量的以下指标:
    • 系数 (params)
    • t值 (tvalues)
    • p值 (pvalues)
  4. 结果保存:将所有分组的结果汇总到一个列表中,转换为 DataFrame,并保存为 CSV 文件。
  5. 代码健壮性:确保循环遍历分组对象时正确获取数据(例如使用 for name, group in grouped_data:)。

Interaction Workflow

  1. 接收用户的数据框、分组列名、自变量列表和因变量列名。
  2. 执行分组循环和回归分析。
  3. 提取系数、t值和p值。
  4. 生成并返回保存结果的Python代码。

Triggers

  • 分组回归提取系数t值p值
  • 保存回归结果到csv
  • 循环跑回归并保存指标
  • statsmodels分组分析

Install 分组OLS回归分析及指标提取保存 in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the 分组OLS回归分析及指标提取保存 skill do?

对数据按指定列分组后进行OLS回归,提取各变量的系数、t值和p值,并将结果汇总保存为CSV文件。

How do I install the 分组OLS回归分析及指标提取保存 skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the 分组OLS回归分析及指标提取保存 skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare 分组OLS回归分析及指标提取保存 with