mjca中MCA变量坐标和补充变量坐标的等价物是什么?

时间:2016-02-10 14:24:44

标签: r coordinates correspondence-analysis

我想在我的数据上使用mjca(package' ca'),以便更加真实地估计维度的解释变化。问题是我想提取活动和补充变量的坐标,以便在数据框中编辑它们。但是,mjca的输出中没有给出变量和维度的名称。在MCA(包' FactoMineR')中,输出如下:

> mca$var$coord
                       Dim 1        Dim 2        Dim 3       Dim 4       Dim 5
a                0.620468268  0.011534137 -0.542655702  0.47922448  0.15548571
cl               1.231043177  4.591555841 -0.323929172  0.19597918 -0.41446395
np              -0.347646238  0.003735466 -0.006099464  0.02238883  0.16510343
num              0.417635652 -0.351884061 -0.760499677  0.60590774 -0.35647256
pr               0.945109906 -0.227098798  3.411969743  2.70823750 -0.64981046
vp               0.809895398 -0.303805822  0.048900811 -0.50023568 -0.53191069
EMB_no           0.396034450 -0.046768029 -0.058069978  0.05448188  0.06326411
EM_yes          -1.009887848  0.119258474  0.148078445 -0.13892880 -0.16132349
ca              -0.345163332 -0.088791765 -0.222907122  0.16679404 -0.12407031
to               0.375618920  0.096626332  0.242575397 -0.18151117  0.13501769
ART_no          -0.006456155  0.021963298  0.049258256 -0.05919682 -0.07539649
ART_yes          0.044475732 -0.151302718 -0.339334655  0.40780032  0.51939806

> mca$quali.sup$coord
                   Dim 1       Dim 2      Dim 3       Dim 4       Dim 5
ipva            -0.1508708  0.04768873 -0.0233159  0.08795449  0.01645747
isv              0.6731160 -0.21276510  0.1040248 -0.39241234 -0.07342562

有没有办法将变量名称提取并粘贴到mjca中的坐标?在mjca中,输出不易解释:

> mjca$colcoord
             [,1]         [,2]         [,3]        [,4]        [,5]        [,6]        [,7]
 [1,] -1.14877950  -0.03284730   1.85933139  1.71512222  0.59783898  2.33329527 -1.96334559
 [2,] -2.27924173 -13.07598521   1.10989653  0.70140040 -1.59360435 -0.53239520  0.59206669
 [3,]  0.64365721  -0.01063798   0.02089893  0.08012859  0.63481889 -0.18685503  0.16878106
 [4,] -0.77324063   1.00210711   2.60574231  2.16851574 -1.37062878  1.00967151 -7.97223158
 [5,] -1.74984434   0.64673950 -11.69062156  9.69265663 -2.49850629 -0.05490287 -0.25510472
 [6,] -1.49949849   0.86518831  -0.16755157 -1.79032033 -2.04518437 -0.20949668  0.65583755
 [7,] -0.73324662   0.13318755   0.19896839  0.19498813  0.24324906  0.05337135  0.15195814
 [8,]  1.86977887  -0.33962824  -0.50736940 -0.49721974 -0.62028511 -0.13609695 -0.38749326
 [9,]  0.63906018   0.25286414   0.76375906  0.59694816 -0.47704750 -0.12352216 -0.44654719
[10,] -0.69544784  -0.27517568  -0.83114957 -0.64962006  0.51913993  0.13442117  0.48594841
[11,]  0.01195339  -0.06254781  -0.16877630 -0.21186268 -0.28989778 -0.27854165 -0.39280823
[12,] -0.08234556   0.43088491   1.16268119  1.45949845  1.99707361  1.91884250  2.70601223
[13,] -0.76304235   0.48124458   1.23544015  1.02426084  0.57083939  1.79253772 -0.83528819
[14,] -1.64355033  -5.87863606   0.76112230  0.59773026 -0.22298799  0.40707187 -0.23302386
[15,] -0.40920789   0.55803109   1.06737902  0.94054386  0.10598994 -0.60665661 -1.11993976

我想我应该首先提取这样的坐标:

coord.mjca<-as.data.frame(mjca$colcoord)
row.names(coord.mjca)<-mjca$levelnames
colnames(coord.mjca)<-c("Dim 1", "Dim 2", "Dim 3", "Dim 4", "Dim 5", "Dim 6", "Dim 7")

你认为我应该这样做吗?

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

在ca包中,您可以使用cacoord。

例如

cacoord(mca, type='rowprincipal', rows=T)
cacoord(mca, type='symmetric', cols=T)

我希望这会有所帮助。