How do I use nancov on a a matrix that has multiple consecutive rows of NaN in some of the columns?
2 ビュー (過去 30 日間)
古いコメントを表示
I am trying to use nancov on a matrix that has multiple consecutive rows of NaN in some of the columns, and nancov simply returns a matrix full of zeros. (The NaN values are due to gaps in the data.) Any suggestions for alternatives or ways to get around this?
2 件のコメント
the cyclist
2011 年 10 月 15 日
Are you able to show us the data (or a small subset) that exhibit the issue? Also, why do you think the result is incorrect? Could it be that the covariance is truly zero?
採用された回答
the cyclist
2011 年 10 月 16 日
After removing the observations (i.e. rows) that have any NaNs in them, you are left with only one row. You can't take the covariance of a single observation.
I don't fully understand why MATLAB creates output of all zeros. (It seems like an output of NaN would be more appropriate.) But that's the underlying cause.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!