Correlation coefficient of NaN values

41 ビュー (過去 30 日間)
Indrani
Indrani 2023 年 7 月 5 日
回答済み: Abhinav 2023 年 7 月 5 日
Is there a function to calculate correlation coeffient of 2 sets of data, which have a few NaN values?

採用された回答

Aakash
Aakash 2023 年 7 月 5 日
MATLAB provides a function to calculate the correlation coefficient between two sets of data, even if they contain NaN values. The function you can use is corrcoef.
For Example:
x = [1, 2, 3, NaN, 5];
y = [2, NaN, 4, 5, 6];
% Calculate the correlation coefficient
C = corrcoef(x, y, 'Rows', 'complete');
% Extract the correlation coefficient from the resulting matrix
correlation_coefficient = C(1, 2);
Refer the documentation for more details

その他の回答 (1 件)

Abhinav
Abhinav 2023 年 7 月 5 日
Please refer to the following Doc on corrcoef, should help you.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by