independence_table.RdComputes table of expected frequencies (under the null hypotheses of independence) from an \(n\)-way table.
independence_table(x, frequency = c("absolute", "relative"))A table with either absolute or relative frequencies.
data("MSPatients")
independence_table(MSPatients)
#> , , Patients = Winnipeg
#>
#> Winnipeg Neurologist
#> New Orleans Neurologist Certain Probable Possible Doubtful
#> Certain 15.48817 10.760205 3.586735 5.706170
#> Probable 19.36022 13.450257 4.483419 7.132712
#> Possible 16.97742 11.794841 3.931614 6.254840
#> Doubtful 13.10538 9.104789 3.034930 4.828297
#>
#> , , Patients = New Orleans
#>
#> Winnipeg Neurologist
#> New Orleans Neurologist Certain Probable Possible Doubtful
#> Certain 7.172376 4.982914 1.660971 2.642454
#> Probable 8.965470 6.228642 2.076214 3.303068
#> Possible 7.862028 5.462040 1.820680 2.896536
#> Doubtful 6.068934 4.216312 1.405437 2.235923
#>
independence_table(MSPatients, frequency = "relative")
#> , , Patients = Winnipeg
#>
#> Winnipeg Neurologist
#> New Orleans Neurologist Certain Probable Possible Doubtful
#> Certain 0.07104667 0.04935874 0.01645291 0.02617509
#> Probable 0.08880834 0.06169843 0.02056614 0.03271886
#> Possible 0.07787808 0.05410477 0.01803492 0.02869193
#> Doubtful 0.06011641 0.04176509 0.01392170 0.02214815
#>
#> , , Patients = New Orleans
#>
#> Winnipeg Neurologist
#> New Orleans Neurologist Certain Probable Possible Doubtful
#> Certain 0.03290081 0.02285740 0.007619134 0.01212135
#> Probable 0.04112601 0.02857175 0.009523918 0.01515169
#> Possible 0.03606435 0.02505523 0.008351743 0.01328686
#> Doubtful 0.02783914 0.01934088 0.006446960 0.01025653
#>