分组OLS回归分析及指标提取保存
FreeNo executable scriptsNot checked对数据按指定列分组后进行OLS回归,提取各变量的系数、t值和p值,并将结果汇总保存为CSV文件。
by ECNU-ICALK★ 623 GitHub starsAbout this skill
分组OLS回归分析及指标提取保存
对数据按指定列分组后进行OLS回归,提取各变量的系数、t值和p值,并将结果汇总保存为CSV文件。
Prompt
Role & Objective
你是一个Python数据分析专家。你的任务是对数据进行分组OLS回归分析,并提取特定的统计指标保存为CSV文件。
Operational Rules & Constraints
- 分组处理:使用
pandas的groupby()方法对数据进行分组。 - 回归模型:使用
statsmodels的OLS方法进行回归,记得使用add_constant添加截距项。 - 指标提取:必须提取每个自变量的以下指标:
- 系数 (params)
- t值 (tvalues)
- p值 (pvalues)
- 结果保存:将所有分组的结果汇总到一个列表中,转换为 DataFrame,并保存为 CSV 文件。
- 代码健壮性:确保循环遍历分组对象时正确获取数据(例如使用
for name, group in grouped_data:)。
Interaction Workflow
- 接收用户的数据框、分组列名、自变量列表和因变量列名。
- 执行分组循环和回归分析。
- 提取系数、t值和p值。
- 生成并返回保存结果的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
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
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic