卡方分布的系数图

Coefplot for a chi square distribution

有人告诉我在 R 中做一个 coefplot 以更好地可视化我的数据。

所以我先做了卡方检验。在我将数据放入 table 之后,它看起来像这样:

                    1  2  3  5  6
 5_min_blank        11 21 18 19  8
 Boldstyle           6  7 14 10  2
 Boldstyle_pause     9 22 19  8  0
 Breaststroke        7 16 10  5  4
 Breaststroke_pause  9 13 10  8  3
 Diving             14 20 10 10  4

1-6 是类别,"bold style" 等是不同的声音。

我做了一个测试:

    fit.swim<-chisq.test(X2,simulate.p.value = TRUE, B = 10000)

得到这个结果:

Pearson's Chi-squared test with simulated p-value (based on 10000 replicates)

data:  X2
X-squared = 87.794, df = NA, p-value = 0.09479

现在我想用我的数据做一个系数图,但我只得到这个错误:

  coefplot(fit.swim)  
Error: $ operator is invalid for atomic vectors  

有什么想法可以画出漂亮的情节吗?

非常感谢您的帮助!

祝一切顺利

玛丽

我认为您收到该错误的原因是因为 coefplot 需要一个拟合模型作为 lm、glm 或 rxLinMod obj 形式的输入。

在您的案例中,您进行了拟合优度检验,该检验实质上是将观察到的样本分布与预期概率分布进行比较。没有拟合模型来绘制系数。