使用Wolfram 语言,您可以使用AbsoluteCorrelation .
和
t = {
{1, 0, 0, 1, 0}, {0, 1, 0, 1, 1},
{0, 1, 1, 0, 0}, {0, 0, 0, 1, 0},
{1, 1, 1, 0, 0}, {0, 1, 1, 0, 1},
{1, 0, 1, 0, 0}, {1, 0, 0, 1, 1},
{0, 1, 0, 1, 1}, {0, 0, 1, 1, 0}
}
然后
MatrixForm[ac = AbsoluteCorrelation[t]]

其中对角线是边缘列频率,非对角线是联合频率。也就是说,ac[[1,1]]变量a以 0.4 的频率出现,而ac[[1,2]](第 1 行,第 2 列)变量与频率为 0.1的变量a共同出现b
这可以使用MatrixPlot或ArrayPlot进行可视化。
MatrixPlot[
ac
, FrameTicks -> {Transpose@{Range@5, CharacterRange["a", "e"]}}
, PlotLegends -> Automatic]

希望这可以帮助。