Correlation coefficient of NaN values
조회 수: 46 (최근 30일)
이전 댓글 표시
채택된 답변
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
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!