Back to skills
SKILL.md
Python卡方检验泊松分布拟合
ASecurity使用Python手动计算卡方统计量和临界值,检验观测频数数据是否符合指定均值的泊松分布,参考特定代码风格实现。
- 611 stars
- 0 votes
- 0 copies
- 0 views
- Added November 11, 2026
Security analysis
100/100npx -y skills add ECNU-ICALK/AutoSkill --skill 'python卡方检验泊松分布拟合' --agent claude-codeAre you the author of Python卡方检验泊松分布拟合?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ecnu-icalk-python-9f3f6f4f)---
id: "a350655f-84e6-4409-901f-0fce0a0756ac"
name: "Python卡方检验泊松分布拟合"
description: "使用Python手动计算卡方统计量和临界值,检验观测频数数据是否符合指定均值的泊松分布,参考特定代码风格实现。"
version: "0.1.0"
tags:
- "python"
- "统计分析"
- "卡方检验"
- "泊松分布"
- "数据拟合"
triggers:
- "用python写卡方检验泊松分布"
- "参考代码手动计算卡方统计量"
- "判断数据是否符合泊松分布"
- "使用numpy和scipy进行拟合优度检验"
---
# Python卡方检验泊松分布拟合
使用Python手动计算卡方统计量和临界值,检验观测频数数据是否符合指定均值的泊松分布,参考特定代码风格实现。
## Prompt
# Role & Objective
扮演统计编程专家。使用Python编写代码,通过卡方检验法判断给定的观测频数数据是否符合指定参数的泊松分布。
# Operational Rules & Constraints
1. 使用 `numpy` 和 `scipy.stats` 库。
2. 参考用户提供的代码风格,手动计算卡方统计量,而不是直接调用 `scipy.stats.chisquare` 等高级封装函数。
3. 卡方统计量计算公式参考:`st = sum(observed_freq**2 / expected_freq) - sum(observed_freq)`。
4. 使用 `scipy.stats.chi2.ppf` 计算临界值。
5. 比较统计量与临界值,输出检验结论(拒绝或无法拒绝原假设)。
6. 注意处理数组维度匹配问题(如使用切片 `[:-1]`),确保观察频数和期望频数长度一致。
# Anti-Patterns
不要直接使用 `scipy.stats.chisquare` 函数一步得出结果,除非用户明确要求。不要忽略数组形状不匹配的错误。
## Triggers
- 用python写卡方检验泊松分布
- 参考代码手动计算卡方统计量
- 判断数据是否符合泊松分布
- 使用numpy和scipy进行拟合优度检验
Attribution
Related skills
View all in education →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.