Hi Eike,

Eike Rathke schrieb:
Hi Regina,

On Sunday, 2010-08-08 20:38:21 +0200, Regina Henschel wrote:

in method LINEST I get pMatX from the stack. That is a reference to
the matrix MatX. I calculate the means column wise getting a matrix
MeanX with associated reference pMeanX. In next step I calculate
        pMatX->GetDouble(i,j) - pMeanX->GetDouble(i,0)

Can I overwrite the values in matrix MatX with this results? Or must
the values of the matrix MatX remain unchanged by the method LINEST?

Use a new matrix created with ScInterpreter::GetNewMat(), a matrix
argument may be a matrix constant as in LINEST(...;{1|2|3|4};...)


I have not considered that in my tests, fortunately I ask here.

When X and Y are the given matrices and deltaX and deltaY those matrices where the means are subtracted, then the needed calculation for the coefficients B (in column arrangement) is in case of "with constant"
B = (deltaX' * deltaX)^{-1} * deltaX' * deltaY
and in case of "without constant"
B = (X' * X)^{-1} * X' * Y
where A' means transpose(A) and A^{-1} means inverse(A). So using deltaX instead of X would have been handy.

The current implementation avoids to copy the matrices X or Y, although that would ease and shorten the code. I thought there must be a reason for that and tried to avoid it too. I hesitate to copy X or Y, because they might have a huge number of lines. Statistical investigations with more then 1000 samples are commonly. The number of variables (=columns of X) is often 1 or at least under 10. So products as X'X are much smaller.

I will try only using new matrices for products like X'X as it is done in the current implementation. That will result in a lot of nearly identical multiplication methods, but I think, that is better than copying the matrices.

Kind regards
Regina




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@sc.openoffice.org
For additional commands, e-mail: dev-h...@sc.openoffice.org

Reply via email to