这是我的列联表cxTable
:
Always Wrong Almst Always Wrg Sometimes Wrong Not Wrong At All
Lower Class 1344 166 146 73
Working Class 11997 1775 1105 355
Middle Class 11221 2320 1188 341
Upper Class 696 177 125 47
添加边距效果很好:
> marginCxTable = addmargins(cxTable)
> marginCxTable
Always Wrong Almst Always Wrg Sometimes Wrong Not Wrong At All Sum
Lower Class 1344 166 146 73 1729
Working Class 11997 1775 1105 355 15232
Middle Class 11221 2320 1188 341 15070
Upper Class 696 177 125 47 1045
Sum 25258 4438 2564 816 33076
但是,加上分数,我的总和只有 25% 而不是 100%。所有其他条目也除以四。
> prop.table(marginCxTable)
Always Wrong Almst Always Wrg Sometimes Wrong Not Wrong At All Sum
Lower Class 0.0101584230 0.0012546862 0.0011035192 0.0005517596 0.0130683880
Working Class 0.0906775305 0.0134160721 0.0083519773 0.0026832144 0.1151287943
Middle Class 0.0848122506 0.0175353731 0.0089793204 0.0025773975 0.1139043415
Upper Class 0.0052606119 0.0013378280 0.0009447938 0.0003552425 0.0078984762
Sum 0.1909088161 0.0335439594 0.0193796106 0.0061676140 0.2500000000
我可能错过了一些非常简单的东西。谢谢你的帮助。