Why is corr/corrcoef returning NaNs?

27 Ansichten (letzte 30 Tage)
Darla Bonagura
Darla Bonagura am 31 Jul. 2020
Kommentiert: Adam Danz am 13 Jun. 2021
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 Kommentare
Adam Danz
Adam Danz am 3 Aug. 2020
Tommy's comment should be an answer.
Adam Danz
Adam Danz am 13 Jun. 2021

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Tommy
Tommy am 5 Aug. 2020
You can use
corr(OptimismBias, AmbigTolG, 'rows', 'complete')
to ignore the NaN values.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by