Spearman correlation fails in ranking strings
2 ビュー (過去 30 日間)
I would like to compute the correlation between two rankings. Namely, I have two ranked variables, say:
7.00124562206948 'DR CONGO'
and a money2 table:
0.123754360000000 'DR CONGO'
Now simply I would like to compare the two variables ranked country1 and country2 as:
but the following error occurs:
Check for missing argument or incorrect argument data type in call to function 'imag'.
Error in corr (line 192)
complexdata = ~(isreal(x) || all(imag(x(:))==0));
what am I doing wrong?
P.s. the rownames are the names of the country.
Jeff Miller 2022 年 1 月 11 日
The first two inputs to the corr command have to be the numerical values that are to be correlated, so you will want something like
However, you have to make sure that the rows of the two tables correspond (e.g., first row of each table has BURUNDI, second row has CHAD, etc). Maybe you can do that with sortrows()