Hi,
For a given (N x M) matrix A, the theorem on singular value decomposition states that:
A = U * S * V
where the columns of U are the eigenvectors of AA' and the columns of V are eigenvectors of A'A. And S is a diagonal matrix containing the square roots of non-negative eigenvalues from U in descending order.
In Eviews, the command @svd(A) returns the U matrix for A. I was wondering if there is a way to directly get the diagonal matrix S. Can anyone help?
Thanks.
Singular Value Decomposition (@svd)
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Re: Singular Value Decomposition (@svd)
Code: Select all
'create a random matrix
matrix A = @mnrnd(4,3)
'define the components
matrix U
vector S
matrix V
'decompose the matrix A
U = @svd(A,S,V)
'if you like S as a diagonal matrix
matrix MS = @makediagonal(S)Re: Singular Value Decomposition (@svd)
Thank you very much! It was very helpful.
Re: Singular Value Decomposition (@svd)
I get the "mistmatch message" when using @svd to a non-symetric matrix of 37x51. Are u sure, the formula can run for non-symetric matrices?
Who is online
Users browsing this forum: No registered users and 2 guests
