I have 2 vectors that I would like to correlate with one another: OptimismBias and AmbigTolG (listing the first 10 values out of 248).
-0.0263 0.0000
0.7971 0.0000
-0.2800 -0.0000
0.4088 0.0000
0.6691 0.0000
0.5348 NaN
0.2606 0.0000
0.6995 NaN
-0.3270 0.0000
0.4665 0.0139
When I run the corr, I get all NaNs at the output. I'm aware that the AmbigTolG values are 0 or close to 0 but I'm not sure how else to run this.

4 件のコメント

Tommy
Tommy 2020 年 8 月 1 日
What syntax are you using? Perhaps
corr(OptimismBias, AmbigTolG, 'rows', 'complete')
to ignore the NaN values?
Darla Bonagura
Darla Bonagura 2020 年 8 月 3 日
That solved it. Thank you!
Adam Danz
Adam Danz 2020 年 8 月 3 日
Tommy's comment should be an answer.
Adam Danz
Adam Danz 2021 年 6 月 13 日

サインインしてコメントする。

 採用された回答

Tommy
Tommy 2020 年 8 月 5 日

3 投票

You can use
corr(OptimismBias, AmbigTolG, 'rows', 'complete')
to ignore the NaN values.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDescriptive Statistics and Insights についてさらに検索

タグ

質問済み:

2020 年 7 月 31 日

コメント済み:

2021 年 6 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by