Re: EOF explained variance



"Leandro Calil" <leandro@xxxxxxxxxxxxxxxx> wrote in message <g5j7ua$s3l
$1@xxxxxxxxxxxxxxxxxx>...

Sorry, I forgot to say that I just considering curl
magnitudes. I am dealing the curl as one scalar quantity, as
you thought.

This is the problem:

%MY DATA MATRIX SHOULD BE: Z(position,time)
Z = 126 x 8036 -> I have 126 positions and 8036 times

% CALCULATE MEAN FOR EACH LINE (SPATIAL DEPENDENT MEAN) - ZM(jj)
zm = mean(z');

% SUBTRACT THE MEAN FROM ORIGINAL DATA - Z(jj,nn)
jj = length(Z(:,1));
for j=1:jj; z(j,:)=z(j,:)-zm(j); end

% CALCULATE COVARIANCE MATRIX (Z'*Z) - C(nn,nn)
c = z'*z; -> result in a 8036 x 8036 matrix

% EXTRACT EIGENVALUES AND EIGENVECTORS USING SVD
[u,s,v] = svd(c); -> In this part &#8220;out of memory&#8221;
%[u,s,v] = svd(c,'econ'); -> I also tried

% CALCULATE EXPLAINED VARIANCE
lamb = diag(s);
ev = lamb/trace(c);

*this is a part of professor Paiva routine

Thanks

There appear to be two things wrong with the code you show here. In zm =
mean(z') you are taking the mean along the 8036-element rows of Z and
obtaining 126 different mean values. This means, as I suspected, that in the
language of covariances, each column of Z is an observation (at a particular
time) and each row is a variable (curl magnitude at a position throughout
time.) Therefore your covariance matrix should be of size 126 x 126, where
you are comparing all the various pairs of variables (positions.) However, you
have generated a 8036 x 8036 matrix which would be comparing different
pairs of times as positions varied. I am sure that was not your intent. You
have your observations and variables interchanged! If you wanted to get the
covariance, you should call on 'cov' with cov(Z'), not cov(Z).

However, I believe there is no need to find the covariance if you are going to
use singular value decomposition. Just call on 'svd' directly, but not with Z.
You must use Z' with the mean having been subtracted as you have done
above.

[U,S,V] = svd(Z','econ');

This way U would be 8036 x 126, and both S and V are 126 x 126. This
ought not to run you into memory problems.

The rest of the calculations I leave to you. (Remember that the variances are
obtained from the squares of the diagonal terms in S if you do things this
way.)

Roger Stafford


.



Relevant Pages

  • Re: EOF explained variance
    ... I forgot to say that I just considering curl ... % CALCULATE COVARIANCE MATRIX - C ... % EXTRACT EIGENVALUES AND EIGENVECTORS USING SVD ... EOF analysis of this field. ...
    (comp.soft-sys.matlab)
  • Re: EOF explained variance
    ... I have an NCEP derived product. ... EOF analysis of this field. ... symmetric covariance matrix which is them decomposed into ... The curl is a three-dimensional vector quantity. ...
    (comp.soft-sys.matlab)
  • Re: covariance
    ... >>People do things sometimes with two time series ... >the its state covariance matrix as below. ... >retrieve Paa and Pbb based on my dataset. ...
    (sci.stat.math)
  • Re: Principal Components (Hotelling of KL Transform) of 2 Band (Red and Green) Real Color Image
    ... would appear that it is indeed the covariance matrix that I should ... Masters warns that if the eigenvalues are nearly equal, then the eigenvectors are ill-defined; doesn't that mean a circularly-symmetrical data cloud? ...
    (sci.image.processing)
  • Re: EOF explained variance
    ... I forgot to say that I just considering curl ... % CALCULATE COVARIANCE MATRIX - C ... % EXTRACT EIGENVALUES AND EIGENVECTORS USING SVD ... % CALCULATE EXPLAINED VARIANCE ...
    (comp.soft-sys.matlab)