Yesterday I asked a question about least square optimization in R and it turned out that lm
function is the thing that I was looking for.
On the other hand, now I have an other least square optimization question and I am wondering if lm
could also solve this problem, or if not, how it can be handled in R.
I have fixed matrices B (of dimension n x m) and V (of dimension n x n), I am looking for an m-long vector u such that
sum( ( V - ( B %*% diag(u) %*% t(B)) )^2 )
is minimized.