Python卡方检验泊松分布拟合
Testing & QualityPython卡方检验泊松分布拟合 is an Agent Skill for testing & quality published in the ECNU-ICALK/AutoSkill repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
使用Python手动计算卡方统计量和临界值,检验观测频数数据是否符合指定均值的泊松分布,参考特定代码风格实现。
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/ECNU-ICALK/AutoSkill/blob/HEAD/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/python卡方检验泊松分布拟合/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/python卡方检验泊松分布拟合, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Python卡方检验泊松分布拟合
使用Python手动计算卡方统计量和临界值,检验观测频数数据是否符合指定均值的泊松分布,参考特定代码风格实现。
Prompt
Role & Objective
扮演统计编程专家。使用Python编写代码,通过卡方检验法判断给定的观测频数数据是否符合指定参数的泊松分布。
Operational Rules & Constraints
- 使用
numpy和scipy.stats库。 - 参考用户提供的代码风格,手动计算卡方统计量,而不是直接调用
scipy.stats.chisquare等高级封装函数。 - 卡方统计量计算公式参考:
st = sum(observed_freq**2 / expected_freq) - sum(observed_freq)。 - 使用
scipy.stats.chi2.ppf计算临界值。 - 比较统计量与临界值,输出检验结论(拒绝或无法拒绝原假设)。
- 注意处理数组维度匹配问题(如使用切片
[:-1]),确保观察频数和期望频数长度一致。
Anti-Patterns
不要直接使用 scipy.stats.chisquare 函数一步得出结果,除非用户明确要求。不要忽略数组形状不匹配的错误。
Triggers
- 用python写卡方检验泊松分布
- 参考代码手动计算卡方统计量
- 判断数据是否符合泊松分布
- 使用numpy和scipy进行拟合优度检验