LazStats: More refactoring of WLSUnit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7776 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-12 21:53:18 +00:00
parent 27d63f9c58
commit 9013e01332
4 changed files with 237 additions and 150 deletions

View File

@ -53,7 +53,7 @@ procedure EffectCode(GridCol, min, max : integer;
procedure MReg(NoIndep: integer; const IndepCols: IntDyneVec; DepCol: integer;
const RowLabels: StrDyneVec;
const Means, Variances, StdDevs, BWeights, BetaWeights, BStdErrs, Bttests, tProbs: DblDyneVec;
out R2, StdErrEst: double; out NCases: integer; out ErrorCode: boolean;
out R2, StdErrEst: double; NCases: integer; out ErrorCode: boolean;
PrintAll: boolean; AReport: TStrings);
procedure Dynnonsymroots(var a : DblDyneMat; nv : integer;
@ -347,16 +347,14 @@ begin
end;
//-------------------------------------------------------------------
// Product of matrix b times c with results returned in a
// Product of matrix B times C with results returned in a: A = B C
procedure MatAxB(const A, B, C: DblDyneMat; BRows, BCols, CRows, CCols: Integer;
out ErrorCode: boolean);
var
i, j, k: integer;
begin
ErrorCode := false;
if (BCols <> CRows) then
ErrorCode := true
else
ErrorCode := BCols <> CRows;
if not ErrorCode then
begin
for i := 0 to BRows-1 do
begin
@ -633,7 +631,7 @@ end;
Variances ... Variance of each independent variable
StdDevs ..... Standard deviations of each independent variable
NCases ...... Count of valid cases found in the grid
NCases ...... Count valid cases in the grid
ErrorCode ... if true, an error has occured during the calculations
PrintAll .... if true, intermediate matrices and vectors are written to the report
AReport ..... a string list to which the report is written.
@ -641,7 +639,7 @@ end;
procedure MReg(NoIndep: integer; const IndepCols: IntDyneVec; DepCol: integer;
const RowLabels: StrDyneVec;
const Means, Variances, StdDevs, BWeights, BetaWeights, BStdErrs, Bttests, tProbs: DblDyneVec;
out R2, StdErrEst: double; out NCases: integer; out ErrorCode: boolean;
out R2, StdErrEst: double; NCases: integer; out ErrorCode: boolean;
PrintAll: boolean; AReport: TStrings);
var
i, j, N: integer;
@ -751,6 +749,9 @@ begin
// get product of the augmented X transpose times augmented X
MatAXB(XTX, XT, X, NoIndep+1, NCases, NCases, NoIndep+1, errorcode);
if errorCode then
exit;
if PrintAll then
begin
title := 'XTX MATRIX';