function to measure the correlation between nominal and continuous data

29 ビュー (過去 30 日間)
cgo
cgo 2020 年 4 月 22 日
回答済み: BhaTTa 2024 年 7 月 17 日
I am looking for a function that measures the correlation (Cramer's V, or something similar) of categorical + continuous data sets. I can't seem to find one. Can someone point me to the right direction.

回答 (1 件)

BhaTTa
BhaTTa 2024 年 7 月 17 日
In MATLAB, you can use different statistical methods to measure the correlation between categorical and continuous data sets. While MATLAB does not have a built-in function for Cramér's V, you can use ANOVA (Analysis of Variance) to assess the relationship between a categorical variable and a continuous variable. You can also use point-biserial correlation if your categorical variable is binary.
Example: Using ANOVA in MATLAB
ANOVA can help determine if there are statistically significant differences between the means of different categories of a categorical variable.
% Example data
continuous = [1.2, 2.3, 3.1, 4.5, 5.0, 6.7, 7.8, 8.2, 9.1, 10.5];
categorical = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]; % Binary categorical variable
% Perform ANOVA
[p, tbl, stats] = anova1(continuous, categorical);
% Display the results
disp('ANOVA Table:');
disp(tbl);
% Display the p-value
disp(['p-value: ', num2str(p)]);

カテゴリ

Help Center および File ExchangeANOVA についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by