Sparse matrix in OLS , sparse matrix transpose and multiply

2 views (last 30 days)
I need to estimate B in this equation that u = error Y = B * X + u
the estimator of B = (inv (X '* X)) * (X' * Y)
X and Y are sparse matrix, how can I do it?
I use sparseinv instead of inv but I dint know how transpose it and maltiple them, Is there any one to know it?

Accepted Answer

Star Strider
Star Strider on 11 Dec 2018
See if the lsqr (link) function will do what you want.

More Answers (1)

Bruno Luong
Bruno Luong on 9 Dec 2018
  2 Comments
Nooshin Mahmoodi
Nooshin Mahmoodi on 11 Dec 2018
I can not use this because the matrix dimensions are not the same,
y is 15722*1 sparse double
and
X is 15772 *6 sparse double
Bruno Luong
Bruno Luong on 11 Dec 2018
Edited: Bruno Luong on 11 Dec 2018
B*X
must have 6 columns, and there is not B that can makes it becomes 1 column.
Unless if you ask to solve B for y = X*B then in this case
B = X\Y
Matrix multiplication must be expressed with correct order.

Sign in to comment.

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!