- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi All.

I have multiple regression model X * B = Y + e, where X - Txm, B - mxn, Y and e - Txn and I want to get residuals "e", without actualy calculation B. So I want to use QR decomposition of matrix X, and do it as following: e = Y - Q *(Q'*Y); So I want to use DORGQR twice. Assume, we use all elementary reflectors, and Q is Txm matrix.

Everything ok with the first call, I get Q'Y which is mxn matrix. But there is a problem with second call, in accordance with the article:

http://software.intel.com/sites/products/documentation/hpc/mkl/mklman/index.htm#lse/functn_ormqr.htm

I don't have any way to specify the number of rows in matrix Q. In section "Fortran 95 Interface Notes" (it's not very clear for me, why here) I see the note:

a:

Holds the matrix A of size (r,k).

r = m if side = 'L'.

r = n if side = 'R'

So I just want to multiply Q (Txm) and Q'R (mxn), but routine automatically assumes that Q is mxk which is definitely not what I want. May be somebody can give me a hint? What I'm doing wrong? Extraction Q matrix explicitly doesn't seem to be a good solution for me, I want to reduce memory usage.

Link Copied

1 Reply

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Let B = [b1 b2 b3 ... ], Y = [y1 y2 y3 ...], e = [e1 e2 e3 ... ]

where b1, b2, b3... are individual columns of B or, at your choosing, groups of columns that you are willing to process together.

You call DGEQRF once to perfom the QR decomposition of X, with Q stored implicitly in the result.

You then call DORMQR to solve for b1, which you then use to compute e1 = X b1 - y1, and similarly for e2, e3, ... For this to work, you need to save a copy of X before the call to DGEQRF, which overwrites X. Or, it may be just as easy to regenerate the necessary portions of X.

Would this approach satisfy your needs?

Minor note: you have inconsistent signs for the error matrix e in your post.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page