You've already forked lazarus-ccr
LazStats: Improved output of SuccIntUnit. Include in help.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7446 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,8 @@ object SuccIntFrm: TSuccIntFrm
|
|||||||
Height = 282
|
Height = 282
|
||||||
Top = 391
|
Top = 391
|
||||||
Width = 335
|
Width = 335
|
||||||
|
HelpType = htKeyword
|
||||||
|
HelpKeyword = 'SuccessiveIntervalScaling.htm'
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Successive Interval Scaling'
|
Caption = 'Successive Interval Scaling'
|
||||||
ClientHeight = 282
|
ClientHeight = 282
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
// Test file: sucsintv.laz, use all variables.
|
// Test file: sucsintv.laz, use all variables.
|
||||||
|
|
||||||
|
// TODO: Different output for VAR5 scale value in "Estimates of scale values..."
|
||||||
|
|
||||||
unit SuccIntUnit;
|
unit SuccIntUnit;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@@ -102,6 +104,7 @@ var
|
|||||||
begin
|
begin
|
||||||
for i := 0 to VarList.Items.Count - 1do
|
for i := 0 to VarList.Items.Count - 1do
|
||||||
ItemList.Items.Add(VarList.Items[i]);
|
ItemList.Items.Add(VarList.Items[i]);
|
||||||
|
VarList.Clear;
|
||||||
UpdateBtnStates;
|
UpdateBtnStates;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -149,6 +152,7 @@ begin
|
|||||||
if outline = OS3MainFrm.DataGrid.Cells[j,0] then ColNoSelected[i-1] := j;
|
if outline = OS3MainFrm.DataGrid.Cells[j,0] then ColNoSelected[i-1] := j;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*
|
(*
|
||||||
OutputFrm.RichEdit.Lines.Add('check of parameters');
|
OutputFrm.RichEdit.Lines.Add('check of parameters');
|
||||||
outline := format('No Selected = %3d',[NoSelected]);
|
outline := format('No Selected = %3d',[NoSelected]);
|
||||||
@@ -163,6 +167,7 @@ begin
|
|||||||
OutputFrm.ShowModal;
|
OutputFrm.ShowModal;
|
||||||
OutputFrm.RichEdit.Clear;
|
OutputFrm.RichEdit.Clear;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
//Find largest category value in data
|
//Find largest category value in data
|
||||||
for i := 1 to NoCases do
|
for i := 1 to NoCases do
|
||||||
begin
|
begin
|
||||||
@@ -225,7 +230,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
col := ColNoSelected[j-1];
|
col := ColNoSelected[j-1];
|
||||||
X := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,i])));
|
X := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,i])));
|
||||||
if ((X > 0) and (X <= MaxCat)) then
|
if (X > 0) and (X <= MaxCat) then
|
||||||
FreqMat[j-1, X-1] := FreqMat[j-1, X-1] + 1;
|
FreqMat[j-1, X-1] := FreqMat[j-1, X-1] + 1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -235,10 +240,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
RowTots[i] := 0;
|
RowTots[i] := 0;
|
||||||
for j := 0 to MaxCat-1 do
|
for j := 0 to MaxCat-1 do
|
||||||
begin
|
|
||||||
RowTots[i] := RowTots[i] + FreqMat[i,j];
|
RowTots[i] := RowTots[i] + FreqMat[i,j];
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
// Convert frequencies to proportions of the row totals
|
// Convert frequencies to proportions of the row totals
|
||||||
for i := 0 to NoSelected-1 do
|
for i := 0 to NoSelected-1 do
|
||||||
@@ -252,7 +255,8 @@ begin
|
|||||||
for j := 2 to MaxCat do
|
for j := 2 to MaxCat do
|
||||||
begin
|
begin
|
||||||
CumMat[i-1, j-1] := CumMat[i-1, j-2] + PropMat[i-1, j-1];
|
CumMat[i-1, j-1] := CumMat[i-1, j-2] + PropMat[i-1, j-1];
|
||||||
if (j = MaxCat) then CumMat[i-1,j-1] := 1.0;
|
if (j = MaxCat) then
|
||||||
|
CumMat[i-1, j-1] := 1.0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -286,19 +290,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (C1 > 1) then
|
if (C1 > 1) then
|
||||||
begin
|
begin
|
||||||
DiscDisp[i-1] := d2 - ((d1 * d1) / C1);
|
DiscDisp[i-1] := d2 - (d1 * d1) / C1;
|
||||||
DiscDisp[i-1] := DiscDisp[i-1] / (C1-1.0);
|
DiscDisp[i-1] := DiscDisp[i-1] / (C1-1.0);
|
||||||
DiscDisp[i-1] := sqrt(DiscDisp[i-1]);
|
DiscDisp[i-1] := sqrt(DiscDisp[i-1]);
|
||||||
end
|
end else
|
||||||
else DiscDisp[i-1] := 99.0;
|
DiscDisp[i-1] := 99.0;
|
||||||
if ((DiscDisp[i-1] > 0) and (DiscDisp[i-1] <> 99.0))then t3 := t3 + (1.0 / DiscDisp[i-1]);
|
if (DiscDisp[i-1] > 0) and (DiscDisp[i-1] <> 99.0) then
|
||||||
|
t3 := t3 + 1.0/DiscDisp[i-1];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Constant t3 =No. items / recipricols of std.dev.s of item z scores
|
//Constant t3 =No. items / recipricols of std.dev.s of item z scores
|
||||||
t3 := NoSelected / t3;
|
t3 := NoSelected / t3;
|
||||||
for i := 0 to NoSelected-1 do
|
for i := 0 to NoSelected-1 do
|
||||||
begin
|
begin
|
||||||
if ((DiscDisp[i] > 0.0) and (t3 > 0)) then
|
if (DiscDisp[i] > 0.0) and (t3 > 0) then
|
||||||
DiscDisp[i] := (1.0 / DiscDisp[i]) * t3
|
DiscDisp[i] := (1.0 / DiscDisp[i]) * t3
|
||||||
else
|
else
|
||||||
DiscDisp[i] := 99.0;
|
DiscDisp[i] := 99.0;
|
||||||
@@ -309,7 +314,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
for i := 1 to NoSelected do
|
for i := 1 to NoSelected do
|
||||||
begin
|
begin
|
||||||
if ((Zmatrix[i-1,j-1] <> 99.0) and (Zmatrix[i-1,j-2] <> 99.0)) then
|
if (Zmatrix[i-1, j-1] <> 99.0) and (Zmatrix[i-1, j-2] <> 99.0) then
|
||||||
WidthMat[i-1, j-2] := Zmatrix[i-1, j-1] - Zmatrix[i-1, j-2]
|
WidthMat[i-1, j-2] := Zmatrix[i-1, j-1] - Zmatrix[i-1, j-2]
|
||||||
else
|
else
|
||||||
WidthMat[i-1, j-2] := 99.0;
|
WidthMat[i-1, j-2] := 99.0;
|
||||||
@@ -348,7 +353,7 @@ begin
|
|||||||
count := 1;
|
count := 1;
|
||||||
while (not found) do
|
while (not found) do
|
||||||
begin
|
begin
|
||||||
if (CumMat[i-1,count-1] >= 0.5) then
|
if CumMat[i-1,count-1] >= 0.5 then
|
||||||
begin
|
begin
|
||||||
found := true;
|
found := true;
|
||||||
subscript := count;
|
subscript := count;
|
||||||
@@ -361,7 +366,7 @@ begin
|
|||||||
count := count + 1;
|
count := count + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ((subscript > 2) and (subscript < MaxCat)) then
|
if (subscript > 2) and (subscript < MaxCat) then
|
||||||
begin
|
begin
|
||||||
ScaleValue[i-1] := Mean[subscript-2] * ((0.5 - CumMat[i-1,subscript-2]) / PropMat[i-1,subscript-1]);
|
ScaleValue[i-1] := Mean[subscript-2] * ((0.5 - CumMat[i-1,subscript-2]) / PropMat[i-1,subscript-1]);
|
||||||
if (subscript > 1) then
|
if (subscript > 1) then
|
||||||
@@ -370,11 +375,11 @@ begin
|
|||||||
else
|
else
|
||||||
begin //extreme value - get average of z scores in first cat. and / 2
|
begin //extreme value - get average of z scores in first cat. and / 2
|
||||||
sum := 0.0;
|
sum := 0.0;
|
||||||
for k := 1 to NoSelected do sum := sum + Zmatrix[i-1,0];
|
for k := 1 to NoSelected do
|
||||||
|
sum := sum + Zmatrix[i-1,0];
|
||||||
sum := sum / abs(NoSelected * 2);
|
sum := sum / abs(NoSelected * 2);
|
||||||
ScaleValue[i-1] := sum * ((0.5 - (CumMat[i-1,0] / 2.0)) / (CumMat[i-1,0] / 2.0));
|
ScaleValue[i-1] := sum * ((0.5 - (CumMat[i-1,0] / 2.0)) / (CumMat[i-1,0] / 2.0));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//Calculate Theoretical z scores from the scale values
|
//Calculate Theoretical z scores from the scale values
|
||||||
@@ -419,31 +424,36 @@ begin
|
|||||||
outline := ' ';
|
outline := ' ';
|
||||||
for i := 1 to MaxCat do outline := outline + ColLabels[i-1];
|
for i := 1 to MaxCat do outline := outline + ColLabels[i-1];
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
outline := ' ';
|
||||||
|
for i := 1 to MaxCat do outline := outline + ' ------ ';
|
||||||
|
lReport.Add(outline);
|
||||||
|
|
||||||
for i := 1 to NoSelected do
|
for i := 1 to NoSelected do
|
||||||
begin
|
begin
|
||||||
|
if i > 1 then
|
||||||
|
lReport.Add('');
|
||||||
lReport.Add('%10s', [RowLabels[i-1]]);
|
lReport.Add('%10s', [RowLabels[i-1]]);
|
||||||
|
|
||||||
outline := 'Frequency ';
|
outline := 'Frequency ';
|
||||||
for j := 1 to MaxCat do
|
for j := 1 to MaxCat do
|
||||||
outline := outline + Format('%7d', [FreqMat[i-1,j-1]]);
|
outline := outline + Format('%8d', [FreqMat[i-1,j-1]]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
|
||||||
outline := 'Proportion ';
|
outline := 'Proportion ';
|
||||||
for j := 1 to MaxCat do
|
for j := 1 to MaxCat do
|
||||||
outline := outline + Format('%7.3f', [PropMat[i-1,j-1]]);
|
outline := outline + Format('%8.3f', [PropMat[i-1,j-1]]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
|
||||||
outline := 'Cum. Prop. ';
|
outline := 'Cum. Prop. ';
|
||||||
for j := 1 to MaxCat do
|
for j := 1 to MaxCat do
|
||||||
outline := outline + Format('%7.3f', [CumMat[i-1,j-1]]);
|
outline := outline + Format('%8.3f', [CumMat[i-1,j-1]]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
|
||||||
outline := 'Normal z ';
|
outline := 'Normal z ';
|
||||||
for j := 1 to MaxCat do
|
for j := 1 to MaxCat do
|
||||||
begin
|
begin
|
||||||
if (Zmatrix[i-1,j-1] <> 99.0) then
|
if (Zmatrix[i-1,j-1] <> 99.0) then
|
||||||
outline := outline + Format('%7.3f', [Zmatrix[i-1,j-1]])
|
outline := outline + Format('%8.3f', [Zmatrix[i-1,j-1]])
|
||||||
else
|
else
|
||||||
outline := outline + ' -';
|
outline := outline + ' -';
|
||||||
end;
|
end;
|
||||||
@@ -451,20 +461,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
lReport.Add(DIVIDER_SMALL);
|
||||||
|
lReport.Add('');
|
||||||
|
|
||||||
lReport.Add('INTERVAL WIDTHS');
|
lReport.Add('INTERVAL WIDTHS');
|
||||||
|
lReport.Add('');
|
||||||
outline := ' ';
|
outline := ' ';
|
||||||
for i := 1 to MaxCat - 2 do
|
for i := 1 to MaxCat - 2 do
|
||||||
outline := outline + Format(' %2d-%2d ', [i+1,i]);
|
outline := outline + Format(' %2d-%2d ', [i+1,i]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
outline := ' ';
|
||||||
|
for i := 1 to MaxCat - 2 do
|
||||||
|
outline := outline + ' ------ ';
|
||||||
|
lReport.Add(outline);
|
||||||
|
|
||||||
|
|
||||||
outline := '';
|
outline := '';
|
||||||
for i := 1 to NoSelected do
|
for i := 1 to NoSelected do
|
||||||
begin
|
begin
|
||||||
outline := outline + Format('%10s', [RowLabels[i-1]]);
|
outline := outline + Format('%11s', [RowLabels[i-1]]);
|
||||||
for j := 1 to MaxCat-2 do
|
for j := 1 to MaxCat-2 do
|
||||||
begin
|
begin
|
||||||
if (WidthMat[i-1,j-1] <> 99.0) then
|
if (WidthMat[i-1,j-1] <> 99.0) then
|
||||||
outline := outline + Format('%7.3f', [WidthMat[i-1,j-1]])
|
outline := outline + Format('%8.3f', [WidthMat[i-1,j-1]])
|
||||||
else
|
else
|
||||||
outline := outline + ' -';
|
outline := outline + ' -';
|
||||||
end;
|
end;
|
||||||
@@ -475,61 +494,75 @@ begin
|
|||||||
|
|
||||||
outline := 'Mean Width ';
|
outline := 'Mean Width ';
|
||||||
for i := 1 to MaxCat - 2 do
|
for i := 1 to MaxCat - 2 do
|
||||||
outline := outline + Format('%7.2f', [Mean[i-1]]);
|
outline := outline + Format('%8.2f', [Mean[i-1]]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
|
||||||
outline := 'No. Items ';
|
outline := 'No. Items ';
|
||||||
for i := 1 to MaxCat - 2 do
|
for i := 1 to MaxCat - 2 do
|
||||||
outline := outline + Format('%7d', [CatCount[i-1]]);
|
outline := outline + Format('%8d', [CatCount[i-1]]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
|
||||||
outline := 'Std. Dev.s ';
|
outline := 'Std. Dev.s ';
|
||||||
for i := 1 to MaxCat - 2 do
|
for i := 1 to MaxCat - 2 do
|
||||||
outline := outline + Format('%7.2f', [StdDev[i-1]]);;
|
outline := outline + Format('%8.2f', [StdDev[i-1]]);;
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
|
||||||
outline := 'Cum. Means ';
|
outline := 'Cum. Means ';
|
||||||
for i := 1 to MaxCat - 2 do
|
for i := 1 to MaxCat - 2 do
|
||||||
outline := outline + Format('%7.2f', [CumWidth[i-1]]);
|
outline := outline + Format('%8.2f', [CumWidth[i-1]]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
|
||||||
|
lReport.Add('');
|
||||||
|
lReport.Add(DIVIDER_SMALL);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
lReport.Add('ESTIMATES OF SCALE VALUES AND THEIR DISPERSIONS');
|
lReport.Add('ESTIMATES OF SCALE VALUES AND THEIR DISPERSIONS');
|
||||||
|
lReport.Add('');
|
||||||
lReport.Add(' Item No. Ratings Scale Value Discriminal Dispersion');
|
lReport.Add(' Item No. Ratings Scale Value Discriminal Dispersion');
|
||||||
|
lReport.Add('---------- ----------- ----------- ----------------------');
|
||||||
|
// xxxxxxx xxxx xxxxxxxx xxxxxxxx
|
||||||
for i := 0 to NoSelected-1 do
|
for i := 0 to NoSelected-1 do
|
||||||
lReport.Add('%10s %3d %6.3f %6.3f', [RowLabels[i], RowTots[i], ScaleValue[i], DiscDisp[i]]);
|
lReport.Add('%7s %4d %8.3f %8.3f', [RowLabels[i], RowTots[i], ScaleValue[i], DiscDisp[i]]);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
lReport.Add('Z scores Estimated from Scale values');
|
lReport.Add('Z scores Estimated from Scale values');
|
||||||
|
lReport.Add('');
|
||||||
outline := ' ';
|
outline := ' ';
|
||||||
for i := 0 to MaxCat-1 do outline := outline + ColLabels[i];
|
for i := 0 to MaxCat-1 do outline := outline + ColLabels[i];
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
outline := ' ';
|
||||||
|
for i := 0 to MaxCat-1 do outline := outline + ' ------ ';
|
||||||
|
lReport.Add(outline);
|
||||||
for i := 1 to NoSelected do
|
for i := 1 to NoSelected do
|
||||||
begin
|
begin
|
||||||
outline := Format('%10s', [RowLabels[i-1]]);
|
outline := Format('%10s', [RowLabels[i-1]]);
|
||||||
for j := 1 to MaxCat - 1 do
|
for j := 1 to MaxCat - 1 do
|
||||||
outline := outline + Format('%7.3f', [TheorZMat[i-1,j-1]]);
|
outline := outline + Format('%8.3f', [TheorZMat[i-1,j-1]]);
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
lReport.Add('');
|
||||||
|
lReport.Add(DIVIDER_SMALL);
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
lReport.Add('Cumulative Theoretical Proportions');
|
lReport.Add('Cumulative Theoretical Proportions');
|
||||||
|
lReport.Add('');
|
||||||
outline := ' ';
|
outline := ' ';
|
||||||
for i := 1 to MaxCat do outline := outline + ColLabels[i-1];
|
for i := 1 to MaxCat do outline := outline + ColLabels[i-1];
|
||||||
lReport.Add(outline);
|
lReport.Add(outline);
|
||||||
|
outline := ' ';
|
||||||
|
for i := 1 to MaxCat do outline := outline + ' ------ ';
|
||||||
|
lReport.Add(outline);
|
||||||
for i := 1 to NoSelected do
|
for i := 1 to NoSelected do
|
||||||
begin
|
begin
|
||||||
outline := Format('%10s', [RowLabels[i-1]]);
|
outline := Format('%10s', [RowLabels[i-1]]);
|
||||||
for j := 1 to MaxCat do
|
for j := 1 to MaxCat do
|
||||||
outline := outline + Format('%7.3f', [ThCumPMat[i-1,j-1]]);
|
outline := outline + Format('%8.3f', [ThCumPMat[i-1,j-1]]);
|
||||||
OutputFrm.RichEdit.Lines.Add(outline);
|
lReport.Add(outline);
|
||||||
end;
|
end;
|
||||||
lReport.Add('');
|
lReport.Add('');
|
||||||
|
|
||||||
outline := 'Average Discrepancy Between Theoretical and Observed Cumulative Proportions: ';
|
lReport.Add('Average Discrepancy Between Theoretical and Observed Cumulative Proportions: %.3f', [discrep]);
|
||||||
outline := outline + Format('%.3f', [discrep]);
|
|
||||||
lReport.Add(outline);
|
|
||||||
|
|
||||||
lReport.Add('Maximum discrepancy %.3f found in item %s', [maxdiscrep, RowLabels[discrow-1]]);
|
lReport.Add('Maximum discrepancy %.3f found in item %s', [maxdiscrep, RowLabels[discrow-1]]);
|
||||||
|
|
||||||
Screen.Cursor := Save_Cursor;
|
Screen.Cursor := Save_Cursor;
|
||||||
|
Reference in New Issue
Block a user