-3

I am using Singular Value Decomposition (SVD) applied to Singular Spectrum Analysis (SSA) of a timeseries.

% original time series
x1= rand(1,10000);
N = length(x1);

% windows for trajectory matrix
L = 600;
K=N-L+1; 

% trajectory matrix/matrix of lagged vectors
X = buffer(x1, L, L-1, 'nodelay'); 

% Covariance matrix
A = X * X' / K;

% SVD
[U, S_temp, ~] = svd(A);


% The eigenvalues of A are the squared eigenvalues of X
S = sqrt(S_temp);
d = diag(S);
% Principal components
V = X' * U;
for i = 1 : L
    V(:, i) = V(:, i) / d(i);             
end

I wanted to know if there is a way to have the singular components (i.e. the columns of V) always positive.

X is always > 0 in my case (and also the Covariance matrix A)

gabboshow
  • 5,359
  • 12
  • 48
  • 98
  • 3
    The singular values are the numbers in the diagonal of `S`, and are always non-negative. Please rephrase your question. Also, `V = X'*U/diag(S)` gives an error – Luis Mendo Apr 01 '15 at 12:12
  • Hi Yes, you are right. Please have a look at my edited question... – gabboshow Apr 01 '15 at 12:24
  • possible duplicate of [Singular Components Analysis (SSA) and Singular Vector Decompositin (SVD) positive components](http://stackoverflow.com/questions/29273880/singular-components-analysis-ssa-and-singular-vector-decompositin-svd-positi) – knedlsepp Apr 01 '15 at 12:28
  • Instead of posting the same question again and again, you should rather make clarifications to your original one. I have now read this the third time and it is still unclear to me what you actually mean. – knedlsepp Apr 01 '15 at 12:32
  • 1
    Deleting the old questions is definitely not the way to go! – knedlsepp Apr 01 '15 at 12:33
  • @knedlsepp My question is "is it possible to modify SVD in order to get V always positive?" – gabboshow Apr 01 '15 at 12:39
  • 2
    It is also discouraged to cross-post to another SO site: http://stats.stackexchange.com/questions/144358/singular-value-decomposition-positive-components – knedlsepp Apr 01 '15 at 12:39
  • `V` is a matrix. The notion of a real number being positive can't be directly generalized to a matrix in the way you imagine. What do you mean by a *positive matrix*? – knedlsepp Apr 01 '15 at 12:40
  • @knedlsepp I am sorry if this bothers you, but I have quite some urgency. I wouldn't like to stay here arguing, but since there are different users that might help me in these others platforms I decided to post also there. – gabboshow Apr 01 '15 at 12:41
  • 2
    This doesn't only bother me: http://meta.stackexchange.com/questions/64068 This behavior won't get you any friends here. – knedlsepp Apr 01 '15 at 12:42
  • @knedlsepp I edited my question. What I meant is that V should have all the elements positive.. – gabboshow Apr 01 '15 at 12:43
  • I'm voting to close this question as off-topic because it is about the underlying mathematical / statistical concepts & not about programming. – gung - Reinstate Monica Apr 01 '15 at 16:03

1 Answers1

1

You may be looking for an algorithm such as non-negative matrix factorization.

This is available in Statistics Toolbox in the command nnmf, and there is a freely available third-party toolbox as well.

Sam Roberts
  • 23,951
  • 1
  • 40
  • 64
  • Hi Sam, thanks a lot! I am aware of nnmf, but I would like to use something like SVD since it decompose the matrix in sum of matrices...Do you know about a non negative SVD or something similar? – gabboshow Apr 02 '15 at 17:45