You've already forked lazarus-ccr
LazStats: Less hints.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7409 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1017,7 +1017,7 @@ end;
|
|||||||
|
|
||||||
procedure TAutoCorrFrm.realft(var data: DblDyneVec; n: longword; isign: integer);
|
procedure TAutoCorrFrm.realft(var data: DblDyneVec; n: longword; isign: integer);
|
||||||
var
|
var
|
||||||
i,i1,i2,i3,i4,np3 : longword;
|
i,i1,i2,i3,i4,np3 : integer; // was: longword;
|
||||||
c1,c2,h1r,h1i,h2r,h2i : double;
|
c1,c2,h1r,h1i,h2r,h2i : double;
|
||||||
wr,wi,wpr,wpi,wtemp,theta : double;
|
wr,wi,wpr,wpi,wtemp,theta : double;
|
||||||
|
|
||||||
|
@ -153,15 +153,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCannonFrm.ComputeBtnClick(Sender: TObject);
|
procedure TCannonFrm.ComputeBtnClick(Sender: TObject);
|
||||||
const
|
|
||||||
SEPARATOR = '===========================================================================';
|
|
||||||
var
|
var
|
||||||
i, j, k, count, a_size, b_size, no_factors, novars, IER: integer;
|
i, j, k, count, a_size, b_size, no_factors, novars: integer;
|
||||||
cellstring, gridstring: string;
|
cellstring, gridstring: string;
|
||||||
s, m, n, df1, df2, q, w, pcnt_extracted, trace : double;
|
s, m, n, df1, df2, q, w, pcnt_extracted, trace : double;
|
||||||
minroot, critical_prob, Lambda, Pillia : double;
|
minroot, critical_prob, Lambda, Pillia : double;
|
||||||
chisqr, HLTrace, chiprob, ftestprob, Roys, f, Hroot : double;
|
chisqr, HLTrace, chiprob, ftestprob, Roys, f, Hroot : double;
|
||||||
raa, rbb, rab, rba, bigmat, prod, first_prod, second_prod : DblDyneMat;
|
raa, rbb, rab, rba, bigmat, first_prod, second_prod : DblDyneMat;
|
||||||
char_equation, raainv, rbbinv, eigenvectors, norm_a, norm_b : DblDyneMat;
|
char_equation, raainv, rbbinv, eigenvectors, norm_a, norm_b : DblDyneMat;
|
||||||
raw_a, raw_b, a_cors, b_cors, eigentrans, theta, tempmat : DblDyneMat;
|
raw_a, raw_b, a_cors, b_cors, eigentrans, theta, tempmat : DblDyneMat;
|
||||||
mean, variance, stddev, roots, root_chi, chi_prob, pv_a, pv_b : DblDyneVec;
|
mean, variance, stddev, roots, root_chi, chi_prob, pv_a, pv_b : DblDyneVec;
|
||||||
@ -209,7 +207,6 @@ begin
|
|||||||
SetLength(rab,a_size,b_size);
|
SetLength(rab,a_size,b_size);
|
||||||
SetLength(rba,b_size,a_size);
|
SetLength(rba,b_size,a_size);
|
||||||
SetLength(bigmat,novars+1,novars+1);
|
SetLength(bigmat,novars+1,novars+1);
|
||||||
SetLength(prod,novars,novars);
|
|
||||||
SetLength(first_prod,novars,novars);
|
SetLength(first_prod,novars,novars);
|
||||||
SetLength(second_prod,novars,novars);
|
SetLength(second_prod,novars,novars);
|
||||||
SetLength(char_equation,novars,novars);
|
SetLength(char_equation,novars,novars);
|
||||||
@ -296,7 +293,7 @@ begin
|
|||||||
// Get means, standard deviations, etc. for total matrix
|
// Get means, standard deviations, etc. for total matrix
|
||||||
Correlations(novars,selected,bigmat,mean,variance,stddev,errorcode,Ncases);
|
Correlations(novars,selected,bigmat,mean,variance,stddev,errorcode,Ncases);
|
||||||
count := Ncases;
|
count := Ncases;
|
||||||
if (IER = 1)then
|
if errorcode then // wp: was "if (IER = 1) then", but IER is not initialized...
|
||||||
begin
|
begin
|
||||||
MessageDlg('Zero variance found for a variable-terminating', mtError, [mbOK], 0);
|
MessageDlg('Zero variance found for a variable-terminating', mtError, [mbOK], 0);
|
||||||
exit;
|
exit;
|
||||||
@ -327,7 +324,7 @@ begin
|
|||||||
title := 'Left-Right Correlation Matrix';
|
title := 'Left-Right Correlation Matrix';
|
||||||
MatPrint(rab, a_size, b_size, title, RowLabels, ColLabels, NCases, lReport);
|
MatPrint(rab, a_size, b_size, title, RowLabels, ColLabels, NCases, lReport);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -367,7 +364,7 @@ begin
|
|||||||
MatPrint(char_equation, b_size, b_size, title, CanLabels, CanLabels, NCases, lReport);
|
MatPrint(char_equation, b_size, b_size, title, CanLabels, CanLabels, NCases, lReport);
|
||||||
|
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
// now get roots and vectors of the characteristic equation using
|
// now get roots and vectors of the characteristic equation using
|
||||||
@ -503,7 +500,7 @@ begin
|
|||||||
lReport.Add('Roys Largest Root F-Test %10.4f %2.0f %2.0f %12.4f', [Roys, df1, df2, ftestprob]);
|
lReport.Add('Roys Largest Root F-Test %10.4f %2.0f %2.0f %12.4f', [Roys, df1, df2, ftestprob]);
|
||||||
|
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
if EigenChk.Checked then
|
if EigenChk.Checked then
|
||||||
@ -511,7 +508,7 @@ begin
|
|||||||
title := 'Eigenvectors';
|
title := 'Eigenvectors';
|
||||||
MatPrint(eigenvectors, b_size, b_size, title, CanLabels, CanLabels, NCases, lReport);
|
MatPrint(eigenvectors, b_size, b_size, title, CanLabels, CanLabels, NCases, lReport);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -522,7 +519,7 @@ begin
|
|||||||
MatPrint(norm_b, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
|
MatPrint(norm_b, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
|
||||||
|
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
title := 'Raw Right Side Weights';
|
title := 'Raw Right Side Weights';
|
||||||
@ -532,7 +529,7 @@ begin
|
|||||||
MatPrint(raw_b, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
|
MatPrint(raw_b, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
|
||||||
|
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
title := 'Right Side Correlations with Function';
|
title := 'Right Side Correlations with Function';
|
||||||
@ -542,7 +539,7 @@ begin
|
|||||||
MatPrint(b_cors, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
|
MatPrint(b_cors, b_size, b_size, title, ColLabels, CanLabels, NCases, lReport);
|
||||||
|
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
if RedundChk.Checked then
|
if RedundChk.Checked then
|
||||||
@ -563,7 +560,7 @@ begin
|
|||||||
lReport.Add('%8d %15.5f %12.5f', [i, pv_b[i-1], rd_b[i-1]]);
|
lReport.Add('%8d %15.5f %12.5f', [i, pv_b[i-1], rd_b[i-1]]);
|
||||||
|
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
lReport.Add(SEPARATOR);
|
lReport.Add(DIVIDER);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -604,7 +601,6 @@ begin
|
|||||||
char_equation := nil;
|
char_equation := nil;
|
||||||
second_prod := nil;
|
second_prod := nil;
|
||||||
first_prod := nil;
|
first_prod := nil;
|
||||||
prod := nil;
|
|
||||||
rba := nil;
|
rba := nil;
|
||||||
rab := nil;
|
rab := nil;
|
||||||
rbb := nil;
|
rbb := nil;
|
||||||
|
@ -122,7 +122,7 @@ var
|
|||||||
Cumfreq2 : DblDyneVec;
|
Cumfreq2 : DblDyneVec;
|
||||||
i, j, k, col1, col2, Ncases, noints : integer;
|
i, j, k, col1, col2, Ncases, noints : integer;
|
||||||
min1, max1, min2, max2, range1, range2, value : double;
|
min1, max1, min2, max2, range1, range2, value : double;
|
||||||
incrsize1, incrsize2, prob1,prob2, KS, mean, DegFree : double;
|
incrsize1, incrsize2, prob1,prob2, {%H-}KS, mean, DegFree : double;
|
||||||
cellval, name1, name2 : string;
|
cellval, name1, name2 : string;
|
||||||
df1, df2 : integer;
|
df1, df2 : integer;
|
||||||
xtitle : string;
|
xtitle : string;
|
||||||
|
@ -140,16 +140,16 @@ end;
|
|||||||
procedure TNormalityFrm.ApplyBtnClick(Sender: TObject);
|
procedure TNormalityFrm.ApplyBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
w: Double = 0.0;
|
w: Double = 0.0;
|
||||||
temp, pw : double;
|
pw: Double = 0.0;
|
||||||
|
temp: double;
|
||||||
skew, kurtosis : double;
|
skew, kurtosis : double;
|
||||||
mean, variance, stddev, deviation, devsqr, M2, M3, M4 : double;
|
mean, variance, stddev, deviation, devsqr, M2, M3, M4 : double;
|
||||||
i, j, n, n1, n2, ier : integer;
|
i, j, n, n1, n2, ier : integer;
|
||||||
varlabel : string;
|
|
||||||
selcol : integer;
|
selcol : integer;
|
||||||
data, a, z, x : DblDyneVec;
|
data, a, z, x : DblDyneVec;
|
||||||
freq : IntDyneVec;
|
freq : IntDyneVec;
|
||||||
fval, jval, DP : DblDyneVec;
|
fval, jval, DP : DblDyneVec;
|
||||||
F1, DPP, D, D1, A0, C1, D15, D10, D05, D025, t2 : double;
|
F1, DPP, D, A0, C1, D15, D10, D05, D025, t2 : double;
|
||||||
init : boolean;
|
init : boolean;
|
||||||
msg : string;
|
msg : string;
|
||||||
|
|
||||||
@ -181,7 +181,6 @@ begin
|
|||||||
|
|
||||||
init := false;
|
init := false;
|
||||||
n := 0;
|
n := 0;
|
||||||
varlabel := TestVarEdit.Text;
|
|
||||||
|
|
||||||
// place values into the data array
|
// place values into the data array
|
||||||
SetLength(data, NoCases+1); // arrays start at 1
|
SetLength(data, NoCases+1); // arrays start at 1
|
||||||
@ -225,8 +224,8 @@ begin
|
|||||||
Cleanup;
|
Cleanup;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
WEdit.Text := Format('%8.4f', [w]);
|
WEdit.Text := Format('%.4f', [w]);
|
||||||
ProbEdit.Text := Format('%8.4f', [pw]);
|
ProbEdit.Text := Format('%.4f', [pw]);
|
||||||
|
|
||||||
// Now do Lilliefors
|
// Now do Lilliefors
|
||||||
// Get unique scores and their frequencies
|
// Get unique scores and their frequencies
|
||||||
@ -280,8 +279,8 @@ begin
|
|||||||
skew := (n * M3) / ((n - 1) * (n - 2) * stddev * variance);
|
skew := (n * M3) / ((n - 1) * (n - 2) * stddev * variance);
|
||||||
kurtosis := (n * (n + 1) * M4) - (3 * M2 * M2 * (n - 1));
|
kurtosis := (n * (n + 1) * M4) - (3 * M2 * M2 * (n - 1));
|
||||||
kurtosis := kurtosis /( (n - 1) * (n - 2) * (n - 3) * (variance * variance) );
|
kurtosis := kurtosis /( (n - 1) * (n - 2) * (n - 3) * (variance * variance) );
|
||||||
SkewEdit.Text := Format('%8.3f', [skew]);
|
SkewEdit.Text := Format('%.3f', [skew]);
|
||||||
KurtosisEdit.Text := Format('%8.3f', [kurtosis]);
|
KurtosisEdit.Text := Format('%.3f', [kurtosis]);
|
||||||
|
|
||||||
// obtain the test statistic
|
// obtain the test statistic
|
||||||
for i := 1 to n1 do
|
for i := 1 to n1 do
|
||||||
@ -313,8 +312,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
DPP := DP[n1];
|
DPP := DP[n1];
|
||||||
D := DPP;
|
D := DPP;
|
||||||
D1 := D;
|
StatEdit.Text := Format('%.3f', [D]);
|
||||||
StatEdit.Text := Format('%8.3f', [D]);
|
|
||||||
A0 := sqrt(n);
|
A0 := sqrt(n);
|
||||||
C1 := A0 - 0.01 + (0.85 / A0);
|
C1 := A0 - 0.01 + (0.85 / A0);
|
||||||
D15 := 0.775 / C1;
|
D15 := 0.775 / C1;
|
||||||
|
@ -103,7 +103,6 @@ end;
|
|||||||
procedure TResistanceLineForm.ComputeBtnClick(Sender: TObject);
|
procedure TResistanceLineForm.ComputeBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
XYPoints : DblDyneMat;
|
XYPoints : DblDyneMat;
|
||||||
XYMedians : DblDyneMat;
|
|
||||||
XMedians : DblDyneVec;
|
XMedians : DblDyneVec;
|
||||||
YMedians : DblDyneVec;
|
YMedians : DblDyneVec;
|
||||||
XVector, YVector : DblDyneVec;
|
XVector, YVector : DblDyneVec;
|
||||||
@ -122,7 +121,6 @@ var
|
|||||||
lReport: TStrings;
|
lReport: TStrings;
|
||||||
begin
|
begin
|
||||||
SetLength(XYPoints, NoCases, NoCases);
|
SetLength(XYPoints, NoCases, NoCases);
|
||||||
SetLength(XYMedians, 3, 3);
|
|
||||||
SetLength(XMedians, 3);
|
SetLength(XMedians, 3);
|
||||||
SetLength(YMedians, 3);
|
SetLength(YMedians, 3);
|
||||||
SetLength(XVector, NoCases);
|
SetLength(XVector, NoCases);
|
||||||
@ -383,7 +381,6 @@ begin
|
|||||||
XVector := nil;
|
XVector := nil;
|
||||||
YMedians := nil;
|
YMedians := nil;
|
||||||
XMedians := nil;
|
XMedians := nil;
|
||||||
XYMedians := nil;
|
|
||||||
XYPoints := nil;
|
XYPoints := nil;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -188,7 +188,6 @@ var
|
|||||||
prob : double; // probability of chi square
|
prob : double; // probability of chi square
|
||||||
SurvT : DblDyneVec;
|
SurvT : DblDyneVec;
|
||||||
Stat : DblDyneVec;
|
Stat : DblDyneVec;
|
||||||
Dupl : DblDyneVec;
|
|
||||||
Alpha : DblDyneVec;
|
Alpha : DblDyneVec;
|
||||||
a : DblDyneVec;
|
a : DblDyneVec;
|
||||||
b : DblDyneVec;
|
b : DblDyneVec;
|
||||||
@ -277,7 +276,6 @@ begin
|
|||||||
|
|
||||||
SetLength(SurvT,nC + 1);
|
SetLength(SurvT,nC + 1);
|
||||||
SetLength(Stat,nC + 1);
|
SetLength(Stat,nC + 1);
|
||||||
SetLength(Dupl,nC + 1);
|
|
||||||
SetLength(Alpha,nC + 1);
|
SetLength(Alpha,nC + 1);
|
||||||
SetLength(x,(nC + 1) * (nR + 1));
|
SetLength(x,(nC + 1) * (nR + 1));
|
||||||
SetLength(b,nC + 1);
|
SetLength(b,nC + 1);
|
||||||
@ -533,7 +531,6 @@ begin
|
|||||||
|
|
||||||
SurvT := nil;
|
SurvT := nil;
|
||||||
Stat := nil;
|
Stat := nil;
|
||||||
Dupl := nil;
|
|
||||||
Alpha := nil;
|
Alpha := nil;
|
||||||
x := nil;
|
x := nil;
|
||||||
b := nil;
|
b := nil;
|
||||||
|
@ -165,7 +165,7 @@ procedure TDiscrimFrm.ComputeBtnClick(Sender: TObject);
|
|||||||
var
|
var
|
||||||
i, j, k, grp, grpvalue, matrow, matcol, noroots, dfchi, n2, k2 : integer;
|
i, j, k, grp, grpvalue, matrow, matcol, noroots, dfchi, n2, k2 : integer;
|
||||||
NoSelected : integer;
|
NoSelected : integer;
|
||||||
outline, GroupLabel, ColHead : string;
|
outline, ColHead: string;
|
||||||
Title : string;
|
Title : string;
|
||||||
GrpVar, NoGrps, nowithin, TotalCases, value, grpno : integer;
|
GrpVar, NoGrps, nowithin, TotalCases, value, grpno : integer;
|
||||||
ColNoSelected : IntDyneVec;
|
ColNoSelected : IntDyneVec;
|
||||||
@ -229,7 +229,6 @@ begin
|
|||||||
if GroupVar.Text = OS3MainFrm.DataGrid.Cells[j,0] then
|
if GroupVar.Text = OS3MainFrm.DataGrid.Cells[j,0] then
|
||||||
begin
|
begin
|
||||||
GrpVar := j;
|
GrpVar := j;
|
||||||
GroupLabel := OS3MainFrm.DataGrid.Cells[j,0];
|
|
||||||
ColNoSelected[NoSelected-1] := j;
|
ColNoSelected[NoSelected-1] := j;
|
||||||
end;
|
end;
|
||||||
end; // next j variable
|
end; // next j variable
|
||||||
|
@ -104,7 +104,7 @@ end;
|
|||||||
|
|
||||||
procedure TMedianPolishForm.ComputeBtnClick(Sender: TObject);
|
procedure TMedianPolishForm.ComputeBtnClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
NoSelected, DepVarCol, F1Col, F2Col, i, j, k : integer;
|
DepVarCol, F1Col, F2Col, i, j, k : integer;
|
||||||
minrow, maxrow, mincol, maxcol : integer;
|
minrow, maxrow, mincol, maxcol : integer;
|
||||||
intvalue, xrange, yrange, row, col, N, count, iteration : integer;
|
intvalue, xrange, yrange, row, col, N, count, iteration : integer;
|
||||||
X, M, sumrowmedians, sumcolmedians, GrandMedian, scale, TotResid : double;
|
X, M, sumrowmedians, sumcolmedians, GrandMedian, scale, TotResid : double;
|
||||||
@ -167,8 +167,7 @@ begin
|
|||||||
if cellstring = Factor1.Text then F1Col := i;
|
if cellstring = Factor1.Text then F1Col := i;
|
||||||
if cellstring = Factor2.Text then F2Col := i;
|
if cellstring = Factor2.Text then F2Col := i;
|
||||||
end;
|
end;
|
||||||
NoSelected := 3;
|
SetLength(ColNoSelected, 3);
|
||||||
SetLength(ColNoSelected,3);
|
|
||||||
ColNoSelected[0] := DepVarCol;
|
ColNoSelected[0] := DepVarCol;
|
||||||
ColNoSelected[1] := F1Col;
|
ColNoSelected[1] := F1Col;
|
||||||
ColNoSelected[2] := F2Col;
|
ColNoSelected[2] := F2Col;
|
||||||
|
@ -23,8 +23,8 @@ function probf(f,df1,df2 : extended) : extended;
|
|||||||
FUNCTION alnorm(x : double; upper : boolean): double;
|
FUNCTION alnorm(x : double; upper : boolean): double;
|
||||||
procedure ppnd7 (p : double; VAR normal_dev : double; VAR ifault : integer);
|
procedure ppnd7 (p : double; VAR normal_dev : double; VAR ifault : integer);
|
||||||
FUNCTION poly(c : Array of double; nord : integer; x : double): double; // RESULT(fn_val)
|
FUNCTION poly(c : Array of double; nord : integer; x : double): double; // RESULT(fn_val)
|
||||||
procedure swilk (var init : boolean; var x : DblDyneVec; n : integer; n1 : integer;
|
procedure swilk (var init : boolean; const x: DblDyneVec; n, n1, n2: integer;
|
||||||
n2 : integer; var a : DblDyneVec; var w : double; var pw : double; var ifault : integer);
|
const a: DblDyneVec; var w, pw: double; out ifault: integer);
|
||||||
procedure SVDinverse(VAR a : DblDyneMat; N : integer);
|
procedure SVDinverse(VAR a : DblDyneMat; N : integer);
|
||||||
function probt(t,df1 : double) : double;
|
function probt(t,df1 : double) : double;
|
||||||
function inverset(Probt, DF : double) : double;
|
function inverset(Probt, DF : double) : double;
|
||||||
@ -824,8 +824,8 @@ begin
|
|||||||
END; // FUNCTION poly
|
END; // FUNCTION poly
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
procedure swilk (var init : boolean; var x : DblDyneVec; n : integer; n1 : integer;
|
procedure swilk (var init: boolean; const x: DblDyneVec; n, n1, n2: integer;
|
||||||
n2 : integer; var a : DblDyneVec; var w : double; var pw : double; var ifault : integer);
|
const a: DblDyneVec; var w, pw: double; out ifault: integer);
|
||||||
|
|
||||||
// ALGORITHM AS R94 APPL. STATIST. (1995) VOL.44, NO.4
|
// ALGORITHM AS R94 APPL. STATIST. (1995) VOL.44, NO.4
|
||||||
// Calculates the Shapiro-Wilk W test and its significance level
|
// Calculates the Shapiro-Wilk W test and its significance level
|
||||||
|
@ -75,24 +75,11 @@ procedure MReg(NoIndep : integer;
|
|||||||
VAR errorcode : boolean;
|
VAR errorcode : boolean;
|
||||||
PrintAll : boolean);
|
PrintAll : boolean);
|
||||||
|
|
||||||
procedure MReg(NoIndep : integer;
|
procedure MReg(NoIndep: integer; const IndepCols: IntDyneVec; DepCol: integer;
|
||||||
{VAR} IndepCols : IntDyneVec;
|
const RowLabels: StrDyneVec;
|
||||||
DepCol : integer;
|
const Means, Variances, StdDevs, BWeights, BetaWeights, BStdErrs, Bttests, tProbs: DblDyneVec;
|
||||||
{VAR} RowLabels : StrDyneVec;
|
out R2, StdErrEst: double; out NCases: integer; out ErrorCode: boolean;
|
||||||
{VAR} Means : DblDyneVec;
|
PrintAll: boolean; AReport: TStrings);
|
||||||
{VAR} Variances : DblDyneVec;
|
|
||||||
{VAR} StdDevs : DblDyneVec;
|
|
||||||
{VAR} BWeights : DblDyneVec;
|
|
||||||
{VAR} BetaWeights : DblDyneVec;
|
|
||||||
{VAR} BStdErrs : DblDyneVec;
|
|
||||||
{VAR} Bttests : DblDyneVec;
|
|
||||||
{VAR} tProbs : DblDyneVec;
|
|
||||||
VAR R2 : double;
|
|
||||||
VAR stderrest : double;
|
|
||||||
VAR NCases : integer;
|
|
||||||
VAR errorcode : boolean;
|
|
||||||
PrintAll : boolean;
|
|
||||||
AReport: TStrings);
|
|
||||||
|
|
||||||
procedure Dynnonsymroots(var a : DblDyneMat; nv : integer;
|
procedure Dynnonsymroots(var a : DblDyneMat; nv : integer;
|
||||||
var nf : integer; c : real;
|
var nf : integer; c : real;
|
||||||
@ -132,7 +119,7 @@ procedure MReg2(NCases : integer;
|
|||||||
VAR BetaWeights : DblDyneVec;
|
VAR BetaWeights : DblDyneVec;
|
||||||
VAR Means : DblDyneVec;
|
VAR Means : DblDyneVec;
|
||||||
VAR Variances : DblDyneVec;
|
VAR Variances : DblDyneVec;
|
||||||
VAR errorcode : integer;
|
out errorcode : integer;
|
||||||
out StdErrEst: double;
|
out StdErrEst: double;
|
||||||
out constant: double;
|
out constant: double;
|
||||||
probout : double;
|
probout : double;
|
||||||
@ -180,8 +167,8 @@ procedure MatPrint(const xmat: DblDyneMat; Rows,Cols: Integer; const Title: Stri
|
|||||||
|
|
||||||
procedure DynVectorPrint(var AVector: DblDyneVec; NoVars: integer;
|
procedure DynVectorPrint(var AVector: DblDyneVec; NoVars: integer;
|
||||||
Title: string; var Labels: StrDyneVec; NCases: integer); overload;
|
Title: string; var Labels: StrDyneVec; NCases: integer); overload;
|
||||||
procedure DynVectorPrint(var AVector: DblDyneVec; NoVars: integer;
|
procedure DynVectorPrint(const AVector: DblDyneVec; NoVars: integer;
|
||||||
Title: string; var Labels: StrDyneVec; NCases: integer; AReport: TStrings); overload;
|
Title: string; const Labels: StrDyneVec; NCases: integer; AReport: TStrings); overload;
|
||||||
|
|
||||||
procedure scatplot(const x, y: DblDyneVec; NoCases: integer;
|
procedure scatplot(const x, y: DblDyneVec; NoCases: integer;
|
||||||
const TitleStr, x_axis, y_axis: string; x_min, x_max, y_min, y_max: double;
|
const TitleStr, x_axis, y_axis: string; x_min, x_max, y_min, y_max: double;
|
||||||
@ -709,24 +696,11 @@ begin
|
|||||||
ErrorCode, PrintAll, OutputFrm.RichEdit.Lines);
|
ErrorCode, PrintAll, OutputFrm.RichEdit.Lines);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure MReg(NoIndep : integer;
|
procedure MReg(NoIndep: integer; const IndepCols: IntDyneVec; DepCol: integer;
|
||||||
{var} IndepCols : IntDyneVec;
|
const RowLabels: StrDyneVec;
|
||||||
DepCol : integer;
|
const Means, Variances, StdDevs, BWeights, BetaWeights, BStdErrs, Bttests, tProbs: DblDyneVec;
|
||||||
{var} RowLabels : StrDyneVec;
|
out R2, StdErrEst: double; out NCases: integer; out ErrorCode: boolean;
|
||||||
{var} Means : DblDyneVec;
|
PrintAll: boolean; AReport: TStrings);
|
||||||
{var} Variances : DblDyneVec;
|
|
||||||
{var} StdDevs : DblDyneVec;
|
|
||||||
{var} BWeights : DblDyneVec;
|
|
||||||
{var} BetaWeights : DblDyneVec;
|
|
||||||
{var} BStdErrs : DblDyneVec;
|
|
||||||
{var} Bttests : DblDyneVec;
|
|
||||||
{var} tProbs : DblDyneVec;
|
|
||||||
var R2 : double;
|
|
||||||
var StdErrEst : double;
|
|
||||||
var NCases : integer;
|
|
||||||
var ErrorCode : boolean;
|
|
||||||
PrintAll : boolean;
|
|
||||||
AReport: TStrings);
|
|
||||||
var
|
var
|
||||||
i, j, N: integer;
|
i, j, N: integer;
|
||||||
X: DblDyneMat;
|
X: DblDyneMat;
|
||||||
@ -754,6 +728,7 @@ begin
|
|||||||
SetLength(ColLabels, NCases);
|
SetLength(ColLabels, NCases);
|
||||||
|
|
||||||
// initialize
|
// initialize
|
||||||
|
errcode := false;
|
||||||
for i := 0 to NCases do
|
for i := 0 to NCases do
|
||||||
begin
|
begin
|
||||||
for j := 0 to NoIndep do X[i, j] := 0;
|
for j := 0 to NoIndep do X[i, j] := 0;
|
||||||
@ -770,7 +745,6 @@ begin
|
|||||||
StdDevs[i] := 0.0;
|
StdDevs[i] := 0.0;
|
||||||
BWeights[i] := 0.0;
|
BWeights[i] := 0.0;
|
||||||
BetaWeights[i] := 0.0;
|
BetaWeights[i] := 0.0;
|
||||||
errcode := false;
|
|
||||||
for j := 0 to NoCases-1 do XT[i, j] := 0.0;
|
for j := 0 to NoCases-1 do XT[i, j] := 0.0;
|
||||||
for j := 0 to NoIndep do XTX[i, j] := 0.0;
|
for j := 0 to NoIndep do XTX[i, j] := 0.0;
|
||||||
end;
|
end;
|
||||||
@ -888,7 +862,7 @@ begin
|
|||||||
// Get standard errors, squared multiple correlation, tests of significance
|
// Get standard errors, squared multiple correlation, tests of significance
|
||||||
SSres := 0.0;
|
SSres := 0.0;
|
||||||
for i := 0 to NoIndep do
|
for i := 0 to NoIndep do
|
||||||
SSres := SSres + (BWeights[i] * XTY[i]);
|
SSres := SSres + BWeights[i] * XTY[i];
|
||||||
SSres := SSY - SSres;
|
SSres := SSY - SSres;
|
||||||
resvar := SSres / (NCases - N);
|
resvar := SSres / (NCases - N);
|
||||||
if resvar > 0.0 then StdErrEst := sqrt(resvar) else StdErrest := 0.0;
|
if resvar > 0.0 then StdErrEst := sqrt(resvar) else StdErrest := 0.0;
|
||||||
@ -1290,7 +1264,7 @@ procedure MReg2(NCases : integer;
|
|||||||
VAR BetaWeights : DblDyneVec;
|
VAR BetaWeights : DblDyneVec;
|
||||||
VAR Means : DblDyneVec;
|
VAR Means : DblDyneVec;
|
||||||
VAR Variances : DblDyneVec;
|
VAR Variances : DblDyneVec;
|
||||||
VAR errorcode : integer;
|
out errorcode : integer;
|
||||||
out StdErrEst: double;
|
out StdErrEst: double;
|
||||||
out constant: double;
|
out constant: double;
|
||||||
probout : double;
|
probout : double;
|
||||||
@ -1900,10 +1874,10 @@ begin
|
|||||||
DynVectorPrint(AVector, NoVars, Title, Labels, NCases, OutputFrm.RichEdit.Lines);
|
DynVectorPrint(AVector, NoVars, Title, Labels, NCases, OutputFrm.RichEdit.Lines);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DynVectorPrint(var AVector: DblDyneVec;
|
procedure DynVectorPrint(const AVector: DblDyneVec;
|
||||||
NoVars: integer;
|
NoVars: integer;
|
||||||
Title: string;
|
Title: string;
|
||||||
var Labels: StrDyneVec;
|
const Labels: StrDyneVec;
|
||||||
NCases: integer;
|
NCases: integer;
|
||||||
AReport: TStrings);
|
AReport: TStrings);
|
||||||
var
|
var
|
||||||
|
Reference in New Issue
Block a user