Calculating the Pairwise covariance: with NaN's

1 vue (au cours des 30 derniers jours)
Peter Mills
Peter Mills le 5 Déc 2017
Commenté : Peter Mills le 6 Déc 2017
I am trying to calculate the pairwise covariance.
x=rand(100,36);
TheNaNC=randi([1 100],1,10);
TheNaNV=randi([1 36],1,10);
x(TheNaNC,TheNaNV)=NaN;
c2 = cov(x,'partialrows');
I get the following error message: 'Error using cov (line 64) The number of elements in x and y must match.'
Also tried:
c3 = cov(x,'omitrows');
'Error using cov (line 64) The number of elements in x and y must match.'
What am I doing wrong with this?
I am trying to calculate the covariance the why R calculate it but using MATLAB
  4 commentaires
Torsten
Torsten le 6 Déc 2017
The random integers should be drawn between 1 and 100 (1 and 36), not 0 and 100 (0 and 36).
Best wishes
Torsten.
Peter Mills
Peter Mills le 6 Déc 2017
Ok have changed this. My problem is with calculate the covariance with NaN's in the data without throwing away data

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by