[R] How Can SVD Reconstruct a Matrix

Martyn Byng martyn.byng at nag.co.uk
Thu Aug 14 18:38:51 CEST 2014


Hi,

The G matrix can be constructed from the SVD because GGt is square and symmetric, so the matrices of the left and right singular values (i.e. U and V) are the same.

Martyn

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Peter Brady
Sent: 14 August 2014 07:58
To: r-help at r-project.org
Subject: [R] How Can SVD Reconstruct a Matrix

Hi All,

I've inherited some R code that I can't work out what they've done.  It appears to work and give sort of reasonable answers, I'm just trying to work out why they've done what they have.  I suspect that this is a simple vector identity that I've just been staring at too long and have forgotten...

The code:

GGt <- M0 - M1 %*% M0inv %*% t(M1)
svdGG <- svd(GGt)
Gmat <- svdGG$u %*% diag(sqrt(svdGG$d))

It is supposed to solve:

G*G^T = M0 - M1*M0^-1*M1^T

for G, where G^T is the transpose of G.  It is designed to reproduce a numerical method described in two papers:

Srikanthan and Pegram, Journal of Hydrology, 371 (2009) 142-153, Equation A13, who suggest the SVD method but don't describe the specifics, eg: "...G is found by singular value decomposition..."

Alternatively, Matalas (1967) Water Resources Research 3 (4) 937-945, Equation 17, say that the above can be solved using Principle Component Analysis (PCA).

I use PCA (specifically POD) and SVD to look at the components after decomposition, so I'm a bit lost as to how the original matrix G can be constructed in this case from only the singular values and the left singular vectors.  Like I said earlier, I suspect that this is a simple array identity that I've forgotten.  My Google Fu is letting me down at this point.

My questions:
1) What is the proof, or where can I better find it to satisfy myself, that the above works?

2) Alternatively, can anyone suggest how I could apply PCA in R to compute the same?

Thanks in advance,
-pete

--
Peter Brady
Email: pdbrady at ans.com.au
Skype: pbrady77

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.\ _...{{dropped:3}}



More information about the R-help mailing list