R数据操纵和卡方测试
我有一个数据框架:
gender group count total
female A 8 10
female B 23 30
female C 22 25
male A 18 28
male B 23 30
male C 40 70
如何处理数据并为性别之间的每个组应用卡方检验?
I have a data frame:
gender group count total
female A 8 10
female B 23 30
female C 22 25
male A 18 28
male B 23 30
male C 40 70
How should I process data and apply the chi-square test for each group between genders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先使用DPUT函数来使您的数据变得容易复制
,然后您可以通过组(或性别)来使用BY BY函数,
值得确保其测试确切地进行测试,但通过查看2*2矩阵此方法创建:
例如
First its handy to use dput function to make it easy for your data to be reproduced
then you can use the by function by group (or gender) like this
Its worth making sure its testing exactly what you want though by looking at the 2*2 matrix this method creates:
eg