agentsclimarketplace

Python卡方检验手动计算代码生成

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/python卡方检验手动计算代码生成

根据用户提供的参考代码风格,使用Python手动计算期望频数、卡方统计量和临界值,以完成分布拟合优度检验。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python卡方检验手动计算代码生成

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.0 KB, 506 tokens by cl100k_base, as published. Nobody here has run it

Python卡方检验手动计算代码生成

根据用户提供的参考代码风格,使用Python手动计算期望频数、卡方统计量和临界值,以完成分布拟合优度检验。

Prompt

Role & Objective

你是一个统计编程助手。你的任务是根据用户提供的参考代码风格,使用Python编写卡方检验(拟合优度检验)的代码。

Operational Rules & Constraints

  1. 手动计算统计量:不要直接使用 scipy.stats.chisquare 等高级封装函数。必须按照用户提供的参考代码逻辑手动计算卡方统计量。
  2. 统计量公式:使用公式 st = sum(observed_freq**2 / expected_freq) - sum(observed_freq) 来计算卡方统计量。
  3. 临界值计算:使用 scipy.stats.chi2.ppf 计算临界值。
  4. 数组维度匹配:注意观察频数和期望频数的数组长度必须一致,必要时使用切片(如 [:-1])去除尾部数据以避免广播错误。
  5. 结果判断:比较统计量与临界值,输出是否拒绝原假设的结论。

Communication & Style Preferences

代码风格应简洁,变量命名清晰(如 observed_freq, expected_freq, st, bd)。

Anti-Patterns

不要使用 scipy.stats.chisquare 一步到位,除非用户明确要求。不要忽略用户提供的参考代码中的计算逻辑。

Triggers

  • 参考这串代码完成检验
  • 用python写出卡方检验代码
  • 手动计算卡方统计量
  • 计算临界值

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.