我正在使用泊松分布的拟合优度来计算P值
[观察到的数据点为:118 64 18,预期值为:120 61.25 18.8
我用泊松分布计算了概率,所以df值为3-1-1 = 1
我从R得到df = 4
这是我放在R中的内容
Chi.Observed <- c(118,64,18)
Chi.Expected <- c(120,61.2,18.8)
chisq.test(Chi.Observed, Chi.Expected)
答案是:
Pearson's Chi-squared test
Chi.Observed and Chi.Expected
X-squared = 6, df = 4, p-value = 0.1991
我将在一分钟内显示如何更改测试,但是这里有一些问题。
dpois(0:1,lambda=0.51)*200
给出(120.09912,61.25055)
,ppois(1,lambda=0.51,lower.tail=FALSE)
给出18.6,所以我假设这里的概率是200计数中的0、1和> = 2计数的概率sum(Chi.Observed)
为200,sum((0:2)*Chi.Observed/sum(Chi.Observed))
为0.5,因此非常吻合。因此,您已经从3个数字值中得出2条信息来生成您的期望值,并且您的df应该为1似乎很合理。这是破解测试的方法:
Chi.Observed <- c(118,64,18)
Chi.Expected <- c(120,61.2,18.8)
cc <- chisq.test(Chi.Observed, Chi.Expected)
cc$parameter <- c(df=1)
cc$p.value <- pchisq(cc$statistic,df=cc$parameter,
lower.tail=FALSE)
cc
## Pearson's Chi-squared test
## data: Chi.Observed and Chi.Expected
## X-squared = 6, df = 1, p-value = 0.01431