Using QR decomposition to solve least squares in Matlab -
i using matlab estimate regression model ordinary least squares (ols).
the model y = xb, x sparse matrix dimension 500000 x 2500. i'm using qr decomposition:
[c,r] = qr(x,y,0) and estimating b with
b = r\c my question whether need worried numerical errors here. there additional iteration need do? should check condition number of r, or r'r? guidance appreciated.
the matlab recommended way is:
b = x\y;
check http://www.mathworks.com/help/matlab/ref/mldivide.html , section more about in particular, see how matlab handles different cases under hood.
if want exploit sparseness of x declare x sparse, x = sparse(x), before call \.
Comments
Post a Comment