The question refers to @whuber's algorithm to draw a random variable with a given covariance structure to a given set of random variables: https://stats.stackexchange.com/a/313138/3277
The algorithm does exactly what it is supposed to do.
However, I don't grasp yet how and why it does so. Can anyone please clarify WHY the proposal by @whuber actually works.
In particular,
1) one line of his code reads
y.dual <- with(svd(y), (n-1)*u %*% diag(ifelse(d > 0, 1/d, 0)) %*% t(v))
where the inner matrix is a diagonal matrix containing the inverses of all singular values of y.
u contains the left-singular vectors of y. v contains the right-singular values of y.
So what is y.dual ?
2) the final step in calculating z is
z <- y.dual %*% rho + sigma*e
Why do we have to add sigma*e here?
And, frankly, why does y.dual %*% rho + sigma*e
produce what we are looking for?
I would be grateful for a clarification / explanation of this procedure.