diff --git a/applications/lazstats/source_orig/DATAUNIT.PAS b/applications/lazstats/source_orig/DATAUNIT.PAS new file mode 100644 index 000000000..d000b5aa3 --- /dev/null +++ b/applications/lazstats/source_orig/DATAUNIT.PAS @@ -0,0 +1,71 @@ +unit DataUnit; + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, ExtCtrls, Grids, OutPutUnit, Globals; + +procedure GetFileData(VAR FName : string); +procedure Allocations; +procedure DeAllocations; + +implementation + +uses LinPro; + +procedure GetFileData(VAR FName : string); + +var + F : TextFile; + i, j : integer; + +begin + LinProFrm.OpenDialog1.DefaultExt := 'LPR'; + LinProFrm.OpenDialog1.Filter := 'Linear Programming File (*.LPR)|*.LPR|All Files (*.*)|*.*'; + LinProFrm.OpenDialog1.FilterIndex := 1; + if LinProFrm.OpenDialog1.Execute then + begin + FName := LinProFrm.OpenDialog1.FileName; + AssignFile(F,FName); + Reset(F); + readln(F,LinProFrm.NoVars); + readln(F,LinProFrm.NoMax); + readln(F,LinProFrm.NoMin); + readln(F,LinProFrm.NoEql); + readln(F,LinProFrm.MinMax); + LinProFrm.NoCoefs := LinProFrm.NoMax + LinProFrm.NoMin + LinProFrm.NoEql; + Alloc; + for i := 1 to LinProFrm.NoVars do readln(F,LinProFrm.Objective[i]); + for i := 1 to LinProFrm.NoMax do readln(F,LinProFrm.MaxConstraints[i]); + for i := 1 to LinProFrm.NoMin do readln(F,LinProFrm.MinConstraints[i]); + for i := 1 to LinProFrm.NoEql do readln(F,LinProFrm.EqlConstraints[i]); + for i := 1 to LinProFrm.NoCoefs do + for j := 1 to LinProFrm.NoVars do readln(F,LinProFrm.Coefficients[i,j]); + CloseFile(F); + end; +end; +//------------------------------------------------------------------- + +procedure Allocations; +begin + SetLength(LinProFrm.Objective,LinProFrm.NoVars + 1); + SetLength(LinProFrm.MaxConstraints,LinProFrm.NoMax + 1); + SetLength(LinProFrm.MinConstraints,LinProFrm.NoMin + 1); + SetLength(LinProFrm.EqlConstraints,LinProFrm.NoEql+1); + SetLength(LinProFrm.Coefficients,LinProFrm.NoCoefs+1,LinProFrm.NoVars+1); +end; +//------------------------------------------------------------------- + +procedure DeAllocations; +begin + // cleanup + LinProFrm.Coefficients := nil; + LinProFrm.EqlConstraints := nil; + LinProFrm.MinConstraints := nil; + LinProFrm.MaxConstraints := nil; + LinProFrm.Objective := nil; +end; +//------------------------------------------------------------------- + +end. diff --git a/applications/lazstats/source_orig/DIF.PAS b/applications/lazstats/source_orig/DIF.PAS new file mode 100644 index 000000000..8d7001632 --- /dev/null +++ b/applications/lazstats/source_orig/DIF.PAS @@ -0,0 +1,1008 @@ +unit DIF; + +{$MODE Delphi} + +interface + +uses + LCLIntf, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, Buttons, OS3MainUnit, GLOBALS, Math, OUTPUTUNIT, MATRIXLIB, + DATAPROCS, FUNCTIONSLIB, GRAPHLib, LResources; + +type DynamicCharArray = array of char; + +type + TDIFfrm = class(TForm) + Memo1: TMemo; + Label1: TLabel; + VarList: TListBox; + ItemInBtn: TBitBtn; + ItemOutBtn: TBitBtn; + AllBtn: TBitBtn; + GrpInBtn: TBitBtn; + GrpOutBtn: TBitBtn; + Label2: TLabel; + Label3: TLabel; + GroupVarEdit: TEdit; + ItemsList: TListBox; + Label4: TLabel; + Label5: TLabel; + RefGrpEdit: TEdit; + TrgtGrpEdit: TEdit; + ResetBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + GroupBox1: TGroupBox; + ItemStatsChk: TCheckBox; + TestStatsChk: TCheckBox; + ItemCorrsChk: TCheckBox; + ItemTestChk: TCheckBox; + AlphaChk: TCheckBox; + LogisticChk: TCheckBox; + MHChk: TCheckBox; + Label6: TLabel; + LevelsEdit: TEdit; + Label7: TLabel; + LevelNoEdit: TEdit; + Label8: TLabel; + Label9: TLabel; + LowBoundEdit: TEdit; + UpBoundEdit: TEdit; + LevelScroll: TScrollBar; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + CurvesChk: TCheckBox; + CountsChk: TCheckBox; + procedure ResetBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ReturnBtnClick(Sender: TObject); + procedure ComputeBtnClick(Sender: TObject); + procedure ItemInBtnClick(Sender: TObject); + procedure ItemOutBtnClick(Sender: TObject); + procedure AllBtnClick(Sender: TObject); + procedure GrpInBtnClick(Sender: TObject); + procedure LowBoundEditExit(Sender: TObject); + procedure UpBoundEditExit(Sender: TObject); + procedure LevelsEditExit(Sender: TObject); + procedure LevelScrollScroll(Sender: TObject; ScrollCode: TScrollCode; + var ScrollPos: Integer); + private + { Private declarations } + NoItems : integer; + nolevels : integer; + tmean, tvar, tsd : double; + ColNoSelected : IntDyneVec; + ColLabels, RowLabels : StrDyneVec; + Means, Variances, StdDevs : DblDyneVec; + CorMat : DblDyneMat; // correlations among items and total score + Data : IntDyneMat; //store item scores and total score + Ubounds : IntDyneVec; // upper and lower bounds of score groups + Lbounds : IntdyneVec; + Code : DynamicCharArray; // blank, A, B or C ETS codes + Level10OK : IntdyneMat; // check that each item category >= 10 + RMHRight : IntDyneMat; // no. right for items by score group in reference group + RMHWrong : IntDyneMat; // no. wrong for items by score group in reference group + FMHRight : IntDyneMat; // no. right for items by score group in focus group + FMHWrong : IntDyneMat; // no. wrong for items by score group in focus group + RScrGrpCnt : IntDyneMat; // total responses for score groups in reference group + FScrGrpCnt : IntDyneMat; // total responses for score groups in focus group + NT : IntDyneMat; // total right and wrong in each category of each item + Alpha : DblDyneVec; + AlphaNum : DblDyneVec; + AlphaDen : DblDyneVec; + MHDiff : DblDyneVec; + ExpA : DblDyneMat; + VarA : DblDyneMat; + SumA : DblDyneVec; + SumExpA : DblDyneVec; + SumVarA : DblDyneVec; + ChiSqr : DblDyneVec; + Prob : DblDyneVec; + SEMHDDif : DblDyneVec; + Aster : StrDyneVec; + C : DblDyneVec; + CodeRF : DynamicCharArray; + Tot : IntDyneVec; + procedure AlphaRel(Sender: TObject); + procedure ItemCorrs(Sender: TObject); + procedure ItemTestCorrs(Sender: TObject); + procedure ItemCurves(Sender: TObject); + +public + { Public declarations } + end; + +var + DIFfrm: TDIFfrm; + +implementation + + +procedure TDIFfrm.ResetBtnClick(Sender: TObject); +var i : integer; +begin + VarList.Clear; + ItemsList.Clear; + GroupVarEdit.Text := ''; + ItemInBtn.Visible := true; + ItemOutBtn.Visible := false; + AllBtn.Visible := true; + GrpInBtn.Visible := true; + GrpOutBtn.Visible := false; + ItemStatsChk.Checked := true; + TestStatsChk.Checked := false; + ItemCorrsChk.Checked := false; + ItemTestChk.Checked := false; + MHChk.Checked := true; + LogisticChk.Checked := false; + RefGrpEdit.Text := ''; + TrgtGrpEdit.Text := ''; + for i := 1 to NoVariables do + VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + if NoVariables > 0 then LevelScroll.Max := NoVariables; + LevelNoEdit.Text := '1'; + LowBoundEdit.Text := '0'; + UpBoundEdit.Text := '2'; + //allocate space on heap + SetLength(ColLabels,NoVariables+1); + SetLength(RowLabels,NoVariables+1); + SetLength(Means,NoVariables); + SetLength(Variances,NoVariables); + SetLength(StdDevs,NoVariables); + SetLength(CorMat,NoVariables,NoVariables); + SetLength(Data,NoCases,NoVariables+3); //group, items, total, flag + SetLength(Lbounds,NoVariables); + SetLength(Ubounds,NoVariables); + SetLength(Tot,NoCases); + SetLength(ColNoSelected,NoVariables); +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.FormShow(Sender: TObject); +begin + ResetBtnClick(Self); +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.ReturnBtnClick(Sender: TObject); +begin + ColNoSelected := nil; + C := nil; + SEMHDDif := nil; + Aster := nil; + Prob := nil; + ChiSqr := nil; + SumVarA := nil; + SumExpA := nil; + SumA := nil; + VarA := nil; + ExpA := nil; + CodeRF := nil; + MHDiff := nil; + AlphaDen := nil; + AlphaNum := nil; + Alpha := nil; + NT := nil; + Level10OK := nil; + Code := nil; + FScrGrpCnt := nil; + RScrGrpCnt := nil; + FMHWrong := nil; + FMHRight := nil; + RMHWrong := nil; + RMHRight := nil; + Tot := nil; + Ubounds := nil; + Lbounds := nil; + Data := nil; + CorMat := nil; + StdDevs := nil; + Variances := nil; + Means := nil; + RowLabels := nil; + ColLabels := nil; + DIFfrm.Hide; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.ComputeBtnClick(Sender: TObject); +Label LoopStart; +var + i, j, k : integer; + itm : integer; + grpvar : integer; + subjgrp : integer; + value : integer; + subjscore : integer; + scrgrpsize : integer; + lower, upper : integer; + sum : integer; + cellstring : string; + title : string; + nsize : array [1..2] of integer; + Rtm, Wtm : double; + TotPurge : integer; + LoopIt : integer; + RItem, FItem : integer; +begin + LoopIt := 0; + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add('Mantel-Haenszel DIF Analysis adapted by Bill Miller from'); + OutPutFrm.RichEdit.Lines.Add('EZDIF written by Niels G. Waller'); + OutPutFrm.RichEdit.Lines.Add(''); + + NoItems := ItemsList.Items.Count; + for k := 1 to 2 do nsize[k] := 0; + + // get items to analyze and their labels + for i := 1 to NoItems do // items to analyze + begin + for j := 1 to NoVariables do // variables in grid + begin + cellstring := OS3MainFrm.DataGrid.Cells[j,0]; + if cellstring = ItemsList.Items.Strings[i-1] then + begin // matched - save info + ColNoSelected[i-1] := j; + ColLabels[i-1] := cellstring; + RowLabels[i-1] := cellstring; + end; // end match + end; // next j + end; // next i + ColLabels[NoItems] := 'TOTAL'; + RowLabels[NoItems] := 'TOTAL'; + + // get the variable number of the grouping code + grpvar := 0; + for i := 1 to NoVariables do + begin + cellstring := OS3MainFrm.DataGrid.Cells[i,0]; + if cellstring = GroupVarEdit.Text then grpvar := i; + end; + if grpvar = 0 then + begin + ShowMessage('Error - No group variable found.'); + exit; + end; + + // get number of test score levels + nolevels := StrToInt(LevelsEdit.Text); + + // read data (score group and items) + for i := 1 to NoCases do + begin + subjscore := 0; + value := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[grpvar,i]))); + subjgrp := 0; + if value = StrToInt(RefGrpEdit.Text) then subjgrp := 1; // reference grp + if value = StrToInt(TrgtGrpEdit.Text) then subjgrp := 2; // target group + if subjgrp = 0 then + begin + ShowMessage('Error - Bad group code for a subject.'); + exit; + end; + Data[i-1,0] := subjgrp; + nsize[subjgrp] := nsize[subjgrp] + 1; + for j := 1 to NoItems do + begin + itm := ColNoSelected[j-1]; + value := Round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[itm,i]))); + if value = 1 then subjscore := subjscore + 1; + Data[i-1,j] := value; + end; + Tot[i-1] := subjscore; + end; + + // obtain item means, variances, standard deviations for total subjects + for i := 0 to NoItems-1 do + begin + Means[i] := 0.0; + Variances[i] := 0.0; + StdDevs[i] := 0.0; + for j := 0 to NoCases - 1 do + begin + Means[i] := Means[i] + Data[j,i+1]; + Variances[i] := Variances[i] + (Data[j,i+1] * Data[j,i+1]); + end; + Variances[i] := (Variances[i] - (Means[i] * Means[i] / NoCases)) / (NoCases - 1); + if Variances[i] <= 0 then + begin + cellstring := format('Item %d has zero variance. Unselect the item.', + [i+1]); + ShowMessage(cellstring); + ResetBtnClick(Self); + exit; + end; + StdDevs[i] := sqrt(Variances[i]); + Means[i] := Means[i] / NoCases; + end; + + // obtain total score mean, variance and stddev + tmean := 0.0; + tvar := 0.0; + tsd := 0.0; + for i := 0 to NoCases - 1 do + begin + tmean := tmean + Tot[i]; + tvar := tvar + (Tot[i] * Tot[i]); + end; + tvar := (tvar - (tmean * tmean / NoCases)) / (NoCases - 1); + tsd := sqrt(tvar); + tmean := tmean / NoCases; + + // print descriptives if checked + if ItemStatsChk.Checked then + begin + title := 'Total Means'; + DynVectorPrint(Means,NoItems,title,ColLabels,NoCases); + title := 'Total Variances'; + DynVectorPrint(Variances,NoItems,title,ColLabels,NoCases); + title := 'Total Standard Deviations'; + DynVectorPrint(StdDevs,NoItems,title,ColLabels,NoCases); + end; + + // Show total test score statistics if checked + if TestStatsChk.Checked then + begin + cellstring := format('Total Score: Mean = %10.3f, Variance = %10.3f, Std.Dev. = %10.3f', + [tmean, tvar, tsd]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + cellstring := format('Reference group size = %d, Focus group size = %d', + [nsize[1],nsize[2]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + + // get Cronbach alpha for total group if checked + if AlphaChk.Checked then AlphaRel(Self); + + // Get item intercorrelations for total group if checked + if ItemCorrsChk.Checked then + begin + ItemCorrs(Self); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + + // Get item-total score correlations for total group if checked + if ItemTestChk.Checked then + begin + ItemTestCorrs(Self); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + + // Show upper and lower bounds for score group bins + OutPutFrm.RichEdit.Lines.Add('Conditioning Levels'); + OutPutFrm.RichEdit.Lines.Add('Lower Upper'); + for i := 0 to nolevels-1 do + begin + cellstring := format('%5d %5d',[Lbounds[i],Ubounds[i]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + + // check for zero variance in each group + for k := 1 to 2 do // group + begin + for i := 0 to NoItems-1 do // item + begin + sum := 0; + for j := 0 to NoCases-1 do // subject + begin + if Data[j,0] = k then // group match ? + begin + sum := sum + Data[j,i+1]; + end; + end; + end; + if ((sum = 0) or (sum = NoVariables)) then + begin + cellstring := format('Item %d in group %d has zero variance.', + [i+1,k]); + ShowMessage(cellstring); + exit; + end; + end; + + // Get count of no. right and wrong for each item in each group + SetLength(RMHRight,nolevels,NoItems); + SetLength(RMHWrong,nolevels,NoItems); + SetLength(FMHRight,nolevels,NoItems); + SetLength(FMHWrong,nolevels,NoItems); + SetLength(RScrGrpCnt,nolevels,NoItems); + SetLength(FScrGrpCnt,nolevels,NoItems); + SetLength(Code,NoItems); + SetLength(Level10OK,nolevels,NoItems); + SetLength(NT,nolevels,NoItems); + SetLength(Alpha,NoItems); + SetLength(AlphaNum,NoItems); + SetLength(AlphaDen,NoItems); + SetLength(MHDiff,NoItems); + SetLength(CodeRF,NoItems); + SetLength(ExpA,nolevels,NoItems); + SetLength(VarA,nolevels,NoItems); + SetLength(SumA,NoItems); + SetLength(SumExpA,NoItems); + SetLength(SumVarA,NoItems); + SetLength(ChiSqr,NoItems); + SetLength(Prob,NoItems); + SetLength(Aster,NoItems); + SetLength(SEMHDDif,NoItems); + SetLength(C,NoItems); + +LoopStart: + // clear arrays + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + RMHRight[k,j] := 0; + RMHWrong[k,j] := 0; + RScrGrpCnt[k,j] := 0; + FMHRight[k,j] := 0; + FMHWrong[k,j] := 0; + FScrGrpCnt[k,j] := 0; + Level10OK[k,j] := 1; + NT[k,j] := 0; + ExpA[k,j] := 0.0; + VarA[k,j] := 0.0; + end; + Alpha[j] := 0.0; + AlphaNum[j] := 0.0; + AlphaDen[j] := 0.0; + MHDiff[j] := 0.0; + CodeRF[j] := ' '; + Prob[j] := 0.0; + end; + + LoopIt := LoopIt + 1; + OutPutFrm.RichEdit.Clear; + cellstring := format('COMPUTING M-H CHI-SQUARE, PASS # %d',[LoopIt]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + for k := 0 to nolevels-1 do + begin + for i := 0 to NoCases-1 do + begin + subjgrp := Data[i,0]; + for j := 0 to NoItems-1 do + begin + RItem := 0; + value := Data[i,j+1]; + if ((LoopIt = 2) and (Code[j] = 'C')) then RItem := value; + if value = 1 then + begin + if ((Tot[i]+RItem >= Lbounds[k]) and + (Tot[i]+RItem <= Ubounds[k])) then + begin + if subjgrp = 1 then + begin + RMHRight[k,j] := RMHRight[k,j] + 1; + RScrGrpCnt[k,j] := RScrGrpCnt[k,j] + 1; + end; // if reference group + if subjgrp = 2 then + begin + FMHRight[k,j] := FMHRight[k,j] + 1; + FScrGrpCnt[k,j] := FScrGrpCnt[k,j] + 1; + end; // if focus group + end; // end if () and () + end; // value = 1 + if value = 0 then + begin + if ((Tot[i]+RItem >= Lbounds[k]) and + (Tot[i]+RItem <= Ubounds[k])) then + begin + if subjgrp = 1 then + begin + RMHWrong[k,j] := RMHWrong[k,j] + 1; + RScrGrpCnt[k,j] := RScrGrpCnt[k,j] + 1; + end; + if subjgrp = 2 then + begin + FMHWrong[k,j] := FMHWrong[k,j] + 1; + FScrGrpCnt[k,j] := FScrGrpCnt[k,j] + 1; + end; + end; + end; // if value = 0 + end; // next j + end; // next i + end; // next k + for j := 0 to NoItems-1 do Code[j] := 'Z'; // clean out ETS code + + // print score group counts for Reference and focus subjects + if CountsChk.Checked then + begin + for i := 0 to nolevels-1 do + RowLabels[i] := format('%3d-%3d',[Lbounds[i],Ubounds[i]]); + DynIntMatPrint(RScrGrpCnt,nolevels,NoItems,'Score Level Counts by Item',RowLabels,ColLabels, + 'Cases in Reference Group'); + DynIntMatPrint(FScrGrpCnt,nolevels,NoItems,'Score Level Counts by Item',RowLabels,ColLabels, + 'Cases in Focus Group'); + end; + + // Plot Item curves if checked + if ((CurvesChk.Checked) and (LoopIt = 1)) then ItemCurves(Self); + + // check for minimum of 10 per category in each item + // compute NT + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + if ((RScrGrpCnt[k,j] < 10) or (FScrGrpCnt[k,j] < 10)) then + Level10OK[k,j] := 0 // insufficient n + else Level10OK[k,j] := 1; // 10 or more - OK + NT[k,j] := RScrGrpCnt[k,j] + FScrGrpCnt[k,j]; + end; + end; + + for k := 0 to nolevels-1 do + begin + if Level10OK[k,0] = 0 then + begin + cellstring := format('Insufficient data found in level: %d - %d', + [Lbounds[k],Ubounds[k]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + end; + + // compute alpha + for j := 0 to NoItems - 1 do + begin + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + AlphaNum[j] := AlphaNum[j] + (RMHRight[k,j] * FMHWrong[k,j]) / NT[k,j]; + AlphaDen[j] := AlphaDen[j] + (RMHWrong[k,j] * FMHRight[k,j]) / NT[k,j]; + end; + end; + end; + + for j := 0 to NoItems-1 do + begin + if AlphaDen[j] = 0.0 then + begin + cellstring := format('Window too small at item %d level %d', + [j+1,k+1]); + ShowMessage(cellstring); + exit; + end + else begin + Alpha[j] := AlphaNum[j] / AlphaDen[j]; + MHDiff[j] := -2.35 * ln(Alpha[j]); + end; + end; + + // compute expected values + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + ExpA[k,j] := (RScrGrpCnt[k,j] * (RMHRight[k,j] + FMHRight[k,j] )) / + NT[k,j]; + end; + end; + end; + + // compute variances + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + Rtm := RMHRight[k,j] + FMHRight[k,j]; + Wtm := RMHWrong[k,j] + FMHWrong[k,j]; + VarA[k,j] := (RScrGrpCnt[k,j] * FScrGrpCnt[k,j] * Rtm * Wtm) / + ( NT[k,j] * NT[k,j] * (NT[k,j]-1) ); + end; + end; + end; + + // compute chi-squares + for j := 0 to NoItems-1 do + begin + SumA[j] := 0.0; + SumExpA[j] := 0.0; + SumVarA[j] := 0.0; + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + SumA[j] := SumA[j] + RMHRight[k,j]; + SumExpA[j] := SumExpA[j] + ExpA[k,j]; + SumVarA[j] := SumVarA[j] + VarA[k,j]; + end; + end; + end; + + for j := 0 to NoItems-1 do + begin + ChiSqr[j] := (sqr((Abs(SumA[j] - SumExpA[j]) - 0.5))) / SumVarA[j]; + Prob[j] := 1.0 - chisquaredprob(ChiSqr[j],1); + if Prob[j] > 0.05 then Aster[j] := ''; + if Prob[j] <= 0.05 then Aster[j] := '*'; + if Prob[j] <= 0.01 then Aster[j] := '**'; + if Prob[j] <= 0.005 then Aster[j] := '***'; + end; + + // compute std. errors + for j := 0 to NoItems-1 do + begin + C[j] := 0.0; + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + C[j] := C[j] + ((RMHRight[k,j] * FMHWrong[k,j]) / NT[k,j]); + end; + end; + + for j := 0 to NoItems - 1 do + begin + SEMHDDif[j] := 0.0; + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + SEMHDDif[j] := SEMHDDif[j] + ( (RMHRight[k,j] * FMHWrong[k,j] ) + + ( Alpha[j] * RMHWrong[k,j] * FMHRight[k,j])) * + ( RMHRight[k,j] + FMHWrong[k,j] + Alpha[j] * + ( RMHWrong[k,j] + FMHRight[k,j] )) / ( 2.0 * NT[k,j] * NT[k,j]); + end; + end; + end; + + for j := 0 to NoItems-1 do + SEMHDDif[j] := (2.35 / C[j]) * sqrt(SEMHDDif[j]); + + // code results with ETS codes + for j := 0 to NoItems-1 do + begin + if ( (abs(MHDiff[j]) > 1.5) and ((abs(MHDiff[j]) - (1.96 * SEMHDDif[j]) + > 1.0))) then Code[j] := 'C'; + if ((abs(MHDiff[j]) - (1.96 * SEMHDDif[j]) <= 0.0) or + (abs(MHDiff[j]) <= 1.0)) then code[j] := 'A'; + if ((code[j] <> 'A') and (code[j] <> 'C')) then code[j] := 'B'; + end; + + // purge + TotPurge := 0; + for j := 0 to NoItems-1 do + begin + if (code[j] = 'C') then + begin + TotPurge := TotPurge + 1; + for i := 0 to NoCases - 1 do Tot[i] := Tot[i] - Data[i,j+1]; + if Alpha[j] > 1.0 then CodeRF[j] := 'R'; + if Alpha[j] < 1.0 then CodeRF[j] := 'F'; + end; + end; + + // show results +// OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add( + 'CODES ITEM SIG. ALPHA CHI2 P-VALUE MH D-DIF S.E. MH D-DIF'); + for j := 0 to noitems-1 do + begin + cellstring := format('%1s %1s %4d %3s %6.3f %7.3f %6.3f %6.3f %6.3f', + [code[j],CodeRF[j], j+1, Aster[j],Alpha[j],ChiSqr[j],Prob[j],MHDiff[j], + SEMHDDif[j]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + OutPutFrm.RichEdit.Lines.Add(''); + if LoopIt = 1 then + begin + cellstring := format('No. of items purged in pass 1 = %d',[TotPurge]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + OutPutFrm.RichEdit.Lines.Add('Item Numbers:'); + for j := 0 to NoItems-1 do + begin + if Code[j] = 'C' then + begin + cellstring := format('%d',[j+1]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + end; + end; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + if LoopIt < 2 then goto LoopStart; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.ItemInBtnClick(Sender: TObject); +var + index, i : integer; + +begin + if VarList.ItemIndex < 0 then + begin + ItemInBtn.Visible := false; + exit; + end; + index := VarList.Items.Count; + i := 0; + while i < index do + begin + if (VarList.Selected[i]) then + begin + ItemsList.Items.Add(VarList.Items.Strings[i]); + VarList.Items.Delete(i); + index := index - 1; + i := 0; + end + else i := i + 1; + end; + ItemOutBtn.Visible := true; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.ItemOutBtnClick(Sender: TObject); +var + index: integer; + +begin + index := ItemsList.ItemIndex; + if index < 0 then + begin + ItemOutBtn.Visible := false; + exit; + end; + VarList.Items.Add(ItemsList.Items.Strings[index]); + ItemsList.Items.Delete(index); + ItemInBtn.Visible := true; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.AllBtnClick(Sender: TObject); +var + i : integer; +begin + if VarList.Items.Count < 1 then exit; + for i := 0 to VarList.Items.Count - 1 do + ItemsList.Items.Add(VarList.Items.Strings[i]); + VarList.Clear; + ItemInBtn.Visible := false; + ItemOutBtn.Visible := true; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.GrpInBtnClick(Sender: TObject); +var index : integer; +begin + if VarList.ItemIndex < 0 then + begin + GrpInBtn.Visible := false; + exit; + end; + index := VarList.ItemIndex; + GroupVarEdit.Text := VarList.Items.Strings[index]; + VarList.Items.Delete(index); + GrpInBtn.Visible := false; + GrpOutBtn.Visible := true; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.LowBoundEditExit(Sender: TObject); +var i : integer; +begin + i := StrToInt(LevelNoEdit.Text); + Lbounds[i-1] := StrToInt(LowBoundEdit.Text); + UpBoundEdit.SetFocus; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.UpBoundEditExit(Sender: TObject); +var i : integer; +begin + i := StrToInt(LevelNoEdit.Text); + Ubounds[i-1] := StrToInt(UpBoundEdit.Text); + if i = StrToInt(LevelsEdit.Text) then + begin + ComputeBtn.SetFocus; + exit; + end; + LowBoundEdit.Text := IntToStr(Ubounds[i-1] + 1); + LowBoundEdit.SetFocus; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.LevelsEditExit(Sender: TObject); +begin + LevelScroll.Max := StrToInt(LevelsEdit.Text); + LowBoundEdit.SetFocus; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.LevelScrollScroll(Sender: TObject; + ScrollCode: TScrollCode; var ScrollPos: Integer); +var + scrlpos : integer; + level : integer; +begin + level := StrToInt(LevelNoEdit.Text); + scrlpos := LevelScroll.Position; + if ((scrlpos > level) and (level <= StrToInt(LevelsEdit.Text))) then + begin + LevelNoEdit.Text := IntToStr(scrlpos); + LowBoundEdit.SetFocus; + exit; + end; + if scrlpos < level then + begin + level := scrlpos; + if level > 0 then + begin + LevelNoEdit.Text := IntToStr(level); + LowBoundEdit.Text := IntToStr(Lbounds[level-1]); + UpBoundEdit.Text := IntToStr(Ubounds[level-1]); + end; + LowBoundEdit.SetFocus; + end; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.AlphaRel(Sender: TObject); +var + i : integer; + AlphaRel, SEMeas : double; + outline : string; + +begin + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add(''); + AlphaRel := 0.0; + + for i := 0 to NoItems-1 do + AlphaRel := AlphaRel + variances[i]; // sum of item variances + AlphaRel := AlphaRel / tvar; + AlphaRel := 1.0 - AlphaRel; + AlphaRel := (NoItems / (NoItems - 1.0)) * AlphaRel; + SEMeas := tsd * sqrt(1.0 - AlphaRel); + outline := format('Alpha Reliability Estimate for Test = %6.4f S.E. of Measurement = %8.3f', + [AlphaRel,SEMeas]); + OutPutFrm.RichEdit.Lines.Add(outline); +// OutPutFrm.ShowModal; +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.ItemCorrs(Sender: TObject); +var + i, j, k : integer; + title : string; +begin + // cross-products + for i := 0 to NoItems-1 do + for j := 0 to NoItems-1 do + for k := 0 to NoCases-1 do + CorMat[i,j] := CorMat[i,j] + (Data[k,i+1] * Data[k,j+1]); + // covariances + for i := 0 to NoItems-1 do + for j := 0 to NoItems-1 do + CorMat[i,j] := (CorMat[i,j] - (NoCases * Means[i] * Means[j])) / + (NoCases-1); + + // correlations + for i := 0 to NoItems-1 do + for j := 0 to NoItems-1 do + CorMat[i,j] := CorMat[i,j] / (StdDevs[i] * StdDevs[j]); + + // show results + OutPutFrm.RichEdit.Clear; + title := 'Correlations Among Items'; + MAT_PRINT(CorMat,NoItems,NoItems,title,RowLabels,ColLabels,NoCases); +end; +//------------------------------------------------------------------- + +procedure TDIFfrm.ItemTestCorrs(Sender: TObject); +var + i, j : integer; + Cors : DblDyneVec; + title : string; +begin + SetLength(Cors,NoItems); + // cross-products + for i := 0 to NoItems-1 do + for j := 0 to NoCases-1 do + Cors[i] := Cors[i] + (Data[j,i+1] * Tot[j]); + // covariances + for i := 0 to NoItems-1 do + Cors[i] := (Cors[i] - (NoCases * Means[i] * tmean)) / (NoCases-1); + // correlations + for i := 0 to NoItems-1 do + Cors[i] := Cors[i] / (StdDevs[i] * tsd); + // show results +// OutPutFrm.RichEdit.Clear; + title := 'Item-Total Correlations'; + DynVectorPrint(Cors,NoItems,title,ColLabels,NoCases); + // release memory + Cors := nil; +end; +//------------------------------------------------------------------- +procedure TDIFfrm.ItemCurves(Sender: TObject); +var + i, ii, j : integer; + XPlotPts : DblDyneMat; + YPlotPts : DblDyneMat; + LabelStr, outline, xTitle, yTitle : string; + max : integer; + +begin + SetLength(YPlotPts,2,nolevels); + SetLength(XPlotPts,1,nolevels); + + // get maximum no. of scores in either groups bins + for i := 0 to NoItems-1 do + begin + max := 0; + for j := 0 to nolevels-1 do + begin + if RMHRight[j,i] > max then max := RMHRight[j,i]; + if FMHRight[j,i] > max then max := FMHRight[j,i]; + end; + + // Plot reference group in blue, focus group in red + for ii := 1 to 2 do // possible group curves + begin + for j := 0 to nolevels-1 do //get points to plot + begin + XPlotPts[0,j] := Lbounds[j]; + if ii = 1 then YPlotPts[ii-1,j] := RMHRight[j,i]; + if ii = 2 then YPlotPts[ii-1,j] := FMHRight[j,i]; + end; + end; // next group + + // Plot the points + GraphFrm.BackColor := clWhite; + GraphFrm.ShowLeftWall := true; + GraphFrm.ShowRightWall := true; + GraphFrm.ShowBottomWall := true; + GraphFrm.ShowBackWall := true; + GraphFrm.BackColor := clYellow; + GraphFrm.WallColor := clBlue; + GraphFrm.FloorColor := clBlue; + outline := format('Blue = Reference, Red = Focus for item %d',[i+1]); + GraphFrm.Heading := outline; + xTitle := 'Lower bounds of levels'; + GraphFrm.XTitle := xTitle; + yTitle := 'Frequencies'; + GraphFrm.YTitle := yTitle; + GraphFrm.nosets := 2; + GraphFrm.nbars := nolevels; + GraphFrm.barwideprop := 0.5; + GraphFrm.miny := 0.0; + GraphFrm.maxy := max; + GraphFrm.AutoScale := false; + GraphFrm.GraphType := 5; // 2d line charts + GraphFrm.PtLabels := false; + for ii := 1 to 2 do + begin + if ii = 1 then LabelStr := 'Reference'; + if ii = 2 then LabelStr := 'Focus'; + GraphFrm.SetLabels[ii] := LabelStr; + end; + GraphFrm.Ypoints := YPlotPts; + GraphFrm.Xpoints := XPlotPts; + GraphFrm.ShowModal; + end; // next item + + XPlotPts := nil; + YPlotPts := nil; + +end; +//------------------------------------------------------------------- + +initialization + {$i DIF.lrs} + {$i DIF.lrs} + +end. diff --git a/applications/lazstats/source_orig/DIF.lfm b/applications/lazstats/source_orig/DIF.lfm new file mode 100644 index 000000000..2f2582286 --- /dev/null +++ b/applications/lazstats/source_orig/DIF.lfm @@ -0,0 +1,422 @@ +object DIFfrm: TDIFfrm + Left = 62 + Top = 100 + Width = 486 + Height = 466 + HelpContext = 1210 + Caption = 'DIF Specifications' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + HelpFile = 'OS2Help.hlp' + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 8 + Top = 112 + Width = 89 + Height = 13 + Caption = 'Available Variables' + end + object Label2: TLabel + Left = 200 + Top = 112 + Width = 70 + Height = 13 + Caption = 'Items Selected' + end + object Label3: TLabel + Left = 200 + Top = 264 + Width = 84 + Height = 13 + Caption = 'Grouping Variable' + end + object Label4: TLabel + Left = 200 + Top = 328 + Width = 110 + Height = 13 + Caption = 'Reference group code:' + end + object Label5: TLabel + Left = 200 + Top = 352 + Width = 89 + Height = 13 + Caption = 'Focal Group Code:' + end + object Label6: TLabel + Left = 200 + Top = 376 + Width = 94 + Height = 13 + Caption = 'No. of Score Levels' + end + object Label7: TLabel + Left = 352 + Top = 288 + Width = 108 + Height = 13 + Caption = 'Enter bounds for levels' + end + object Label8: TLabel + Left = 352 + Top = 352 + Width = 66 + Height = 13 + Caption = 'Lower Bound:' + end + object Label9: TLabel + Left = 352 + Top = 376 + Width = 66 + Height = 13 + Caption = 'Upper Bound:' + end + object Label10: TLabel + Left = 352 + Top = 304 + Width = 28 + Height = 13 + Caption = 'Down' + end + object Label11: TLabel + Left = 416 + Top = 304 + Width = 14 + Height = 13 + Caption = 'Up' + end + object Label12: TLabel + Left = 440 + Top = 304 + Width = 26 + Height = 13 + Caption = 'Level' + end + object Memo1: TMemo + Left = 8 + Top = 0 + Width = 457 + Height = 105 + Lines.Strings = ( + + 'This procedure is an adaptation of the program written by Niels ' + + 'G. Waller, Dept. of Psychology,' + + 'University of California - Davis, Jan. 1998. It'#39's purpose is to' + + ' identify test items that differ in the ' + + 'response pattern for two groups: a reference group and a focal g' + + 'roup. The file of data to be ' + + 'analyzed should consist of a variable containing a code designat' + + 'ing the two groups and ' + + 'variables containing subject'#39's item responses coded 0 for incorr' + + 'ect and 1 for correct. No ' + + 'missing data may be included. The results provide the Mantel-Ha' + + 'enszel statistics for identifying ' + 'those items which are different for the two groups.') + TabOrder = 0 + end + object VarList: TListBox + Left = 8 + Top = 128 + Width = 137 + Height = 249 + ItemHeight = 13 + MultiSelect = True + TabOrder = 1 + end + object ItemInBtn: TBitBtn + Left = 160 + Top = 152 + Width = 25 + Height = 25 + TabOrder = 2 + OnClick = ItemInBtnClick + Glyph.Data = { + 76010000424D7601000000000000760000002800000020000000100000000100 + 04000000000000010000120B0000120B00001000000000000000000000000000 + 800000800000008080008000000080008000808000007F7F7F00BFBFBF000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333FF3333333333333003333 + 3333333333773FF3333333333309003333333333337F773FF333333333099900 + 33333FFFFF7F33773FF30000000999990033777777733333773F099999999999 + 99007FFFFFFF33333F7700000009999900337777777F333F7733333333099900 + 33333333337F3F77333333333309003333333333337F77333333333333003333 + 3333333333773333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333} + NumGlyphs = 2 + end + object ItemOutBtn: TBitBtn + Left = 160 + Top = 184 + Width = 25 + Height = 25 + TabOrder = 3 + OnClick = ItemOutBtnClick + Glyph.Data = { + 76010000424D7601000000000000760000002800000020000000100000000100 + 04000000000000010000120B0000120B00001000000000000000000000000000 + 800000800000008080008000000080008000808000007F7F7F00BFBFBF000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333FF3333333333333003333333333333F77F33333333333009033 + 333333333F7737F333333333009990333333333F773337FFFFFF330099999000 + 00003F773333377777770099999999999990773FF33333FFFFF7330099999000 + 000033773FF33777777733330099903333333333773FF7F33333333333009033 + 33333333337737F3333333333333003333333333333377333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333} + NumGlyphs = 2 + end + object AllBtn: TBitBtn + Left = 160 + Top = 216 + Width = 25 + Height = 25 + Caption = 'ALL' + TabOrder = 4 + OnClick = AllBtnClick + end + object GrpInBtn: TBitBtn + Left = 160 + Top = 264 + Width = 25 + Height = 25 + TabOrder = 5 + OnClick = GrpInBtnClick + Glyph.Data = { + 76010000424D7601000000000000760000002800000020000000100000000100 + 04000000000000010000120B0000120B00001000000000000000000000000000 + 800000800000008080008000000080008000808000007F7F7F00BFBFBF000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333FF3333333333333003333 + 3333333333773FF3333333333309003333333333337F773FF333333333099900 + 33333FFFFF7F33773FF30000000999990033777777733333773F099999999999 + 99007FFFFFFF33333F7700000009999900337777777F333F7733333333099900 + 33333333337F3F77333333333309003333333333337F77333333333333003333 + 3333333333773333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333} + NumGlyphs = 2 + end + object GrpOutBtn: TBitBtn + Left = 160 + Top = 296 + Width = 25 + Height = 25 + TabOrder = 6 + Glyph.Data = { + 76010000424D7601000000000000760000002800000020000000100000000100 + 04000000000000010000120B0000120B00001000000000000000000000000000 + 800000800000008080008000000080008000808000007F7F7F00BFBFBF000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333FF3333333333333003333333333333F77F33333333333009033 + 333333333F7737F333333333009990333333333F773337FFFFFF330099999000 + 00003F773333377777770099999999999990773FF33333FFFFF7330099999000 + 000033773FF33777777733330099903333333333773FF7F33333333333009033 + 33333333337737F3333333333333003333333333333377333333333333333333 + 3333333333333333333333333333333333333333333333333333333333333333 + 3333333333333333333333333333333333333333333333333333} + NumGlyphs = 2 + end + object GroupVarEdit: TEdit + Left = 200 + Top = 280 + Width = 137 + Height = 21 + TabOrder = 7 + Text = 'GroupVarEdit' + end + object ItemsList: TListBox + Left = 200 + Top = 128 + Width = 137 + Height = 121 + ItemHeight = 13 + TabOrder = 8 + end + object RefGrpEdit: TEdit + Left = 312 + Top = 320 + Width = 25 + Height = 21 + TabOrder = 9 + Text = 'RefGrpEdit' + end + object TrgtGrpEdit: TEdit + Left = 312 + Top = 344 + Width = 25 + Height = 21 + TabOrder = 10 + Text = 'TrgtGrpEdit' + end + object ResetBtn: TButton + Left = 8 + Top = 408 + Width = 65 + Height = 25 + Caption = 'Reset' + TabOrder = 11 + OnClick = ResetBtnClick + end + object ComputeBtn: TButton + Left = 208 + Top = 408 + Width = 65 + Height = 25 + Caption = 'Compute' + TabOrder = 12 + OnClick = ComputeBtnClick + end + object ReturnBtn: TButton + Left = 400 + Top = 408 + Width = 65 + Height = 25 + Caption = 'Return' + ModalResult = 1 + TabOrder = 13 + OnClick = ReturnBtnClick + end + object GroupBox1: TGroupBox + Left = 352 + Top = 112 + Width = 113 + Height = 169 + Caption = 'Options' + TabOrder = 14 + object ItemStatsChk: TCheckBox + Left = 8 + Top = 16 + Width = 89 + Height = 17 + Caption = 'Item Statistics' + Checked = True + State = cbChecked + TabOrder = 0 + end + object TestStatsChk: TCheckBox + Left = 8 + Top = 32 + Width = 89 + Height = 17 + Caption = 'Test Statistics' + TabOrder = 1 + end + object ItemCorrsChk: TCheckBox + Left = 8 + Top = 48 + Width = 97 + Height = 17 + Caption = 'Item Intercorr.s' + TabOrder = 2 + end + object ItemTestChk: TCheckBox + Left = 8 + Top = 64 + Width = 89 + Height = 17 + Caption = 'Item-Test cor.s' + TabOrder = 3 + end + object AlphaChk: TCheckBox + Left = 8 + Top = 80 + Width = 97 + Height = 17 + Caption = 'Alpha Reliability' + TabOrder = 4 + end + object LogisticChk: TCheckBox + Left = 8 + Top = 112 + Width = 97 + Height = 17 + Caption = 'Logistic Regres.' + Enabled = False + TabOrder = 5 + end + object MHChk: TCheckBox + Left = 8 + Top = 96 + Width = 97 + Height = 17 + Caption = 'Mantel-Haenszel' + Checked = True + State = cbChecked + TabOrder = 6 + end + object CurvesChk: TCheckBox + Left = 8 + Top = 128 + Width = 97 + Height = 17 + Caption = 'Item Char. Crvs.' + TabOrder = 7 + end + object CountsChk: TCheckBox + Left = 8 + Top = 144 + Width = 97 + Height = 17 + Caption = 'Level Counts' + TabOrder = 8 + end + end + object LevelsEdit: TEdit + Left = 312 + Top = 368 + Width = 25 + Height = 21 + TabOrder = 15 + OnExit = LevelsEditExit + end + object LevelNoEdit: TEdit + Left = 440 + Top = 320 + Width = 25 + Height = 21 + TabOrder = 16 + Text = '1' + end + object LowBoundEdit: TEdit + Left = 440 + Top = 344 + Width = 25 + Height = 21 + TabOrder = 17 + OnExit = LowBoundEditExit + end + object UpBoundEdit: TEdit + Left = 440 + Top = 368 + Width = 25 + Height = 21 + TabOrder = 18 + OnExit = UpBoundEditExit + end + object LevelScroll: TScrollBar + Left = 352 + Top = 320 + Width = 81 + Height = 19 + Min = 1 + PageSize = 0 + Position = 1 + TabOrder = 19 + OnScroll = LevelScrollScroll + end +end diff --git a/applications/lazstats/source_orig/DIF.lrs b/applications/lazstats/source_orig/DIF.lrs new file mode 100644 index 000000000..fe521de37 --- /dev/null +++ b/applications/lazstats/source_orig/DIF.lrs @@ -0,0 +1,127 @@ +LazarusResources.Add('TDIFfrm','FORMDATA',[ + 'TPF0'#7'TDIFfrm'#6'DIFfrm'#4'Left'#2'>'#3'Top'#2'd'#5'Width'#3#230#1#6'Heigh' + +'t'#3#210#1#11'HelpContext'#3#186#4#7'Caption'#6#18'DIF Specifications'#5'Co' + +'lor'#7#9'clBtnFace'#12'Font.Charset'#7#15'DEFAULT_CHARSET'#10'Font.Color'#7 + +#12'clWindowText'#11'Font.Height'#2#245#9'Font.Name'#6#13'MS Sans Serif'#10 + +'Font.Style'#11#0#8'HelpFile'#6#11'OS2Help.hlp'#6'OnShow'#7#8'FormShow'#13'P' + +'ixelsPerInch'#2'`'#10'TextHeight'#2#13#0#6'TLabel'#6'Label1'#4'Left'#2#8#3 + +'Top'#2'p'#5'Width'#2'Y'#6'Height'#2#13#7'Caption'#6#19'Available Variables' + +#0#0#6'TLabel'#6'Label2'#4'Left'#3#200#0#3'Top'#2'p'#5'Width'#2'F'#6'Height' + +#2#13#7'Caption'#6#14'Items Selected'#0#0#6'TLabel'#6'Label3'#4'Left'#3#200#0 + +#3'Top'#3#8#1#5'Width'#2'T'#6'Height'#2#13#7'Caption'#6#17'Grouping Variable' + +#0#0#6'TLabel'#6'Label4'#4'Left'#3#200#0#3'Top'#3'H'#1#5'Width'#2'n'#6'Heigh' + +'t'#2#13#7'Caption'#6#21'Reference group code:'#0#0#6'TLabel'#6'Label5'#4'Le' + +'ft'#3#200#0#3'Top'#3'`'#1#5'Width'#2'Y'#6'Height'#2#13#7'Caption'#6#17'Foca' + +'l Group Code:'#0#0#6'TLabel'#6'Label6'#4'Left'#3#200#0#3'Top'#3'x'#1#5'Widt' + +'h'#2'^'#6'Height'#2#13#7'Caption'#6#19'No. of Score Levels'#0#0#6'TLabel'#6 + +'Label7'#4'Left'#3'`'#1#3'Top'#3' '#1#5'Width'#2'l'#6'Height'#2#13#7'Caption' + +#6#23'Enter bounds for levels'#0#0#6'TLabel'#6'Label8'#4'Left'#3'`'#1#3'Top' + +#3'`'#1#5'Width'#2'B'#6'Height'#2#13#7'Caption'#6#12'Lower Bound:'#0#0#6'TLa' + +'bel'#6'Label9'#4'Left'#3'`'#1#3'Top'#3'x'#1#5'Width'#2'B'#6'Height'#2#13#7 + +'Caption'#6#12'Upper Bound:'#0#0#6'TLabel'#7'Label10'#4'Left'#3'`'#1#3'Top'#3 + +'0'#1#5'Width'#2#28#6'Height'#2#13#7'Caption'#6#4'Down'#0#0#6'TLabel'#7'Labe' + +'l11'#4'Left'#3#160#1#3'Top'#3'0'#1#5'Width'#2#14#6'Height'#2#13#7'Caption'#6 + +#2'Up'#0#0#6'TLabel'#7'Label12'#4'Left'#3#184#1#3'Top'#3'0'#1#5'Width'#2#26#6 + +'Height'#2#13#7'Caption'#6#5'Level'#0#0#5'TMemo'#5'Memo1'#4'Left'#2#8#3'Top' + +#2#0#5'Width'#3#201#1#6'Height'#2'i'#13'Lines.Strings'#1#6'_This procedure i' + +'s an adaptation of the program written by Niels G. Waller, Dept. of Psychol' + +'ogy,'#6'hUniversity of California - Davis, Jan. 1998. It''s purpose is to ' + +'identify test items that differ in the '#6'^response pattern for two groups' + +': a reference group and a focal group. The file of data to be '#6'Wanalyze' + +'d should consist of a variable containing a code designating the two groups' + +' and '#6'[variables containing subject''s item responses coded 0 for incorr' + +'ect and 1 for correct. No '#6'bmissing data may be included. The results ' + +'provide the Mantel-Haenszel statistics for identifying '#6'3those items whi' + +'ch are different for the two groups.'#0#8'TabOrder'#2#0#0#0#8'TListBox'#7'V' + +'arList'#4'Left'#2#8#3'Top'#3#128#0#5'Width'#3#137#0#6'Height'#3#249#0#10'It' + +'emHeight'#2#13#11'MultiSelect'#9#8'TabOrder'#2#1#0#0#7'TBitBtn'#9'ItemInBtn' + +#4'Left'#3#160#0#3'Top'#3#152#0#5'Width'#2#25#6'Height'#2#25#8'TabOrder'#2#2 + +#7'OnClick'#7#14'ItemInBtnClick'#10'Glyph.Data'#10'z'#1#0#0'v'#1#0#0'BMv'#1#0 + +#0#0#0#0#0'v'#0#0#0'('#0#0#0' '#0#0#0#16#0#0#0#1#0#4#0#0#0#0#0#0#1#0#0#18#11 + +#0#0#18#11#0#0#16#0#0#0#0#0#0#0#0#0#0#0#0#0#128#0#0#128#0#0#0#128#128#0#128#0 + +#0#0#128#0#128#0#128#128#0#0''#0#191#191#191#0#0#0#255#0#0#255#0#0#0#255 + +#255#0#255#0#0#0#255#0#255#0#255#255#0#0#255#255#255#0'333333333333333333333' + +'33333333333333333333333333333333333333?'#243'333333'#0'3333333w?'#243'33333' + +#9#0'333333w?'#243'3333'#9#153#0'33?'#255#255'3w?'#243#0#0#0#9#153#153#0'3' + +'wwws33w?'#9#153#153#153#153#153#153#0''#255#255#255'33?w'#0#0#0#9#153#153#0 + +'3www3?w3333'#9#153#0'33333?w33333'#9#0'333333w333333'#0'3333333w33333333' + +'33333333333333333333333333333333333333333333'#9'NumGlyphs'#2#2#0#0#7'TBitBt' + +'n'#10'ItemOutBtn'#4'Left'#3#160#0#3'Top'#3#184#0#5'Width'#2#25#6'Height'#2 + +#25#8'TabOrder'#2#3#7'OnClick'#7#15'ItemOutBtnClick'#10'Glyph.Data'#10'z'#1#0 + +#0'v'#1#0#0'BMv'#1#0#0#0#0#0#0'v'#0#0#0'('#0#0#0' '#0#0#0#16#0#0#0#1#0#4#0#0 + +#0#0#0#0#1#0#0#18#11#0#0#18#11#0#0#16#0#0#0#0#0#0#0#0#0#0#0#0#0#128#0#0#128#0 + +#0#0#128#128#0#128#0#0#0#128#0#128#0#128#128#0#0''#0#191#191#191#0#0#0#255 + +#0#0#255#0#0#0#255#255#0#255#0#0#0#255#0#255#0#255#255#0#0#255#255#255#0'333' + +'33333333333333333333333333333333333333333?'#243'333333'#0'333333?w'#243'333' + +'33'#0#144'33333?w7'#243'3333'#0#153#144'3333?w37'#255#255#255'3'#0#153#153 + +#144#0#0#0'?w337www'#0#153#153#153#153#153#153#144'w?'#243'33'#255#255#247'3' + +#0#153#153#144#0#0#0'3w?'#243'7www33'#0#153#144'33333w?'#247#243'33333'#0#144 + +'333333w7'#243'333333'#0'3333333w3333333333333333333333333333333333333333333' + +'333333333333333333333333'#9'NumGlyphs'#2#2#0#0#7'TBitBtn'#6'AllBtn'#4'Left' + +#3#160#0#3'Top'#3#216#0#5'Width'#2#25#6'Height'#2#25#7'Caption'#6#3'ALL'#8'T' + +'abOrder'#2#4#7'OnClick'#7#11'AllBtnClick'#0#0#7'TBitBtn'#8'GrpInBtn'#4'Left' + +#3#160#0#3'Top'#3#8#1#5'Width'#2#25#6'Height'#2#25#8'TabOrder'#2#5#7'OnClick' + +#7#13'GrpInBtnClick'#10'Glyph.Data'#10'z'#1#0#0'v'#1#0#0'BMv'#1#0#0#0#0#0#0 + +'v'#0#0#0'('#0#0#0' '#0#0#0#16#0#0#0#1#0#4#0#0#0#0#0#0#1#0#0#18#11#0#0#18#11 + ,#0#0#16#0#0#0#0#0#0#0#0#0#0#0#0#0#128#0#0#128#0#0#0#128#128#0#128#0#0#0#128#0 + +#128#0#128#128#0#0''#0#191#191#191#0#0#0#255#0#0#255#0#0#0#255#255#0#255#0 + +#0#0#255#0#255#0#255#255#0#0#255#255#255#0'333333333333333333333333333333333' + +'33333333333333333333333333?'#243'333333'#0'3333333w?'#243'33333'#9#0'333333' + +'w?'#243'3333'#9#153#0'33?'#255#255'3w?'#243#0#0#0#9#153#153#0'3wwws33w?'#9 + +#153#153#153#153#153#153#0''#255#255#255'33?w'#0#0#0#9#153#153#0'3www3?w33' + +'33'#9#153#0'33333?w33333'#9#0'333333w333333'#0'3333333w333333333333333333' + +'3333333333333333333333333333333333'#9'NumGlyphs'#2#2#0#0#7'TBitBtn'#9'GrpOu' + +'tBtn'#4'Left'#3#160#0#3'Top'#3'('#1#5'Width'#2#25#6'Height'#2#25#8'TabOrder' + +#2#6#10'Glyph.Data'#10'z'#1#0#0'v'#1#0#0'BMv'#1#0#0#0#0#0#0'v'#0#0#0'('#0#0#0 + +' '#0#0#0#16#0#0#0#1#0#4#0#0#0#0#0#0#1#0#0#18#11#0#0#18#11#0#0#16#0#0#0#0#0#0 + +#0#0#0#0#0#0#0#128#0#0#128#0#0#0#128#128#0#128#0#0#0#128#0#128#0#128#128#0#0 + +''#0#191#191#191#0#0#0#255#0#0#255#0#0#0#255#255#0#255#0#0#0#255#0#255#0 + +#255#255#0#0#255#255#255#0'33333333333333333333333333333333333333333333?'#243 + +'333333'#0'333333?w'#243'33333'#0#144'33333?w7'#243'3333'#0#153#144'3333?w37' + +#255#255#255'3'#0#153#153#144#0#0#0'?w337www'#0#153#153#153#153#153#153#144 + +'w?'#243'33'#255#255#247'3'#0#153#153#144#0#0#0'3w?'#243'7www33'#0#153#144'3' + +'3333w?'#247#243'33333'#0#144'333333w7'#243'333333'#0'3333333w33333333333333' + +'33333333333333333333333333333333333333333333333333333'#9'NumGlyphs'#2#2#0#0 + +#5'TEdit'#12'GroupVarEdit'#4'Left'#3#200#0#3'Top'#3#24#1#5'Width'#3#137#0#6 + +'Height'#2#21#8'TabOrder'#2#7#4'Text'#6#12'GroupVarEdit'#0#0#8'TListBox'#9'I' + +'temsList'#4'Left'#3#200#0#3'Top'#3#128#0#5'Width'#3#137#0#6'Height'#2'y'#10 + +'ItemHeight'#2#13#8'TabOrder'#2#8#0#0#5'TEdit'#10'RefGrpEdit'#4'Left'#3'8'#1 + +#3'Top'#3'@'#1#5'Width'#2#25#6'Height'#2#21#8'TabOrder'#2#9#4'Text'#6#10'Ref' + +'GrpEdit'#0#0#5'TEdit'#11'TrgtGrpEdit'#4'Left'#3'8'#1#3'Top'#3'X'#1#5'Width' + +#2#25#6'Height'#2#21#8'TabOrder'#2#10#4'Text'#6#11'TrgtGrpEdit'#0#0#7'TButto' + +'n'#8'ResetBtn'#4'Left'#2#8#3'Top'#3#152#1#5'Width'#2'A'#6'Height'#2#25#7'Ca' + +'ption'#6#5'Reset'#8'TabOrder'#2#11#7'OnClick'#7#13'ResetBtnClick'#0#0#7'TBu' + +'tton'#10'ComputeBtn'#4'Left'#3#208#0#3'Top'#3#152#1#5'Width'#2'A'#6'Height' + +#2#25#7'Caption'#6#7'Compute'#8'TabOrder'#2#12#7'OnClick'#7#15'ComputeBtnCli' + +'ck'#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#144#1#3'Top'#3#152#1#5'Width'#2'A' + +#6'Height'#2#25#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#13#7 + +'OnClick'#7#14'ReturnBtnClick'#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#3'`'#1#3 + +'Top'#2'p'#5'Width'#2'q'#6'Height'#3#169#0#7'Caption'#6#7'Options'#8'TabOrde' + +'r'#2#14#0#9'TCheckBox'#12'ItemStatsChk'#4'Left'#2#8#3'Top'#2#16#5'Width'#2 + +'Y'#6'Height'#2#17#7'Caption'#6#15'Item Statistics'#7'Checked'#9#5'State'#7#9 + +'cbChecked'#8'TabOrder'#2#0#0#0#9'TCheckBox'#12'TestStatsChk'#4'Left'#2#8#3 + +'Top'#2' '#5'Width'#2'Y'#6'Height'#2#17#7'Caption'#6#15'Test Statistics'#8'T' + +'abOrder'#2#1#0#0#9'TCheckBox'#12'ItemCorrsChk'#4'Left'#2#8#3'Top'#2'0'#5'Wi' + +'dth'#2'a'#6'Height'#2#17#7'Caption'#6#16'Item Intercorr.s'#8'TabOrder'#2#2#0 + +#0#9'TCheckBox'#11'ItemTestChk'#4'Left'#2#8#3'Top'#2'@'#5'Width'#2'Y'#6'Heig' + +'ht'#2#17#7'Caption'#6#15'Item-Test cor.s'#8'TabOrder'#2#3#0#0#9'TCheckBox'#8 + +'AlphaChk'#4'Left'#2#8#3'Top'#2'P'#5'Width'#2'a'#6'Height'#2#17#7'Caption'#6 + +#17'Alpha Reliability'#8'TabOrder'#2#4#0#0#9'TCheckBox'#11'LogisticChk'#4'Le' + +'ft'#2#8#3'Top'#2'p'#5'Width'#2'a'#6'Height'#2#17#7'Caption'#6#16'Logistic R' + +'egres.'#7'Enabled'#8#8'TabOrder'#2#5#0#0#9'TCheckBox'#5'MHChk'#4'Left'#2#8#3 + +'Top'#2'`'#5'Width'#2'a'#6'Height'#2#17#7'Caption'#6#15'Mantel-Haenszel'#7'C' + +'hecked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#6#0#0#9'TCheckBox'#9'Curves' + +'Chk'#4'Left'#2#8#3'Top'#3#128#0#5'Width'#2'a'#6'Height'#2#17#7'Caption'#6#16 + +'Item Char. Crvs.'#8'TabOrder'#2#7#0#0#9'TCheckBox'#9'CountsChk'#4'Left'#2#8 + +#3'Top'#3#144#0#5'Width'#2'a'#6'Height'#2#17#7'Caption'#6#12'Level Counts'#8 + +'TabOrder'#2#8#0#0#0#5'TEdit'#10'LevelsEdit'#4'Left'#3'8'#1#3'Top'#3'p'#1#5 + +'Width'#2#25#6'Height'#2#21#8'TabOrder'#2#15#6'OnExit'#7#14'LevelsEditExit'#0 + +#0#5'TEdit'#11'LevelNoEdit'#4'Left'#3#184#1#3'Top'#3'@'#1#5'Width'#2#25#6'He' + +'ight'#2#21#8'TabOrder'#2#16#4'Text'#6#1'1'#0#0#5'TEdit'#12'LowBoundEdit'#4 + +'Left'#3#184#1#3'Top'#3'X'#1#5'Width'#2#25#6'Height'#2#21#8'TabOrder'#2#17#6 + +'OnExit'#7#16'LowBoundEditExit'#0#0#5'TEdit'#11'UpBoundEdit'#4'Left'#3#184#1 + +#3'Top'#3'p'#1#5'Width'#2#25#6'Height'#2#21#8'TabOrder'#2#18#6'OnExit'#7#15 + +'UpBoundEditExit'#0#0#10'TScrollBar'#11'LevelScroll'#4'Left'#3'`'#1#3'Top'#3 + +'@'#1#5'Width'#2'Q'#6'Height'#2#19#3'Min'#2#1#8'PageSize'#2#0#8'Position'#2#1 + +#8'TabOrder'#2#19#8'OnScroll'#7#17'LevelScrollScroll'#0#0#0 +]); diff --git a/applications/lazstats/source_orig/DIFFERENCEUNIT.PAS b/applications/lazstats/source_orig/DIFFERENCEUNIT.PAS new file mode 100644 index 000000000..9ca9a4bd7 --- /dev/null +++ b/applications/lazstats/source_orig/DIFFERENCEUNIT.PAS @@ -0,0 +1,53 @@ +unit DifferenceUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, contexthelpunit; + +type + + { TDifferenceFrm } + + TDifferenceFrm = class(TForm) + CancelBtn: TButton; + HelpBtn: TButton; + OKBtn: TButton; + LagEdit: TEdit; + OrderEdit: TEdit; + Label1: TLabel; + Label2: TLabel; + procedure FormShow(Sender: TObject); + procedure HelpBtnClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + DifferenceFrm: TDifferenceFrm; + +implementation + +{ TDifferenceFrm } + +procedure TDifferenceFrm.FormShow(Sender: TObject); +begin + LagEdit.Text := '1'; + OrderEdit.Text := '1'; +end; + +procedure TDifferenceFrm.HelpBtnClick(Sender: TObject); +begin + ContextHelpForm.HelpMessage((Sender as TButton).tag); +end; + +initialization + {$I differenceunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/DIFFERENCEUNIT.lfm b/applications/lazstats/source_orig/DIFFERENCEUNIT.lfm new file mode 100644 index 000000000..d307944b0 --- /dev/null +++ b/applications/lazstats/source_orig/DIFFERENCEUNIT.lfm @@ -0,0 +1,71 @@ +object DifferenceFrm: TDifferenceFrm + Left = 211 + Height = 136 + Top = 137 + Width = 271 + Caption = 'Differencing Specification' + ClientHeight = 136 + ClientWidth = 271 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 7 + Height = 14 + Top = 16 + Width = 102 + Caption = 'Difference for lag of:' + ParentColor = False + end + object Label2: TLabel + Left = 7 + Height = 14 + Top = 56 + Width = 114 + Caption = 'No. of times to repeat: ' + ParentColor = False + end + object LagEdit: TEdit + Left = 120 + Height = 21 + Top = 9 + Width = 39 + TabOrder = 0 + Text = '1' + end + object OrderEdit: TEdit + Left = 120 + Height = 21 + Top = 49 + Width = 39 + TabOrder = 1 + Text = '1' + end + object CancelBtn: TButton + Left = 96 + Height = 31 + Top = 88 + Width = 78 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 2 + end + object OKBtn: TButton + Left = 184 + Height = 31 + Top = 88 + Width = 78 + Caption = 'OK' + ModalResult = 1 + TabOrder = 3 + end + object HelpBtn: TButton + Tag = 121 + Left = 8 + Height = 32 + Top = 88 + Width = 82 + Caption = 'Help' + OnClick = HelpBtnClick + TabOrder = 4 + end +end diff --git a/applications/lazstats/source_orig/DIFFERENCEUNIT.lrs b/applications/lazstats/source_orig/DIFFERENCEUNIT.lrs new file mode 100644 index 000000000..184c88e90 --- /dev/null +++ b/applications/lazstats/source_orig/DIFFERENCEUNIT.lrs @@ -0,0 +1,20 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TDifferenceFrm','FORMDATA',[ + 'TPF0'#14'TDifferenceFrm'#13'DifferenceFrm'#4'Left'#3#211#0#6'Height'#3#136#0 + +#3'Top'#3#137#0#5'Width'#3#15#1#7'Caption'#6#26'Differencing Specification' + +#12'ClientHeight'#3#136#0#11'ClientWidth'#3#15#1#6'OnShow'#7#8'FormShow'#10 + +'LCLVersion'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3 + +'Top'#2#16#5'Width'#2'f'#7'Caption'#6#22'Difference for lag of:'#11'ParentCo' + +'lor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#7#6'Height'#2#14#3'Top'#2'8'#5'Wid' + +'th'#2'r'#7'Caption'#6#24'No. of times to repeat: '#11'ParentColor'#8#0#0#5 + +'TEdit'#7'LagEdit'#4'Left'#2'x'#6'Height'#2#21#3'Top'#2#9#5'Width'#2''''#8'T' + +'abOrder'#2#0#4'Text'#6#1'1'#0#0#5'TEdit'#9'OrderEdit'#4'Left'#2'x'#6'Height' + +#2#21#3'Top'#2'1'#5'Width'#2''''#8'TabOrder'#2#1#4'Text'#6#1'1'#0#0#7'TButto' + +'n'#9'CancelBtn'#4'Left'#2'`'#6'Height'#2#31#3'Top'#2'X'#5'Width'#2'N'#7'Cap' + +'tion'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#2#0#0#7'TButton'#5'OKBt' + +'n'#4'Left'#3#184#0#6'Height'#2#31#3'Top'#2'X'#5'Width'#2'N'#7'Caption'#6#2 + +'OK'#11'ModalResult'#2#1#8'TabOrder'#2#3#0#0#7'TButton'#7'HelpBtn'#3'Tag'#2 + +'y'#4'Left'#2#8#6'Height'#2' '#3'Top'#2'X'#5'Width'#2'R'#7'Caption'#6#4'Help' + +#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#4#0#0#0 +]); diff --git a/applications/lazstats/source_orig/DISCRIMUNIT.PAS b/applications/lazstats/source_orig/DISCRIMUNIT.PAS new file mode 100644 index 000000000..123b77fcc --- /dev/null +++ b/applications/lazstats/source_orig/DISCRIMUNIT.PAS @@ -0,0 +1,1208 @@ +unit DiscrimUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, Buttons, ExtCtrls, MainUnit,OutPutUnit, FunctionsLib, + GraphLib, Globals, DataProcs, MatrixLib, DictionaryUnit, Math; + +type + + { TDiscrimFrm } + + TDiscrimFrm = class(TForm) + ResetBtn: TButton; + CancelBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + DescChk: TCheckBox; + PCovChk: TCheckBox; + CentroidsChk: TCheckBox; + ScoresChk: TCheckBox; + CorrsChk: TCheckBox; + InvChk: TCheckBox; + PlotChk: TCheckBox; + ClassChk: TCheckBox; + AnovaChk: TCheckBox; + CrossChk: TCheckBox; + DevCPChk: TCheckBox; + EigensChk: TCheckBox; + DepIn: TBitBtn; + DepOut: TBitBtn; + GroupBox1: TGroupBox; + PredIn: TBitBtn; + PredOut: TBitBtn; + GroupVar: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + PredList: TListBox; + ClassSize: TRadioGroup; + VarList: TListBox; + procedure ComputeBtnClick(Sender: TObject); + procedure DepInClick(Sender: TObject); + procedure DepOutClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure PredInClick(Sender: TObject); + procedure PredOutClick(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + private + { private declarations } + MaxGrp : integer; + MinGrp : integer; + procedure PlotPts(Sender: TObject; RawCMat : DblDyneMat; + Constants : DblDyneVec; + ColNoSelected : IntDyneVec; + NoSelected : integer; + noroots : integer; + NoCases : integer; + GrpVar : integer; + NoGrps : integer; + NoInGrp : IntDyneVec); + + procedure Classify(Sender: TObject; PooledW : DblDyneMat; + GrpMeans : DblDyneMat; + ColNoSelected : IntDyneVec; + NoSelected : integer; + NoCases : integer; + GrpVar : integer; + NoGrps : integer; + NoInGrp : IntDyneVec; + VarLabels : StrDyneVec); + + procedure ClassIt(Sender: TObject; PooledW : DblDyneMat; + ColNoSelected : IntDyneVec; + GrpMeans : DblDyneMat; + Roots : DblDyneVec; + noroots : integer; + GrpVar : integer; + NoGrps : integer; + NoInGrp : IntDyneVec; + NoSelected : integer; + NoCases : integer; + RawCmat : DblDyneMat; + Constants : DblDyneVec); + public + { public declarations } + end; + +var + DiscrimFrm: TDiscrimFrm; + +implementation + +{ TDiscrimFrm } + +procedure TDiscrimFrm.ResetBtnClick(Sender: TObject); +VAR i : integer; +begin + VarList.Clear; + PredList.Clear; + PredOut.Visible := false; + PredIn.Visible := true; + DepOut.Visible := false; + DepIn.Visible := true; + GroupVar.Text := ''; + DescChk.Checked := false; + CorrsChk.Checked := false; + InvChk.Checked := false; + PlotChk.Checked := false; + ClassChk.Checked := false; + AnovaChk.Checked := false; + for i := 1 to NoVariables do + VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); +end; + +procedure TDiscrimFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; + +procedure TDiscrimFrm.DepInClick(Sender: TObject); +VAR index : integer; +begin + index := VarList.ItemIndex; + GroupVar.Text := VarList.Items.Strings[index]; + VarList.Items.Delete(index); + DepOut.Visible := true; + DepIn.Visible := false; +end; + +procedure TDiscrimFrm.ComputeBtnClick(Sender: TObject); +var + i, j, k, grp, grpvalue, matrow, matcol, noroots, dfchi, n2, k2 : integer; + NoSelected : integer; + outline, GroupLabel, ColHead : string; + Title : string; + GrpVar, NoGrps, nowithin, TotalCases, value, grpno : integer; + ColNoSelected : IntDyneVec; + CaseNo, NoInGrp : IntDyneVec; + VarLabels, ColLabels, GrpNos : StrDyneVec; + X, Y, GroupSS, ErrorSS, GroupMS, ErrorMS, TotalSS, num, s, v2, den : double; + Lambda, ChiSquare, Pillia, TotChi, p, Rc, chi, chiprob, m, L2, F, Fprob : double; + DFGroup, DFError, DFTotal, Fratio, prob, minroot, trace, pcnttrace : double; + probchi : double; + WithinMat, WithinInv, WinvB, v, PooledW, TotalMat, BetweenMat : DblDyneMat; + EigenVectors, EigenTrans, TempMat, Theta, DiagMat, CoefMat : DblDyneMat; + RawCMat, GrpMeans, GrpSDevs, Centroids, Structure : DblDyneMat; + Constants, ScoreVar, Roots, Pcnts, TotalMeans, TotalVariances : DblDyneVec; + TotalStdDevs, WithinMeans, WithinVariances, WithinStdDevs, w : DblDyneVec; + errorcode : boolean; +begin + TotalCases := 0; + OutPutFrm.RichEdit.Clear(); + OutPutFrm.RichEdit.Lines.Add('MULTIVARIATE ANOVA / DISCRIMINANT FUNCTION'); + OutPutFrm.RichEdit.Lines.Add('Reference: Multiple Regression in Behavioral Research'); + OutPutFrm.RichEdit.Lines.Add('Elazar J. Pedhazur, 1997, Chapters 20-21'); + OutPutFrm.RichEdit.Lines.Add('Harcourt Brace College Publishers'); + NoSelected := PredList.Items.Count + 1; + SetLength(ColNoSelected,NoVariables); + SetLength(VarLabels,NoVariables); + SetLength(ColLabels,NoVariables); + SetLength(CaseNo,NoVariables); + + // Get items selected + for i := 1 to NoSelected - 1 do + begin + for j := 1 to NoVariables do + begin + if (PredList.Items.Strings[i-1] = OS3MainFrm.DataGrid.Cells[j,0]) then + begin + ColNoSelected[i-1] := j; + VarLabels[i-1] := OS3MainFrm.DataGrid.Cells[j,0]; + end; + if GroupVar.Text = OS3MainFrm.DataGrid.Cells[j,0] then + begin + GrpVar := j; + GroupLabel := OS3MainFrm.DataGrid.Cells[j,0]; + ColNoSelected[NoSelected-1] := j; + end; + end; // next j variable + end; // next i predictor + + //Allocate memory for analyses + SetLength(WithinMat,NoVariables,NoVariables); + SetLength(WithinInv,NoVariables,NoVariables); + SetLength(WinvB,NoVariables,NoVariables); + SetLength(v,NoVariables,NoVariables); + SetLength(PooledW,NoVariables,NoVariables); + SetLength(TotalMat,NoVariables,NoVariables); + SetLength(BetweenMat,NoVariables,NoVariables); + SetLength(EigenVectors,NoVariables,NoVariables); + SetLength(EigenTrans,NoVariables,NoVariables); + SetLength(TempMat,NoVariables,NoVariables); + SetLength(Theta,NoVariables,NoVariables); + SetLength(DiagMat,NoVariables,NoVariables); + SetLength(CoefMat,NoVariables,NoVariables); + SetLength(RawCMat,NoVariables,NoVariables); + SetLength(Structure,NoVariables,NoVariables); + SetLength(Constants,NoVariables); + SetLength(ScoreVar,NoVariables); + SetLength(Roots,NoVariables); + SetLength(Pcnts,NoVariables); + SetLength(TotalMeans,NoVariables); + SetLength(TotalVariances,NoVariables); + SetLength(TotalStdDevs,NoVariables); + SetLength(WithinMeans,NoVariables); + SetLength(WithinVariances,NoVariables); + SetLength(WithinStdDevs,NoVariables); + SetLength(w,NoVariables); + + // Initialize arrays + for i := 0 to NoSelected-1 do + begin + TotalMeans[i] := 0.0; + TotalVariances[i] := 0.0; + WithinMeans[i] := 0.0; + WithinVariances[i] := 0.0; + for j := 0 to NoSelected-1 do + begin + TotalMat[i,j] := 0.0; + WithinMat[i,j] := 0.0; + PooledW[i,j] := 0.0; + end; + end; + + //Get minimum and maximum group numbers (and no. of groups) + MinGrp := 1000; + MaxGrp := 0; + for i := 1 to NoCases do + begin + if (GoodRecord(i,NoSelected,ColNoSelected)) then + begin + value := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,i]))); + if (value < MinGrp) then MinGrp := value; + if (value > MaxGrp) then MaxGrp := value; + end; + end; // next case + NoGrps := MaxGrp - MinGrp + 1; + + //Allocate space for group means, standard deviations and centroids + SetLength(GrpMeans,NoGrps,NoSelected); + SetLength(GrpSDevs,NoGrps,NoSelected); + SetLength(Centroids,NoGrps,NoSelected); + SetLength(GrpNos,NoGrps); + SetLength(NoInGrp,NoGrps); + + //Initialize group variables + for i := 0 to NoGrps-1 do + begin + for j := 0 to NoSelected-1 do + begin + Centroids[i,j] := 0.0; + GrpMeans[i,j] := 0.0; + GrpSDevs[i,j] := 0.0; + end; + end; + + OutPutFrm.RichEdit.Lines.Add(''); + outline := format('Total Cases := %d, Number of Groups := %d', + [NoCases, NoGrps]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + + //Read the data for each group, accumulating cross-products and sums + for grp := 1 to NoGrps do + begin + nowithin := 0; + grpvalue := grp; + for i := 1 to NoCases do + begin + if (GoodRecord(i,NoSelected,ColNoSelected)) then + begin + grpno := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,i]))); + grpno := NoGrps - (MaxGrp - grpno); + if (grpno = grpvalue) then // case belongs to this group + begin + GrpNos[grp-1] := IntToStr(grpno); + nowithin := nowithin + 1; + TotalCases := TotalCases + 1; + for j := 1 to NoSelected - 1 do // matrix row + begin + matrow := ColNoSelected[j-1]; + X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[matrow,i])); + for k := 1 to NoSelected - 1 do // matrix col. + begin + matcol := ColNoSelected[k-1]; + Y := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[matcol,i])); + WithinMat[j-1,k-1] := WithinMat[j-1,k-1] + (X * Y); + TotalMat[j-1,k-1] := TotalMat[j-1,k-1] + (X * Y); + end; + WithinMeans[j-1] := WithinMeans[j-1] + X; + WithinVariances[j-1] := WithinVariances[j-1] + (X * X); + TotalMeans[j-1] := TotalMeans[j-1] + X; + TotalVariances[j-1] := TotalVariances[j-1] + (X * X); + end; // next variable j + end; // if group number match + end; // end if valid record + end; // next case + + // Does user want cross-products matrices ? + if (CrossChk.Checked = true) then + begin + // print within matrix + ColHead := format('Group %d, N = %d',[grp,nowithin]); + Title := 'SUM OF CROSS-PRODUCTS for ' + ColHead; + MAT_PRINT(WithinMat,NoSelected-1,NoSelected-1,Title,VarLabels,VarLabels,nowithin); + end; + + // Convert to deviation cross-products and pool + for j := 1 to NoSelected - 1 do + begin + for k := 1 to NoSelected - 1 do + begin + WithinMat[j-1,k-1] := WithinMat[j-1,k-1] - + (WithinMeans[j-1] * WithinMeans[k-1] / nowithin); + PooledW[j-1,k-1] := PooledW[j-1,k-1] + WithinMat[j-1,k-1]; + end; + end; + + // Does user want deviation cross-products? + if (DevCPChk.Checked = true) then + begin + // print within matrix + ColHead := format('Group %d, N := %d',[grpvalue,nowithin]); + Title := 'WITHIN GROUP SUM OF DEVIATION CROSS-PRODUCTS ' + ColHead; + MAT_PRINT(WithinMat,NoSelected-1,NoSelected-1,Title,VarLabels, + VarLabels,nowithin); + end; + + // Compute descriptives from sums and sums of squares + for j := 1 to NoSelected - 1 do + begin + WithinVariances[j-1] := WithinVariances[j-1] - + (WithinMeans[j-1] * WithinMeans[j-1] / nowithin); + WithinVariances[j-1] := WithinVariances[j-1] / (nowithin-1); + WithinStdDevs[j-1] := sqrt(WithinVariances[j-1]); + WithinMeans[j-1] := WithinMeans[j-1] / nowithin; + end; + + // Does user want descriptives ? + if DescChk.Checked then + begin + // print mean, variance and std. dev.s for variables + outline := format('MEANS FOR GROUP %d, N := %d',[grp,nowithin]); + DynVectorPrint(WithinMeans,NoSelected-1,outline,VarLabels,nowithin); + outline := format('VARIANCES FOR GROUP %d',[grp]); + DynVectorPrint(WithinVariances,NoSelected-1,outline,VarLabels,nowithin); + outline := format('STANDARD DEVIATIONS FOR GROUP %d',[grp]); + DynVectorPrint(WithinStdDevs,NoSelected-1,outline,VarLabels,nowithin); + end; + if (DescChk.Checked) or (DevCPChk.Checked) or (CrossChk.Checked) then + begin + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + // Now initialize for the next group and save descriptives + for j := 1 to NoSelected - 1 do + begin + GrpMeans[grp-1,j-1] := WithinMeans[j-1]; + WithinMeans[j-1] := 0.0; + GrpSDevs[grp-1,j-1] := WithinStdDevs[j-1]; + WithinVariances[j-1] := 0.0; + for k := 1 to NoSelected - 1 do WithinMat[j-1,k-1] := 0.0; + end; + NoInGrp[grp-1] := nowithin; + end; // next group + + // Does user want cross-products matrices ? + if CrossChk.Checked then + begin + // print Total cross-products matrix + Title := 'TOTAL SUM OF CROSS-PRODUCTS'; + MAT_PRINT(TotalMat,NoSelected-1,NoSelected-1,Title,VarLabels,VarLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + //Obtain Total deviation cross-products + for j := 1 to NoSelected - 1 do + for k := 1 to NoSelected - 1 do + TotalMat[j-1,k-1] := TotalMat[j-1,k-1] - + (TotalMeans[j-1] * TotalMeans[k-1] / TotalCases); + + // Does user want deviation cross-products? + if DevCPChk.Checked then + begin + // print total deviation cross-products matrix + Title := 'TOTAL SUM OF DEVIATION CROSS-PRODUCTS'; + MAT_PRINT(TotalMat,NoSelected-1,NoSelected-1,Title,VarLabels,VarLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + for j := 1 to NoSelected - 1 do + begin + TotalVariances[j-1] := TotalVariances[j-1] - + (TotalMeans[j-1] * TotalMeans[j-1] / TotalCases); + TotalVariances[j-1] := TotalVariances[j-1] / (TotalCases - 1); + TotalStdDevs[j-1] := sqrt(TotalVariances[j-1]); + TotalMeans[j-1] := TotalMeans[j-1] / TotalCases; + end; + + // Does user want descriptives ? + if DescChk.Checked then + begin + // print mean, variance and std. dev.s for variables + Title := 'MEANS'; + DynVectorPrint(TotalMeans,NoSelected-1,Title,VarLabels,TotalCases); + Title := 'VARIANCES'; + DynVectorPrint(TotalVariances,NoSelected-1,Title,VarLabels,TotalCases); + Title := 'STANDARD DEVIATIONS'; + DynVectorPrint(TotalStdDevs,NoSelected-1,Title,VarLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + // Obtain between groups deviation cross-products matrix + MATSUB(BetweenMat,TotalMat,PooledW,NoSelected-1,NoSelected-1, + NoSelected-1,NoSelected-1,errorcode); + + // Does user want deviation cross-products? + if DevCPChk.Checked then + begin + // print between groups deviation cross-products matrix + Title := 'BETWEEN GROUPS SUM OF DEV. CPs'; + MAT_PRINT(BetweenMat,NoSelected-1,NoSelected-1,Title,VarLabels, + VarLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + // Do univariate ANOVA's for each variable + if AnovaChk.Checked then + begin + for j := 1 to NoSelected - 1 do + begin + outline := format('UNIVARIATE ANOVA FOR VARIABLE %s', + [VarLabels[j-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add('SOURCE DF SS MS F PROB > F'); + GroupSS := BetweenMat[j-1,j-1]; + ErrorSS := PooledW[j-1,j-1]; + TotalSS := TotalMat[j-1,j-1]; + DFGroup := NoGrps - 1; + DFError := TotalCases - NoGrps; + DFTotal := TotalCases - 1; + GroupMS := GroupSS / DFGroup; + ErrorMS := ErrorSS / DFError; + Fratio := GroupMS / ErrorMS; + prob := probf(Fratio,DFGroup,DFError); + outline := format('BETWEEN %3.0f%10.3f%10.3f%10.3f%10.3f', + [DFGroup,GroupSS,GroupMS,Fratio,prob]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('ERROR %3.0f%10.3f%10.3f', + [DFError,ErrorSS,ErrorMS]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('TOTAL %3.0f%10.3f',[DFTotal,TotalSS]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + end; + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + // Get roots of the product of the within group inverse times between + // Inverse routine starts at 1, not 0. Setup temps for inverse + for i := 1 to NoSelected - 1 do + for j := 1 to NoSelected - 1 do + WithinInv[i-1,j-1] := PooledW[i-1,j-1]; + SVDinverse(WithinInv,NoSelected-1); + + // Does user want inverse of pooled within deviation cross-products? + if InvChk.Checked then + begin + Title := 'Inv. of Pooled Within Dev. CPs Matrix'; + MAT_PRINT(WithinInv,NoSelected-1,NoSelected-1,Title,VarLabels,VarLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + // Get roots of the W inverse times Betweeen matrices + MATAxB(WinvB,WithinInv,BetweenMat,NoSelected-1,NoSelected-1,NoSelected-1,NoSelected-1,errorcode); + minroot := 0.0; + noroots := 0; + if (NoGrps <= NoSelected-1) then noroots := NoGrps-1 else noroots := NoSelected-1; + trace := 0.0; + pcnttrace := 0.0; + nonsymroots(WinvB,NoSelected-1,noroots,minroot,EigenVectors,Roots,Pcnts,trace,pcnttrace); + outline := format('Number of roots extracted := %d',[noroots]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Percent of trace extracted := %10.4f',[pcnttrace]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := 'Roots of the W inverse time B Matrix'; + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + outline := 'No. Root Proportion Canonical R Chi-Squared D.F. Prob.'; + OutPutFrm.RichEdit.Lines.Add(outline); + Lambda := 1.0; + ChiSquare := 0.0; + Pillia := 0.0; + for i := 1 to noroots do + begin + Lambda := Lambda * (1.0 / (1.0 + Roots[i-1])); + ChiSquare := ChiSquare + ln(1.0 + Roots[i-1]); + Pillia := Pillia + (Roots[i-1] / (1.0 + Roots[i-1])); + end; + TotChi := ChiSquare; + for i := 1 to noroots do + begin + p := Roots[i-1] / trace; + Rc := sqrt(Roots[i-1] / (1.0 + Roots[i-1])); + dfchi := (NoSelected - i) * (NoGrps - i ); + chi := TotChi * (TotalCases - 1.0 - 0.5 * (NoSelected + NoGrps)); + chiprob := 1.0 - chisquaredprob(chi,dfchi); + outline := format('%2d %10.4f %6.4f %6.4f %10.4f %3d %6.3f', + [i,Roots[i-1],p,Rc,chi,dfchi,chiprob]); + OutPutFrm.RichEdit.Lines.Add(outline); + TotChi := TotChi - ln(1.0 + Roots[i-1]); + end; + ChiSquare := ChiSquare * ((TotalCases - 1) - (0.5 * (NoSelected - 1 + NoGrps))); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + + for i := 1 to noroots do ColLabels[i-1] := IntToStr(i); + if EigensChk.Checked then + begin + Title := 'Eigenvectors of the W inverse x B Matrix'; + MAT_PRINT(EigenVectors,NoSelected-1,noroots,Title,VarLabels,ColLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + // Now get covariance matrices for the total and within + for i := 1 to NoSelected - 1 do + begin + for j := 1 to NoSelected - 1 do + begin + TotalMat[i-1,j-1] := TotalMat[i-1,j-1] / (TotalCases - 1); + PooledW[i-1,j-1] := PooledW[i-1,j-1] / (TotalCases - NoGrps); + end; + end; + + if PCovChk.Checked then + begin + Title := 'Pooled Within-Groups Covariance Matrix'; + MAT_PRINT(PooledW,NoSelected-1,NoSelected-1,Title,VarLabels,VarLabels,TotalCases); + Title := 'Total Covariance Matrix'; + MAT_PRINT(TotalMat,NoSelected-1,NoSelected-1,Title,VarLabels,VarLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + //Get the pooled within groups variance-covariance of disc. scores matrix v'C v + MATTRN(EigenTrans,EigenVectors, NoSelected-1,noroots); // v' + MATAxB(TempMat,EigenTrans,PooledW,noroots,NoSelected-1,NoSelected-1, + NoSelected-1,errorcode);//v'C + MATAxB(Theta,TempMat,EigenVectors,noroots,NoSelected-1,NoSelected-1, + noroots, errorcode); //v'C v + + //Create a diagonal matrix with square roots of the diagonal of the Within + for i := 1 to NoSelected - 1 do + begin + for j := 1 to NoSelected - 1 do + begin + if (i <> j) then DiagMat[i-1,j-1] := 0.0 + else DiagMat[i-1,j-1] := sqrt(PooledW[i-1,j-1]); + end; + end; + + // Get recipricol of standard deviations of each function + for i := 1 to noroots do + ScoreVar[i-1] := 1.0 / sqrt(Theta[i-1,i-1]); + + // Divide coefficients by their standard deviations + for i := 1 to NoSelected - 1 do + begin + for j := 1 to noroots do + begin + RawCMat[i-1,j-1] := EigenVectors[i-1,j-1] * ScoreVar[j-1]; // raw coeff. + CoefMat[i-1,j-1] := RawCMat[i-1,j-1] * sqrt(PooledW[i-1,i-1]); + end; + end; + + // Get constants for raw score equations + for i := 1 to noroots do + begin + Constants[i-1] := 0.0; + for j := 1 to NoSelected - 1 do + begin + Constants[i-1] := Constants[i-1] - (RawCMat[j-1,i-1] * TotalMeans[j-1]); + end; + end; + + // Plot discriminant scores? + if PlotChk.Checked then + begin + PlotPts(self,RawCMat,Constants,ColNoSelected,NoSelected, + noroots,NoCases,GrpVar,NoGrps,NoInGrp); + end; + + // print discrim functions + Title := 'Raw Function Coeff.s from Pooled Cov.'; + MAT_PRINT(RawCMat,NoSelected-1,noroots,Title,VarLabels,ColLabels,TotalCases); + Title := 'Raw Discriminant Function Constants'; + DynVectorPrint(Constants,noroots,Title,ColLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + + //Does user want to classify cases using canonical functions? + if ClassChk.Checked then + begin + Classify(self,PooledW, GrpMeans, ColNoSelected, NoSelected-1, NoCases, + GrpVar, NoGrps, NoInGrp, VarLabels); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + ClassIt(self,PooledW,ColNoSelected,GrpMeans,Roots,noroots, GrpVar, + NoGrps,NoInGrp,NoSelected-1,NoCases,RawCMat,Constants); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + + // print standardized discrim function coefficients + Title := 'Standardized Coeff. from Pooled Cov.'; + MAT_PRINT(CoefMat,NoSelected-1,noroots,Title,VarLabels,ColLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + + // Calculate centroids + for k := 1 to NoGrps do + begin + for i := 1 to noroots do + begin + for j := 1 to NoSelected - 1 do + begin + Centroids[k-1,i-1] := Centroids[k-1,i-1] + (RawCMat[j-1,i-1] * GrpMeans[k-1,j-1]); + end; + Centroids[k-1,i-1] := Centroids[k-1,i-1] + Constants[i-1]; + end; + end; + + if CentroidsChk.Checked then + begin + Title := 'Centroids'; + MAT_PRINT(Centroids,NoGrps,noroots,Title,GrpNos,ColLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + end; + + // Get variance-covariance matrix of functions (theta) + MATTRN(EigenTrans,EigenVectors,NoSelected-1,noroots); + MATAxB(TempMat,EigenTrans,TotalMat,noroots,NoSelected-1,NoSelected-1, + NoSelected-1,errorcode); + MATAxB(Theta,TempMat,EigenVectors,noroots,NoSelected-1,NoSelected-1, + noroots,errorcode); + + // Create a diagonal matrix with square roots of the Total covariance diagonal + for i := 1 to NoSelected - 1 do + begin + for j := 1 to NoSelected - 1 do + begin + if (i <> j) then DiagMat[i-1,j-1] := 0.0 + else DiagMat[i-1,j-1] := sqrt(TotalMat[i-1,j-1]); + end; + end; + + // Get recipricol of standard deviations of each function + for i := 1 to noroots do ScoreVar[i-1] := 1.0 / sqrt(Theta[i-1,i-1]); + + // Divide coefficients by score standard deviations + for i := 1 to NoSelected - 1 do + begin + for j := 1 to noroots do + begin + RawCMat[i-1,j-1] := EigenVectors[i-1,j-1] * ScoreVar[j-1]; + CoefMat[i-1,j-1] := RawCMat[i-1,j-1] * sqrt(TotalMat[i-1,i-1]); + end; + end; + + // print functions obtained from total matrix + Title := 'Raw Coefficients from Total Cov.'; + MAT_PRINT(RawCMat,NoSelected-1,noroots,Title,VarLabels,ColLabels,TotalCases); + Title := 'Raw Discriminant Function Constants'; + DynVectorPrint(Constants,noroots,Title,ColLabels,TotalCases); +// OutPutFrm.ShowModal; +// OutPutFrm.RichEdit.Clear(); + + // print std. disc coefficients from total matrix + Title := 'Standardized Coeff.s from Total Cov.'; + MAT_PRINT(CoefMat,NoSelected-1,noroots,Title,VarLabels,ColLabels,TotalCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + + // Get correlations from Total covariance matrix + for i := 1 to NoSelected - 1 do + for j := 1 to NoSelected - 1 do + TempMat[i-1,j-1] := TotalMat[i-1,j-1] / + (TotalStdDevs[i-1] * TotalStdDevs[j-1]); + + if CorrsChk.Checked then + begin + Title := 'Total Correlation Matrix'; + MAT_PRINT(TempMat,NoSelected-1,NoSelected-1,Title,VarLabels,VarLabels,TotalCases); +// OutPutFrm.ShowModal; +// OutPutFrm.RichEdit.Clear(); + end; + + // Obtain structure coefficients + MATAxB(Structure,TempMat,CoefMat,NoSelected-1,NoSelected-1,NoSelected-1,noroots,errorcode); + Title := 'Corr.s Between Variables and Functions'; + MAT_PRINT(Structure,NoSelected-1,noroots,Title,VarLabels,ColLabels,TotalCases); + + //Compute and print overall statistics for equal group centroids + n2 := (NoSelected-1) * (NoSelected-1); + k2 := (NoGrps-1) * (NoGrps-1); + num := (NoSelected-1) * (NoGrps - 1); + s := sqrt((n2 * k2 - 4) / (n2 + k2 - 5)); + v2 := (num - 2.0) / 2.0; + m := ((2 * TotalCases) - (NoSelected - 1) - NoGrps - 2) / 2.0; + den := m * s - v2; + L2 := Power(Lambda,1.0 / s); + F := ((1.0 - L2)/ L2) * (den / num); + Fprob := probf(F,num,den); + outline := format('Wilk''s Lambda = %10.4f.',[Lambda]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('F = %10.4f with D.F. %5.0f and %5.0f . Prob > F = %6.4f', + [F,num,den,Fprob]); + OutPutFrm.RichEdit.Lines.Add(outline); + dfchi := (NoSelected - 1) * noroots; + probchi := 1.0 - chisquaredprob(ChiSquare,dfchi); + outline := format('Bartlett Chi-Squared = %10.4f with %d D.F. and prob. = %6.4f', + [ChiSquare,dfchi,probchi]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Pillai Trace = %10.4f',[Pillia]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear(); + + // Clean up heap + ColNoSelected := nil; + NoInGrp := nil; + GrpNos := nil; + Centroids := nil; + GrpSDevs := nil; + GrpMeans := nil; + w := nil; + WithinStdDevs := nil; + WithinVariances := nil; + WithinMeans := nil; + TotalStdDevs := nil; + TotalVariances := nil; + TotalMeans := nil; + Pcnts := nil; + Roots := nil; + ScoreVar := nil; + Constants := nil; + Structure := nil; + RawCMat := nil; + CoefMat := nil; + DiagMat := nil; + Theta := nil; + TempMat := nil; + EigenTrans := nil; + EigenVectors := nil; + BetweenMat := nil; + TotalMat := nil; + PooledW := nil; + v := nil; + WinvB := nil; + WithinInv := nil; + WithinMat := nil; + CaseNo := nil; + ColLabels := nil; + VarLabels := nil; +end; + +procedure TDiscrimFrm.DepOutClick(Sender: TObject); +begin + VarList.Items.Add(GroupVar.Text); + GroupVar.Text := ''; + DepOut.Visible := false; + DepIn.Visible := true; +end; + +procedure TDiscrimFrm.PredInClick(Sender: TObject); +VAR i, index : integer; +begin + index := VarList.Items.Count; + i := 0; + while i < index do + begin + if (VarList.Selected[i]) then + begin + PredList.Items.Add(VarList.Items.Strings[i]); + VarList.Items.Delete(i); + index := index - 1; + i := 0; + end + else i := i + 1; + end; + PredOut.Visible := true; +end; + +procedure TDiscrimFrm.PredOutClick(Sender: TObject); +VAR index : integer; +begin + index := PredList.ItemIndex; + if index < 0 then + begin + PredOut.Visible := false; + exit; + end; + VarList.Items.Add(PredList.Items.Strings[index]); + PredList.Items.Delete(index); +end; + +procedure TDiscrimFrm.PlotPts(Sender: TObject; RawCMat: DblDyneMat; + Constants: DblDyneVec; ColNoSelected: IntDyneVec; NoSelected: integer; + noroots: integer; NoCases: integer; GrpVar: integer; NoGrps: integer; + NoInGrp: IntDyneVec); +var + i, j, k, m, grp, matrow, group : integer; + X, Y, XScore, YScore, temp : double; + Title, xTitle, yTitle : string; + xpts : DblDyneVec; + ypts : DblDyneVec; + +begin + SetLength(xpts,NoCases); + SetLength(ypts,NoCases); + SetLength(GraphFrm.Ypoints,1,NoCases); + SetLength(GraphFrm.Xpoints,1,NoCases); + if (noroots > 1) then + begin + for i := 1 to noroots - 1 do + begin + for j := i + 1 to noroots do + begin + for k := 1 to NoCases do + begin + XScore := 0.0; + YScore := 0.0; + for grp := 1 to NoGrps do + begin + if not GoodRecord(i,NoSelected,ColNoSelected) then continue; + group := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,k]))); + group := NoGrps - (MaxGrp - group); + if group = grp then + begin + XScore := Constants[i-1]; + YScore := Constants[j-1]; + for m := 1 to NoSelected do + begin + matrow := ColNoSelected[m-1]; + X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[matrow,k])); + X := X * RawCMat[m-1,i-1]; + XScore := XScore + X; + end; + for m := 1 to NoSelected do + begin + matrow := ColNoSelected[m-1]; + Y := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[matrow,k])); + Y := Y * RawCMat[m-1,j-1]; + YScore := YScore + Y; + end; + GraphFrm.PointLabels[k] := IntToStr(grp); + end; // if group = grp + end; // next group + xpts[k-1] := XScore; + ypts[k-1] := YScore; + end; // next case k + // sort into ascending X order + for k := 1 to NoCases - 1 do + begin + for m := k + 1 to NoCases do + begin + if xpts[k-1] > xpts[m-1] then + begin + temp := xpts[k-1]; + xpts[k-1] := xpts[m-1]; + xpts[m-1] := temp; + temp := ypts[k-1]; + ypts[k-1] := ypts[m-1]; + ypts[m-1] := temp; + end; + end; + end; + for k := 1 to NoCases do + begin + GraphFrm.Ypoints[0,k-1] := ypts[k-1]; + GraphFrm.Xpoints[0,k-1] := xpts[k-1]; + end; + GraphFrm.nosets := 1; + GraphFrm.nbars := NoCases; + GraphFrm.Heading := 'CASES IN THE DISCRIMINANT SPACE'; + GraphFrm.XTitle := 'Function ' + IntToStr(i); + GraphFrm.YTitle := 'Function ' + IntToStr(j); +// GraphFrm.Ypoints[1] := ypts; +// GraphFrm.Xpoints[1] := xpts; + GraphFrm.AutoScale := true; + GraphFrm.PtLabels := true; + GraphFrm.GraphType := 7; // 2d points + GraphFrm.BackColor := clYellow; + GraphFrm.ShowBackWall := true; + GraphFrm.ShowModal; + end; // next i + end; // next j + end; // if noroots > 1 + ypts := nil; + xpts := nil; + GraphFrm.Xpoints := nil; + GraphFrm.Ypoints := nil; +end; + +procedure TDiscrimFrm.Classify(Sender: TObject; PooledW: DblDyneMat; + GrpMeans: DblDyneMat; ColNoSelected: IntDyneVec; NoSelected: integer; + NoCases: integer; GrpVar: integer; NoGrps: integer; NoInGrp: IntDyneVec; + VarLabels: StrDyneVec); +var + i, j, k, grp : integer; + outline : string; + Constant, T : DblDyneVec; + S : double; + Coeff, WithinInv : DblDyneMat; + +begin +// SetLength(NoInGrp,NoGrps); + SetLength(T,NoSelected); + SetLength(Coeff,NoGrps,NoSelected); + SetLength(WithinInv,NoSelected,NoSelected); + SetLength(Constant,NoGrps); + + // Get inverse of pooled within variance-covariance matrix + for i := 0 to NoSelected-1 do + for j := 0 to NoSelected-1 do + WithinInv[i,j] := PooledW[i,j]; + SVDinverse(WithinInv,NoSelected); + + // Get Fisher Discrim Functions and probabilities + OutPutFrm.RichEdit.Lines.Add('Fisher Discriminant Functions'); + for grp := 0 to NoGrps-1 do + begin + Constant[grp] := 0.0; + S := 0.0; + for j := 0 to NoSelected-1 do + for k := 0 to NoSelected-1 do + S := S + WithinInv[j,k] * GrpMeans[grp,j] * GrpMeans[grp,k]; + Constant[grp] := -S / 2.0; + for j := 0 to NoSelected-1 do + begin + T[j] := 0.0; + for k := 0 to NoSelected-1 do + T[j] := T[j] + WithinInv[j,k] * GrpMeans[grp,k]; + end; + for j := 0 to NoSelected-1 do Coeff[grp,j] := T[j]; + outline := format('Group %3d Constant := %6.3f',[grp+1,Constant[grp]]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add('Variable Coefficient'); + for i := 0 to NoSelected-1 do + begin + outline := format(' %3d %6.3f',[i+1,T[i]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + end; // next group + + // clean up the heap + Constant := nil; + WithinInv := nil; + Coeff := nil; + T := nil; +// NoInGrp := nil; +end; + +procedure TDiscrimFrm.ClassIt(Sender: TObject; PooledW: DblDyneMat; + ColNoSelected: IntDyneVec; GrpMeans: DblDyneMat; Roots: DblDyneVec; + noroots: integer; GrpVar : integer; NoGrps: integer; NoInGrp: IntDyneVec; + NoSelected: integer; NoCases: integer; RawCmat: DblDyneMat; + Constants: DblDyneVec); +var + i, j, k, grp, j1, InGrp, Largest, SecdLarge, oldcolcnt, linecount : integer; + numberstr, prompt, outline, cellname : string; + Table : IntDyneMat; + ProdVec, Dev, D2, Density, ProbGrp, Apriori, Discrim : DblDyneVec; + SumD2, Determinant, LargestProb, SecdProb, X : double; + RowLabels, ColLabels : StrDyneVec; + WithinInv : DblDyneMat; + col : integer; + +begin + SumD2 := 0.0; + oldcolcnt := NoVariables; + SetLength(Table,NoGrps+1,NoGrps+1); + SetLength(ProdVec,NoSelected); + SetLength(Dev,NoSelected); + SetLength(D2,NoGrps); + SetLength(Density,NoGrps); + SetLength(ProbGrp,NoGrps); + SetLength(Apriori,NoGrps); + SetLength(Discrim,noroots); + SetLength(RowLabels,NoGrps+1); + SetLength(ColLabels,NoGrps+1); + SetLength(WithinInv,NoSelected,NoSelected); + + // Does user want to save scores? If yes, add columns to grid + if ScoresChk.Checked then + begin + //Add grid headings for discrim scores + for j := 1 to noroots do + begin + cellname := 'Disc '; + cellname := cellname + IntToStr(j); + col := oldcolcnt + j; + DictionaryFrm.newvar(col); + DictionaryFrm.DictGrid.Cells[1,col] := cellname; + OS3MainFrm.DataGrid.Cells[col,0] := cellname; +// NoVariables := NoVariables + 1; + end; + end; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + + // Initialize arrays that need it + for i := 1 to NoSelected do ProdVec[i-1] := 0.0; + for i := 1 to NoGrps do D2[i-1] := 0.0; + for i := 1 to NoGrps + 1 do + for j := 1 to NoGrps + 1 do Table[i-1,j-1] := 0; + + // Get inverse of pooled within variance-covariance matrix + for i := 1 to NoSelected do + for j := 1 to NoSelected do + WithinInv[i-1,j-1] := PooledW[i-1,j-1]; + SVDinverse(WithinInv,NoSelected); + + // Calculate determinant (product of roots) + Determinant := 1.0; + for i := 1 to noroots do Determinant := Determinant * Roots[i-1]; + + linecount := 0; + // Print Heading + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add(''); + outline := 'CLASSIFICATION OF CASES'; + OutPutFrm.RichEdit.Lines.Add(outline); + outline := 'SUBJECT ACTUAL HIGH PROBABILITY SEC.D HIGH DISCRIM'; + OutPutFrm.RichEdit.Lines.Add(outline); + outline := 'ID NO. GROUP IN GROUP P(G/D) GROUP P(G/D) SCORE'; + OutPutFrm.RichEdit.Lines.Add(outline); + linecount := linecount + 4; + + //Get selected priors + // Default priors are equal proportions + for j := 1 to NoGrps do Apriori[j-1] := 1.0 / NoGrps; + if ClassSize.ItemIndex = 1 then + begin + // Get apriori probabilities + for j := 1 to NoGrps do + Apriori[j-1] := NoInGrp[j-1] / NoCases; + end; + if ClassSize.ItemIndex = 2 then // get apriori sizes + begin + for j := 1 to NoGrps do + begin + prompt := 'Group ' + IntToStr(j); + outline := FloatToStr(Apriori[j-1]); + numberstr := InputBox('GROUP PROPORTION:',prompt,outline); + Apriori[j-1] := StrToFloat(numberstr); + end; + end; + + // Calculate group probabilities for each case + for i := 1 to NoCases do + begin + if (linecount >= 59) then + begin + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + linecount := 0; + end; + if (not GoodRecord(i,NoSelected,ColNoSelected))then continue; + InGrp := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[GrpVar,i]))); + InGrp := NoGrps - (MaxGrp - InGrp); + for grp := 1 to NoGrps do // group loop + begin + for j := 1 to NoSelected do ProdVec[j-1] := 0.0; + D2[grp-1] := 0.0; + for j := 1 to NoSelected do // variables loop + begin + X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[ColNoSelected[j-1],i])); + Dev[j-1] := X - GrpMeans[grp-1,j-1]; + end; + // Get squared distance as [X - M]' * inv[S] * [X - M] + for j := 1 to NoSelected do // deviation * S inverse + for k := 1 to NoSelected do + ProdVec[j-1] := ProdVec[j-1] + (Dev[k-1] * WithinInv[k-1,j-1]); + for j := 1 to NoSelected do // Product * deviation + D2[grp-1] := D2[grp-1] + Dev[j-1] * ProdVec[j-1]; // distance from group + D2[grp-1] := D2[grp-1] - 2.0 * ln(Apriori[grp-1]); ///generalized distance + SumD2 := SumD2 + exp(-0.5 * D2[grp-1]); + end; // end of group loop + for j := 1 to NoGrps do + ProbGrp[j-1] := exp(-0.5 * D2[j-1]) / SumD2; + + // Get Discrim functions + for j := 1 to noroots do Discrim[j-1] := 0.0; + for j := 1 to NoSelected do // variables loop + begin + X := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[ColNoSelected[j-1],i])); + for j1 := 1 to noroots do + Discrim[j1-1] := Discrim[j1-1] + (X * RawCmat[j-1,j1-1]); + end; + for j := 1 to noroots do Discrim[j-1] := Discrim[j-1] + Constants[j-1]; + + // Does user want to save Discrim scores in grid? + if ScoresChk.Checked then + begin + for j := 1 to noroots do + begin + numberstr := format('%8.3f',[Discrim[j-1]]); + OS3MainFrm.DataGrid.Cells[oldcolcnt+j,i] := numberstr; + end; + end; + + // Get largest and next largest group probabilities + Largest := 1; + LargestProb := ProbGrp[0]; + for grp := 2 to NoGrps do + begin + if (ProbGrp[grp-1] > LargestProb) then + begin + Largest := grp; + LargestProb := ProbGrp[grp-1]; + end; + end; + + ProbGrp[Largest-1] := 0.0; + SecdLarge := 1; + SecdProb := ProbGrp[0]; + for grp := 2 to NoGrps do + begin + if (ProbGrp[grp-1] > SecdProb) then + begin + SecdLarge := grp; + SecdProb := ProbGrp[grp-1]; + end; + end; + + // Print results for this case i + outline := format('%3d %3d %3d %6.4f %3d %6.4f %7.4f', + [i,InGrp,Largest,LargestProb,SecdLarge,SecdProb, + Discrim[0]]); + OutPutFrm.RichEdit.Lines.Add(outline); + linecount := linecount + 1; + for j := 2 to noroots do + begin + outline := format(' %7.4f', + [Discrim[j-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + linecount := linecount + 1; + end; + Table[InGrp-1,Largest-1] := Table[InGrp-1,Largest-1] + 1; + // initialize variables for next case + SumD2 := 0.0; + end; // end of case loop i + + // Get table column and row totals + for i := 1 to NoGrps do // table rows + for j := 1 to NoGrps do Table[i-1,NoGrps] := Table[i-1,NoGrps] + Table[i-1,j-1]; + for j := 1 to NoGrps do // table columns + for i := 1 to NoGrps do Table[NoGrps,j-1] := Table[NoGrps,j-1] + Table[i-1,j-1]; + Table[NoGrps,NoGrps] := NoCases; + + if (linecount > 0) then + begin + OutPutFrm.ShowModal(); + OutPutFrm.RichEdit.Clear; + end; + // Print table of classifications + for i := 1 to NoGrps + 1 do + begin + RowLabels[i-1] := IntToStr(i); + ColLabels[i-1] := IntToStr(i); + end; + RowLabels[NoGrps] := 'TOTAL'; + ColLabels[NoGrps] := 'TOTAL'; + IntArrayPrint(Table, NoGrps+1,NoGrps+1, 'PREDICTED GROUP', + RowLabels, ColLabels, 'CLASSIFICATION TABLE'); + + // Clean up the heap + WithinInv := nil; + ColLabels := nil; + RowLabels := nil; + Discrim := nil; + Apriori := nil; + ProbGrp := nil; + Density := nil; + D2 := nil; + Dev := nil; + ProdVec := nil; + Table := nil; +end; + +initialization + {$I discrimunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/DISCRIMUNIT.lfm b/applications/lazstats/source_orig/DISCRIMUNIT.lfm new file mode 100644 index 000000000..4d87dc5e3 --- /dev/null +++ b/applications/lazstats/source_orig/DISCRIMUNIT.lfm @@ -0,0 +1,406 @@ +object DiscrimFrm: TDiscrimFrm + Left = 152 + Height = 415 + Top = 93 + Width = 560 + Caption = 'Discriminant Function and Multivariate Analysis of Variance' + ClientHeight = 415 + ClientWidth = 560 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 6 + Height = 14 + Top = 2 + Width = 85 + Caption = 'Available Variable' + ParentColor = False + end + object Label2: TLabel + Left = 225 + Height = 14 + Top = 16 + Width = 71 + Caption = 'Group Variable' + ParentColor = False + end + object Label3: TLabel + Left = 225 + Height = 14 + Top = 104 + Width = 90 + Caption = 'Predictor Variables' + ParentColor = False + end + object VarList: TListBox + Left = 6 + Height = 288 + Top = 17 + Width = 165 + ItemHeight = 0 + MultiSelect = True + TabOrder = 0 + end + object DepIn: TBitBtn + Left = 184 + Height = 31 + Top = 17 + Width = 33 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE + 6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580 + 3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3 + 71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7 + 74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7 + 74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = DepInClick + TabOrder = 1 + end + object DepOut: TBitBtn + Left = 184 + Height = 31 + Top = 56 + Width = 33 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580 + 3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3 + 71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7 + 74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF + FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = DepOutClick + TabOrder = 2 + end + object PredIn: TBitBtn + Left = 184 + Height = 31 + Top = 128 + Width = 33 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE + 6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580 + 3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3 + 71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7 + 74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7 + 74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = PredInClick + TabOrder = 3 + end + object PredOut: TBitBtn + Left = 184 + Height = 31 + Top = 168 + Width = 33 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580 + 3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3 + 71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7 + 74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF + FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = PredOutClick + TabOrder = 4 + end + object GroupVar: TEdit + Left = 225 + Height = 21 + Top = 36 + Width = 136 + TabOrder = 5 + Text = 'GroupVar' + end + object PredList: TListBox + Left = 223 + Height = 182 + Top = 120 + Width = 139 + ItemHeight = 0 + TabOrder = 6 + end + object GroupBox1: TGroupBox + Left = 377 + Height = 294 + Top = 6 + Width = 174 + Caption = 'Options' + ClientHeight = 276 + ClientWidth = 170 + TabOrder = 7 + object DescChk: TCheckBox + Left = 6 + Height = 17 + Top = 1 + Width = 119 + Caption = 'Descriptive Statistics' + TabOrder = 0 + end + object CorrsChk: TCheckBox + Left = 7 + Height = 17 + Top = 22 + Width = 78 + Caption = 'Correlations' + TabOrder = 1 + end + object InvChk: TCheckBox + Left = 6 + Height = 17 + Top = 44 + Width = 95 + Caption = 'Matrix Inverses' + TabOrder = 2 + end + object PlotChk: TCheckBox + Left = 6 + Height = 17 + Top = 65 + Width = 73 + Caption = 'Plot Scores' + TabOrder = 3 + end + object ClassChk: TCheckBox + Left = 6 + Height = 17 + Top = 88 + Width = 92 + Caption = 'Classify Scores' + TabOrder = 4 + end + object AnovaChk: TCheckBox + Left = 6 + Height = 17 + Top = 110 + Width = 109 + Caption = 'One-Way ANOVAs' + TabOrder = 5 + end + object CrossChk: TCheckBox + Left = 6 + Height = 17 + Top = 130 + Width = 93 + Caption = 'Cross-Products' + TabOrder = 6 + end + object DevCPChk: TCheckBox + Left = 6 + Height = 17 + Top = 152 + Width = 141 + Caption = 'Deviation Cross-Products' + TabOrder = 7 + end + object EigensChk: TCheckBox + Left = 6 + Height = 17 + Top = 175 + Width = 85 + Caption = 'Eigen Vectors' + TabOrder = 8 + end + object PCovChk: TCheckBox + Left = 7 + Height = 17 + Top = 194 + Width = 142 + Caption = 'Pooled Within Covariance' + TabOrder = 9 + end + object CentroidsChk: TCheckBox + Left = 7 + Height = 17 + Top = 218 + Width = 66 + Caption = 'Centroids' + TabOrder = 10 + end + object ScoresChk: TCheckBox + Left = 7 + Height = 17 + Top = 242 + Width = 106 + Caption = 'Scores to the Grid' + TabOrder = 11 + end + end + object ClassSize: TRadioGroup + Left = 377 + Height = 94 + Top = 310 + Width = 172 + AutoFill = True + Caption = 'Classify Using:' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + ClientHeight = 76 + ClientWidth = 168 + Items.Strings = ( + 'Equal Group Sizes' + 'Existing Sample Sizes' + 'Entered Prior Sizes' + ) + TabOrder = 8 + end + object ResetBtn: TButton + Left = 27 + Height = 28 + Top = 328 + Width = 64 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 9 + end + object CancelBtn: TButton + Left = 107 + Height = 28 + Top = 328 + Width = 64 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 10 + end + object ComputeBtn: TButton + Left = 216 + Height = 28 + Top = 328 + Width = 64 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 11 + end + object ReturnBtn: TButton + Left = 296 + Height = 28 + Top = 328 + Width = 64 + Caption = 'Return' + ModalResult = 1 + TabOrder = 12 + end +end diff --git a/applications/lazstats/source_orig/DISCRIMUNIT.lrs b/applications/lazstats/source_orig/DISCRIMUNIT.lrs new file mode 100644 index 000000000..d6b38d57a --- /dev/null +++ b/applications/lazstats/source_orig/DISCRIMUNIT.lrs @@ -0,0 +1,264 @@ +LazarusResources.Add('TDiscrimFrm','FORMDATA',[ + 'TPF0'#11'TDiscrimFrm'#10'DiscrimFrm'#4'Left'#3#152#0#6'Height'#3#159#1#3'Top' + +#2']'#5'Width'#3'0'#2#7'Caption'#6';Discriminant Function and Multivariate A' + +'nalysis of Variance'#12'ClientHeight'#3#159#1#11'ClientWidth'#3'0'#2#6'OnSh' + +'ow'#7#8'FormShow'#10'LCLVersion'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left' + +#2#6#6'Height'#2#14#3'Top'#2#2#5'Width'#2'U'#7'Caption'#6#18'Available Varia' + +'ble'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#3#225#0#6'Height'#2 + +#14#3'Top'#2#16#5'Width'#2'G'#7'Caption'#6#14'Group Variable'#11'ParentColor' + +#8#0#0#6'TLabel'#6'Label3'#4'Left'#3#225#0#6'Height'#2#14#3'Top'#2'h'#5'Widt' + +'h'#2'Z'#7'Caption'#6#19'Predictor Variables'#11'ParentColor'#8#0#0#8'TListB' + +'ox'#7'VarList'#4'Left'#2#6#6'Height'#3' '#1#3'Top'#2#17#5'Width'#3#165#0#10 + +'ItemHeight'#2#0#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'DepIn'#4 + +'Left'#3#184#0#6'Height'#2#31#3'Top'#2#17#5'Width'#2'!'#10'Glyph.Data'#10':' + +#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' ' + +#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^ '#6 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177'b' + +#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5' + +#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255#0 + +#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255 + +#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142 + +#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J' + +#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162 + +#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255 + +#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130 + +#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199 + +'t'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255 + +'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5' + +#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10'DepInClick'#8 + +'TabOrder'#2#1#0#0#7'TBitBtn'#6'DepOut'#4'Left'#3#184#0#6'Height'#2#31#3'Top' + +#2'8'#5'Width'#2'!'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6' + ,#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0 + +#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G'#153 + +'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161'V' + +#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131#255 + +'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5' + +#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e'#195 + +'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255#144 + +#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255 + +'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255#255 + +#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154#212 + +#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133 + +#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255#255 + +#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201#135 + +#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A' + +#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyp' + +'hs'#2#0#7'OnClick'#7#11'DepOutClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#6'PredI' + +'n'#4'Left'#3#184#0#6'Height'#2#31#3'Top'#3#128#0#5'Width'#2'!'#10'Glyph.Dat' + +'a'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0 + +#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + ,#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184 + +#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177 + +'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255 + +'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255 + +#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255 + +#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142 + +#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J' + +#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162 + +#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255 + +#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130 + +#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199 + +'t'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255 + +'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5' + +#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'PredInClick'#8 + +'TabOrder'#2#3#0#0#7'TBitBtn'#7'PredOut'#4'Left'#3#184#0#6'Height'#2#31#3'To' + +'p'#3#168#0#5'Width'#2'!'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0 + +#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd' + +#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G' + +#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161 + +'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131 + +#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/' + +'x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e' + +#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255 + +#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132 + +#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255 + ,#255#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154 + +#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255 + +#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255 + +#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201 + +#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O' + +#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'Num' + +'Glyphs'#2#0#7'OnClick'#7#12'PredOutClick'#8'TabOrder'#2#4#0#0#5'TEdit'#8'Gr' + +'oupVar'#4'Left'#3#225#0#6'Height'#2#21#3'Top'#2'$'#5'Width'#3#136#0#8'TabOr' + +'der'#2#5#4'Text'#6#8'GroupVar'#0#0#8'TListBox'#8'PredList'#4'Left'#3#223#0#6 + +'Height'#3#182#0#3'Top'#2'x'#5'Width'#3#139#0#10'ItemHeight'#2#0#8'TabOrder' + +#2#6#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#3'y'#1#6'Height'#3'&'#1#3'Top'#2#6 + +#5'Width'#3#174#0#7'Caption'#6#7'Options'#12'ClientHeight'#3#20#1#11'ClientW' + +'idth'#3#170#0#8'TabOrder'#2#7#0#9'TCheckBox'#7'DescChk'#4'Left'#2#6#6'Heigh' + +'t'#2#17#3'Top'#2#1#5'Width'#2'w'#7'Caption'#6#22'Descriptive Statistics'#8 + +'TabOrder'#2#0#0#0#9'TCheckBox'#8'CorrsChk'#4'Left'#2#7#6'Height'#2#17#3'Top' + +#2#22#5'Width'#2'N'#7'Caption'#6#12'Correlations'#8'TabOrder'#2#1#0#0#9'TChe' + +'ckBox'#6'InvChk'#4'Left'#2#6#6'Height'#2#17#3'Top'#2','#5'Width'#2'_'#7'Cap' + +'tion'#6#15'Matrix Inverses'#8'TabOrder'#2#2#0#0#9'TCheckBox'#7'PlotChk'#4'L' + +'eft'#2#6#6'Height'#2#17#3'Top'#2'A'#5'Width'#2'I'#7'Caption'#6#11'Plot Scor' + +'es'#8'TabOrder'#2#3#0#0#9'TCheckBox'#8'ClassChk'#4'Left'#2#6#6'Height'#2#17 + +#3'Top'#2'X'#5'Width'#2'\'#7'Caption'#6#15'Classify Scores'#8'TabOrder'#2#4#0 + +#0#9'TCheckBox'#8'AnovaChk'#4'Left'#2#6#6'Height'#2#17#3'Top'#2'n'#5'Width'#2 + +'m'#7'Caption'#6#14'One-Way ANOVAs'#8'TabOrder'#2#5#0#0#9'TCheckBox'#8'Cross' + +'Chk'#4'Left'#2#6#6'Height'#2#17#3'Top'#3#130#0#5'Width'#2']'#7'Caption'#6#14 + +'Cross-Products'#8'TabOrder'#2#6#0#0#9'TCheckBox'#8'DevCPChk'#4'Left'#2#6#6 + +'Height'#2#17#3'Top'#3#152#0#5'Width'#3#141#0#7'Caption'#6#24'Deviation Cros' + +'s-Products'#8'TabOrder'#2#7#0#0#9'TCheckBox'#9'EigensChk'#4'Left'#2#6#6'Hei' + +'ght'#2#17#3'Top'#3#175#0#5'Width'#2'U'#7'Caption'#6#13'Eigen Vectors'#8'Tab' + +'Order'#2#8#0#0#9'TCheckBox'#7'PCovChk'#4'Left'#2#7#6'Height'#2#17#3'Top'#3 + +#194#0#5'Width'#3#142#0#7'Caption'#6#24'Pooled Within Covariance'#8'TabOrder' + +#2#9#0#0#9'TCheckBox'#12'CentroidsChk'#4'Left'#2#7#6'Height'#2#17#3'Top'#3 + +#218#0#5'Width'#2'B'#7'Caption'#6#9'Centroids'#8'TabOrder'#2#10#0#0#9'TCheck' + +'Box'#9'ScoresChk'#4'Left'#2#7#6'Height'#2#17#3'Top'#3#242#0#5'Width'#2'j'#7 + +'Caption'#6#18'Scores to the Grid'#8'TabOrder'#2#11#0#0#0#11'TRadioGroup'#9 + +'ClassSize'#4'Left'#3'y'#1#6'Height'#2'^'#3'Top'#3'6'#1#5'Width'#3#172#0#8'A' + +'utoFill'#9#7'Caption'#6#15'Classify Using:'#28'ChildSizing.LeftRightSpacing' + +#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7 + +#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomoge' + +'nousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'C' + +'hildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29 + +'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'Clien' + +'tHeight'#2'L'#11'ClientWidth'#3#168#0#13'Items.Strings'#1#6#17'Equal Group ' + +'Sizes'#6#21'Existing Sample Sizes'#6#19'Entered Prior Sizes'#0#8'TabOrder'#2 + +#8#0#0#7'TButton'#8'ResetBtn'#4'Left'#2#27#6'Height'#2#28#3'Top'#3'H'#1#5'Wi' + +'dth'#2'@'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2 + +#9#0#0#7'TButton'#9'CancelBtn'#4'Left'#2'k'#6'Height'#2#28#3'Top'#3'H'#1#5'W' + ,'idth'#2'@'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#10#0#0#7 + +'TButton'#10'ComputeBtn'#4'Left'#3#216#0#6'Height'#2#28#3'Top'#3'H'#1#5'Widt' + +'h'#2'@'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder' + +#2#11#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3'('#1#6'Height'#2#28#3'Top'#3'H'#1 + +#5'Width'#2'@'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#12#0 + +#0#0 +]); diff --git a/applications/lazstats/source_orig/DISTRIBUNIT.lfm b/applications/lazstats/source_orig/DISTRIBUNIT.lfm new file mode 100644 index 000000000..105dc782b --- /dev/null +++ b/applications/lazstats/source_orig/DISTRIBUNIT.lfm @@ -0,0 +1,158 @@ +object DistribFrm: TDistribFrm + Left = 183 + Height = 286 + Top = 110 + Width = 323 + Caption = 'Distributions' + ClientHeight = 286 + ClientWidth = 323 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object GroupBox1: TGroupBox + Left = 8 + Height = 96 + Top = 8 + Width = 208 + Caption = 'Plot Distribution:' + ClientHeight = 78 + ClientWidth = 204 + TabOrder = 0 + object NDChk: TCheckBox + Left = 9 + Height = 17 + Top = 2 + Width = 110 + Caption = 'Normal Distribution' + OnClick = NDChkClick + TabOrder = 0 + end + object ChiChk: TCheckBox + Left = 9 + Height = 17 + Top = 24 + Width = 130 + Caption = 'Chi-Square Distribution' + OnClick = ChiChkClick + TabOrder = 1 + end + object FChk: TCheckBox + Left = 9 + Height = 17 + Top = 49 + Width = 121 + Caption = 'Central F Distribution' + OnClick = FChkClick + TabOrder = 2 + end + end + object GroupBox2: TGroupBox + Left = 8 + Height = 152 + Top = 120 + Width = 208 + Caption = 'Parameters' + ClientHeight = 134 + ClientWidth = 204 + TabOrder = 1 + object AlphaLabel: TLabel + Left = 8 + Height = 14 + Top = 15 + Width = 85 + Caption = 'Type I Error Rate' + ParentColor = False + end + object Label2: TLabel + Left = 8 + Height = 14 + Top = 46 + Width = 86 + Caption = 'Deg. Freedom (1)' + ParentColor = False + end + object Label3: TLabel + Left = 9 + Height = 14 + Top = 81 + Width = 86 + Caption = 'Deg. Freedom (2)' + ParentColor = False + end + object Label4: TLabel + Left = 8 + Height = 14 + Top = 111 + Width = 27 + Caption = 'Mean' + ParentColor = False + end + object AlphaEdit: TEdit + Left = 102 + Height = 21 + Top = 8 + Width = 43 + TabOrder = 0 + Text = 'AlphaEdit' + end + object DF1Edit: TEdit + Left = 102 + Height = 21 + Top = 39 + Width = 43 + TabOrder = 1 + Text = 'Edit1' + end + object MeanEdit: TEdit + Left = 102 + Height = 21 + Top = 104 + Width = 43 + TabOrder = 2 + Text = 'Edit1' + end + object DF2Edit: TEdit + Left = 102 + Height = 21 + Top = 72 + Width = 43 + TabOrder = 3 + Text = 'Edit1' + end + end + object ResetBtn: TButton + Left = 232 + Height = 29 + Top = 23 + Width = 71 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 2 + end + object CancelBtn: TButton + Left = 232 + Height = 29 + Top = 88 + Width = 71 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 3 + end + object ComputeBtn: TButton + Left = 232 + Height = 29 + Top = 152 + Width = 71 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 4 + end + object ReturnBtn: TButton + Left = 232 + Height = 29 + Top = 216 + Width = 71 + Caption = 'Return' + ModalResult = 1 + TabOrder = 5 + end +end diff --git a/applications/lazstats/source_orig/DISTRIBUNIT.lrs b/applications/lazstats/source_orig/DISTRIBUNIT.lrs new file mode 100644 index 000000000..5b6d835a3 --- /dev/null +++ b/applications/lazstats/source_orig/DISTRIBUNIT.lrs @@ -0,0 +1,38 @@ +LazarusResources.Add('TDistribFrm','FORMDATA',[ + 'TPF0'#11'TDistribFrm'#10'DistribFrm'#4'Left'#3#183#0#6'Height'#3#30#1#3'Top' + +#2'n'#5'Width'#3'C'#1#7'Caption'#6#13'Distributions'#12'ClientHeight'#3#30#1 + +#11'ClientWidth'#3'C'#1#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8'0.9.28.2' + +#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#8#6'Height'#2'`'#3'Top'#2#8#5'Width'#3 + +#208#0#7'Caption'#6#18'Plot Distribution:'#12'ClientHeight'#2'N'#11'ClientWi' + +'dth'#3#204#0#8'TabOrder'#2#0#0#9'TCheckBox'#5'NDChk'#4'Left'#2#9#6'Height'#2 + +#17#3'Top'#2#2#5'Width'#2'n'#7'Caption'#6#19'Normal Distribution'#7'OnClick' + +#7#10'NDChkClick'#8'TabOrder'#2#0#0#0#9'TCheckBox'#6'ChiChk'#4'Left'#2#9#6'H' + +'eight'#2#17#3'Top'#2#24#5'Width'#3#130#0#7'Caption'#6#23'Chi-Square Distrib' + +'ution'#7'OnClick'#7#11'ChiChkClick'#8'TabOrder'#2#1#0#0#9'TCheckBox'#4'FChk' + +#4'Left'#2#9#6'Height'#2#17#3'Top'#2'1'#5'Width'#2'y'#7'Caption'#6#22'Centra' + +'l F Distribution'#7'OnClick'#7#9'FChkClick'#8'TabOrder'#2#2#0#0#0#9'TGroupB' + +'ox'#9'GroupBox2'#4'Left'#2#8#6'Height'#3#152#0#3'Top'#2'x'#5'Width'#3#208#0 + +#7'Caption'#6#10'Parameters'#12'ClientHeight'#3#134#0#11'ClientWidth'#3#204#0 + +#8'TabOrder'#2#1#0#6'TLabel'#10'AlphaLabel'#4'Left'#2#8#6'Height'#2#14#3'Top' + +#2#15#5'Width'#2'U'#7'Caption'#6#17'Type I Error Rate'#11'ParentColor'#8#0#0 + +#6'TLabel'#6'Label2'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'.'#5'Width'#2'V'#7 + +'Caption'#6#16'Deg. Freedom (1)'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4 + +'Left'#2#9#6'Height'#2#14#3'Top'#2'Q'#5'Width'#2'V'#7'Caption'#6#16'Deg. Fre' + +'edom (2)'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#2#8#6'Height'#2 + +#14#3'Top'#2'o'#5'Width'#2#27#7'Caption'#6#4'Mean'#11'ParentColor'#8#0#0#5'T' + +'Edit'#9'AlphaEdit'#4'Left'#2'f'#6'Height'#2#21#3'Top'#2#8#5'Width'#2'+'#8'T' + +'abOrder'#2#0#4'Text'#6#9'AlphaEdit'#0#0#5'TEdit'#7'DF1Edit'#4'Left'#2'f'#6 + +'Height'#2#21#3'Top'#2''''#5'Width'#2'+'#8'TabOrder'#2#1#4'Text'#6#5'Edit1'#0 + +#0#5'TEdit'#8'MeanEdit'#4'Left'#2'f'#6'Height'#2#21#3'Top'#2'h'#5'Width'#2'+' + +#8'TabOrder'#2#2#4'Text'#6#5'Edit1'#0#0#5'TEdit'#7'DF2Edit'#4'Left'#2'f'#6'H' + +'eight'#2#21#3'Top'#2'H'#5'Width'#2'+'#8'TabOrder'#2#3#4'Text'#6#5'Edit1'#0#0 + +#0#7'TButton'#8'ResetBtn'#4'Left'#3#232#0#6'Height'#2#29#3'Top'#2#23#5'Width' + +#2'G'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#2#0 + +#0#7'TButton'#9'CancelBtn'#4'Left'#3#232#0#6'Height'#2#29#3'Top'#2'X'#5'Widt' + +'h'#2'G'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#3#0#0#7'TB' + +'utton'#10'ComputeBtn'#4'Left'#3#232#0#6'Height'#2#29#3'Top'#3#152#0#5'Width' + +#2'G'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2 + +#4#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#232#0#6'Height'#2#29#3'Top'#3#216#0 + +#5'Width'#2'G'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#5#0#0 + +#0 +]); diff --git a/applications/lazstats/source_orig/dataprocs.pas b/applications/lazstats/source_orig/dataprocs.pas new file mode 100644 index 000000000..e7c6d10c2 --- /dev/null +++ b/applications/lazstats/source_orig/dataprocs.pas @@ -0,0 +1,1715 @@ +unit DataProcs; + +{$mode objfpc}{$H+} + +interface + +uses + FileUtil, LResources, Forms, Controls, Graphics, Dialogs, OutPutUnit, + StdCtrls, ExtCtrls,Globals, OptionsUnit, DictionaryUnit, clipbrd, + Classes, SysUtils; + +Function GoodRecord(Row, NoVars : integer; VAR GridPos : IntDyneVec): boolean; +procedure FormatCell(Col, Row : integer); +procedure FormatGrid; +function IsNumeric(s : string) : boolean; +procedure VecPrint(vector : IntDyneVec; Size : integer; Heading : string); +procedure SaveOS2File; +procedure OpenOS2File; +procedure DeleteCol; +procedure CopyColumn; +procedure PasteColumn; +procedure InsertCol; +procedure InsertRow; +procedure CutaRow; +procedure CopyaRow; +procedure PasteaRow; +procedure PrintDict; +procedure PrintData; +procedure OpenTabFile; +procedure SaveTabFile; +function ValidValue(row, col : integer) : boolean; +function IsFiltered(GridRow : integer) : boolean; +procedure MATREAD(VAR a : DblDyneMat; + VAR norows : integer; + VAR nocols : integer; + VAR means : DblDyneVec; + VAR stddevs : DblDyneVec; + VAR NCases : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec; + filename : string); +procedure MATSAVE(VAR a : DblDyneMat; + norows : integer; + nocols : integer; + VAR means : DblDyneVec; + VAR stddevs : DblDyneVec; + NCases : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec; + filename : string); +procedure ReOpen(filename : string); +procedure OpenCommaFile; +procedure SaveCommaFile; +procedure OpenSpaceFile; +procedure SaveSpaceFile; +procedure OpenOSData; +procedure ClearGrid; +procedure CopyIt; +procedure PasteIt; +procedure RowColSwap; +procedure MatToGrid(VAR mat : DblDyneMat; nsize : integer); +procedure GetTypes; +function StringsToInt(strcol : integer; VAR newcol : integer; prompt : boolean) : boolean; +implementation + +uses MainUnit; + +Function GoodRecord(Row, NoVars : integer; VAR GridPos : IntDyneVec): boolean; +var + i, j : integer; + isgood : boolean; + +begin + isgood := true; + for i := 1 to NoVars do + begin + j := GridPos[i-1]; + if NOT ValidValue(Row,j) then isgood := false; + end; + Result := isgood; +end; +//------------------------------------------------------------------- + +procedure FormatCell(Col, Row : integer); +var + VarType : char; + NoDec : integer; + Justify : char; + missing : string; + astr : string; + cellstr : string; + newcell : string; + X : double; + Width : integer; + cellsize : integer; + +begin + if OS3MainFrm.DataGrid.Cells[Col,Row] = '' then exit; + Width := StrToInt(DictionaryFrm.DictGrid.Cells[3,Col]); + astr := DictionaryFrm.DictGrid.Cells[4,Col]; + VarType := astr[1]; + NoDec := StrToInt(DictionaryFrm.DictGrid.Cells[5,Col]); + astr := DictionaryFrm.DictGrid.Cells[7,Col]; + Justify := astr[1]; + missing := DictionaryFrm.DictGrid.Cells[6,Col]; + cellstr := Trim(OS3MainFrm.DataGrid.Cells[Col,Row]); + if missing = cellstr then exit; + if ((VarType = 'F') or (VarType = 'I')) then + begin + if IsNumeric(cellstr) then + begin + X := StrToFloat(cellstr); + newcell := FloatToStrF(X,ffFixed,Width,NoDec); +// Str(X:Width:NoDec,newcell); + end; + end + else newcell := cellstr; + + // now set justification + cellsize := OS3MainFrm.DataGrid.ColWidths[Col]; // in pixels + cellsize := cellsize div 8; + if Justify = 'L' then newcell := TrimLeft(newcell); + if Justify = 'C' then // center + begin + newcell := Trim(newcell); + While Length(newcell) < cellsize do + newcell := ' ' + newcell + ' '; + end; + if Justify = 'R' then // right justify + begin + newcell := Trim(newcell); + while Length(newcell) < cellsize do newcell := ' ' + newcell; + end; + OS3MainFrm.DataGrid.Cells[Col,Row] := newcell; +end; +//------------------------------------------------------------------- + +procedure FormatGrid; +var + i, j : integer; + +begin + for i := 1 to NoCases do + for j := 1 to NoVariables do FormatCell(j,i); +end; +//------------------------------------------------------------------- + +function IsNumeric(s : string) : boolean; +var i, strlong, FractionType : integer; + isnumber : boolean; +begin + if OptionsFrm.FractionTypeGrp.ItemIndex = 0 then + begin + FractionType := 0; + DecimalSeparator := '.' + end + else begin + FractionType := 1; + DecimalSeparator := ','; + end; + isnumber := true; + strlong := length(s); + for i := 1 to strlong do +// if (not(((s[i] >= '0') and (s[i] <= '9')) or (s[i] = DecimalSeparator) or +// (s[i] = '-'))) then isnumber := false; + if (ord(s[i]) < 44) or (ord(s[i]) > 57 ) or (ord(s[i]) = 47 )then isnumber := false; + result := isnumber; +end; +//----------------------------------------------------------------------------- + +procedure VecPrint(vector : IntDyneVec; Size : integer; Heading : string); +var + i, start, last : integer; + nvals : integer; + done : boolean; + astr : string; + +begin + nvals := 8; + done := false; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.RichEdit.Lines.Add(Heading); + OutPutFrm.RichEdit.Lines.Add(''); + start := 1; + last := nvals; + if last > Size then last := Size; + while not done do + begin + astr := ''; + for i := start to last do + astr := astr + format('%8d ',[i]); + OutPutFrm.RichEdit.Lines.Add(astr); + astr := ''; + for i := start to last do + astr := astr + format('%8d ',[vector[i-1]]); + OutPutFrm.RichEdit.Lines.Add(astr); + if last < Size then + begin + OutPutFrm.RichEdit.Lines.Add(''); + start := last + 1; + last := start + nvals - 1; + if last > Size then last := Size; + end + else done := true; + end; +end; +//------------------------------------------------------------------- +procedure SaveOS2File; +var + F : TextFile; + filename : string; + astr : string; + NRows, NCols : integer; + MemLines : integer; + i, j : integer; + +begin + OS3MainFrm.SaveDialog1.FileName := OS3MainFrm.FileNameEdit.Text; + OS3MainFrm.SaveDialog1.DefaultExt := '.LAZ'; + OS3MainFrm.SaveDialog1.Filter := 'LazStats (*.LAZ)|*.LAZ|Tab (*.tab)|*.TAB|space (*.SPC)|*.SPC'; + OS3MainFrm.SaveDialog1.FilterIndex := 1; + if OS3MainFrm.SaveDialog1.Execute then + begin + // check for valid cases - at least one value entered + NRows := StrToInt(OS3MainFrm.NoCasesEdit.Text); //OS3MainFrm.DataGrid.RowCount - 1; + NCols := StrToInt(OS3MainFrm.NoVarsEdit.Text); //OS3MainFrm.DataGrid.ColCount - 1; + if ((NRows = 0) or (NCols = 0)) then + begin + ShowMessage('ERROR! No data to save!'); + exit; + end; + filename := OS3MainFrm.SaveDialog1.FileName; + OS3MainFrm.FileNameEdit.Text := filename; + AssignFile(F,filename); + Rewrite(F); + + Writeln(F,NRows); + Writeln(F,NCols); + // write dictionary information for file first + for i := 1 to NCols do + begin + for j := 1 to 7 do + begin + astr := DictionaryFrm.DictGrid.Cells[j,i]; + Writeln(F,astr); + end; + end; +{ MemLines := DictionaryFrm.DescMemo.Lines.Count; + Writeln(F,MemLines); + for i := 0 to MemLines - 1 do + Writeln(F,DictionaryFrm.DescMemo.Lines[i]); } + // now save grid cell values + for i := 0 to NRows do + begin + for j := 0 to NCols do + begin + astr := OS3MainFrm.DataGrid.Cells[j,i]; + Writeln(F,astr); + end; + end; + CloseFile(F); + end; +end; +//------------------------------------------------------------------- + +procedure OpenOS2File; +var + F : TextFile; + filename : string; + astr : string; + i, j : integer; + NRows, NCols, MemLines : integer; +begin + DictLoaded := false; + OS3MainFrm.OpenDialog1.DefaultExt := '.LAZ'; + OS3MainFrm.OpenDialog1.Filter := 'LazStats (*.LAZ)|*.LAZ|Tab (*.tab)|*.TAB|space (*.SPC)|*.SPC|All files (*.*)|*.*'; + OS3MainFrm.OpenDialog1.FilterIndex := 1; + if OS3MainFrm.OpenDialog1.Execute then + begin + filename := OS3MainFrm.OpenDialog1.FileName; + OS3MainFrm.FileNameEdit.Text := filename; + AssignFile(F,filename); + Reset(F); + Readln(F,NRows); + readln(F,NCols); + + // initialize the dictionary grid for NCols of variables + // using the default formats (protective measure in case of + // a screw-up where the dictionary was damaged + DictionaryFrm.DictGrid.ColCount := 8; + DictionaryFrm.DictGrid.RowCount := NCols+1; + for i := 1 to NCols do + begin + DictionaryFrm.DictGrid.Cells[0,i] := IntToStr(i); + DictionaryFrm.DictGrid.Cells[1,i] := 'VAR.' + IntToStr(i); + DictionaryFrm.DictGrid.Cells[2,i] := 'VARIABLE ' + IntToStr(i); + DictionaryFrm.DictGrid.Cells[3,i] := '8'; + DictionaryFrm.DictGrid.Cells[4,i] := 'F'; + DictionaryFrm.DictGrid.Cells[5,i] := '2'; + DictionaryFrm.DictGrid.Cells[6,i] := ' '; + DictionaryFrm.DictGrid.Cells[7,i] := 'L'; + end; + + // get dictionary info first + for i := 1 to NCols do + begin + for j := 1 to 7 do + begin + Readln(F,astr); + DictionaryFrm.DictGrid.Cells[j,i] := astr; + end; + VarDefined[i] := true; + end; + DictLoaded := true; +{ Readln(F,astr); + MemLines := StrToInt(astr); + DictionaryFrm.DescMemo.Clear; + for i := 0 to MemLines - 1 do + begin + readln(F,astr); + DictionaryFrm.DescMemo.Lines.Add(astr); + end; } + // Now read grid data + OS3MainFrm.DataGrid.RowCount := NRows + 1; + OS3MainFrm.DataGrid.ColCount := NCols + 1; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NRows); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NCols); + NoVariables := NCols; + NoCases := NRows; + for i := 0 to NRows do + begin + for j := 0 to NCols do + begin + Readln(F,astr); + OS3MainFrm.DataGrid.Cells[j,i] := astr; + end; + end; + CloseFile(F); + // copy column names into the data dictionary. Note, this is + // redundant with the saved dictionary but helps restore in case + // of a screw-up + for i := 1 to NCols do + DictionaryFrm.DictGrid.Cells[1,i] := OS3MainFrm.DataGrid.Cells[i,0]; + for i := 1 to NRows do + OS3MainFrm.DataGrid.Cells[0,i] := 'CASE ' + IntToStr(i); + DictionaryFrm.ShowModal; + FormatGrid; + end; +end; +//------------------------------------------------------------------- + +procedure DeleteCol; +var + i, j, col: integer; + buf : pchar; +begin + col := OS3MainFrm.DataGrid.Col; + NoVariables := StrToInt(OS3MainFrm.NoVarsEdit.Text); +// TempStream.Clear; +// OS3MainFrm.DataGrid.Cols[col].SaveToStream(TempStream); + buf := OS3MainFrm.DataGrid.Cols[col].GetText; + ClipBoard.SetTextBuf(buf); + if col = NoVariables then // last column + begin + for j := 0 to NoCases do OS3MainFrm.DataGrid.Cells[col,j] := ''; + VarDefined[col] := false; + end + else // must be a variable in front of another variable + begin + for i := col + 1 to NoVariables do //Grid.ColCount - 1 do + for j := 0 to NoCases do //Grid.RowCount - 1 do + OS3MainFrm.DataGrid.Cells[i-1,j] := OS3MainFrm.DataGrid.Cells[i,j]; + for j := 0 to OS3MainFrm.DataGrid.RowCount - 1 do + OS3MainFrm.DataGrid.Cells[NoVariables,j] := ''; + end; + varDefined[NoVariables] := false; + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount - 1; + NoVariables := NoVariables - 1; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + // update dictionary + DictionaryFrm.DelRow(col); +end; +//------------------------------------------------------------------- + +procedure CopyColumn; +var + col: integer; + buf : pchar; +begin + col := OS3MainFrm.DataGrid.Col; + buf := OS3MainFrm.DataGrid.Cols[col].GetText; + ClipBoard.SetTextBuf(buf); +// The following code can be used instead of the above if no clipboard available +// TempStream.Clear; +// OS3MainFrm.DataGrid.Cols[col].SaveToStream(TempStream); +// DictionaryFrm.CopyVar(col); +end; +//------------------------------------------------------------------- + +procedure InsertCol; +var + i, j, col: integer; +begin + // insert a new, blank column into the data grid + col := OS3MainFrm.DataGrid.Col; +// DictionaryFrm.NewVar(col); + NoVariables := NoVariables + 1; + OS3MainFrm.DataGrid.ColCount := NoVariables + 1; + for i := NoVariables downto col do { move to right } + begin + for j := 0 to NoCases do + begin + OS3MainFrm.DataGrid.Cells[i,j] := OS3MainFrm.DataGrid.Cells[i-1,j]; + end; + end; + NoVariables := NoVariables - 1; + DictionaryFrm.NewVar(col); + for i := 1 to NoCases do OS3MainFrm.DataGrid.Cells[col,i] := ''; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); +end; +//------------------------------------------------------------------- + +procedure PasteColumn; +var + col, i, j : integer; + buf : pchar; + size : integer; + strarray : array[0..100000] of char; + +begin + col := OS3MainFrm.DataGrid.Col; + NoVariables := OS3MainFrm.DataGrid.ColCount-1; + NoCases := OS3MainFrm.DataGrid.RowCount - 1; + if col <= NoVariables then + begin // add a blank column, move current over and update dictionary + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + for i := NoVariables downto col do + for j := 0 to NoCases do + OS3MainFrm.DataGrid.Cells[i+1,j] := OS3MainFrm.DataGrid.Cells[i,j]; + DictionaryFrm.NewVar(col); + VarDefined[col] := true; + OS3MainFrm.ColEdit.Text := IntToStr(OS3MainFrm.DataGrid.ColCount-1); +// NoVariables := NoVariables + 1; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + end; + buf := strarray; + size := 100000; + ClipBoard.GetTextBuf(buf,size); + OS3MainFrm.DataGrid.Cols[col].SetText(buf); +end; +//------------------------------------------------------------------- + +procedure CutaRow; +var + row, i, j : integer; + buf : pchar; + +begin + row := OS3MainFrm.DataGrid.Row; + buf := OS3MainFrm.DataGrid.Rows[row].GetText; + ClipBoard.SetTextBuf(buf); +// TempStream.Clear; +// OS3MainFrm.DataGrid.Rows[row].SaveToStream(TempStream); + for i := 1 to NoVariables do OS3MainFrm.DataGrid.Cells[i,row] := ''; + if row < NoCases then + begin // move rows below up 1 + for i := row + 1 to NoCases do + for j := 1 to NoVariables do OS3MainFrm.DataGrid.Cells[j,i-1] := OS3MainFrm.DataGrid.Cells[j,i]; + for j := 1 to NoVariables do OS3MainFrm.DataGrid.Cells[j,NoCases] := ''; + end; + OS3MainFrm.DataGrid.RowCount := OS3MainFrm.DataGrid.RowCount - 1; + OS3MainFrm.RowEdit.Text := IntToStr(OS3MainFrm.DataGrid.RowCount-1); + NoCases := NoCases - 1; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoCases); + // renumber cases + for i := 1 to NoCases do OS3MainFrm.DataGrid.Cells[0,i] := 'CASE ' + IntToStr(i); +end; +//------------------------------------------------------------------- + +procedure CopyaRow; +var + row : integer; + buf : pchar; + +begin + row := OS3MainFrm.DataGrid.Row; + buf := OS3MainFrm.DataGrid.Rows[row].GetText; + ClipBoard.SetTextBuf(buf); +// TempStream.Clear; +// OS3MainFrm.DataGrid.Rows[row].SaveToStream(TempStream); +end; +//------------------------------------------------------------------- + +procedure PasteaRow; +var + row, i, j : integer; + buf : pchar; + strarray : array[0..100000] of char; + size : integer; + +begin + row := OS3MainFrm.DataGrid.Row; + OS3MainFrm.DataGrid.RowCount := OS3MainFrm.DataGrid.RowCount + 1; + OS3MainFrm.RowEdit.Text := IntToStr(OS3MainFrm.DataGrid.RowCount-1); + if row <= NoCases then // move all down before inserting + begin + for i := NoCases downto row do + for j := 1 to NoVariables do + OS3MainFrm.DataGrid.Cells[j,i+1] := OS3MainFrm.DataGrid.Cells[j,i]; + end; + OS3MainFrm.DataGrid.Row := row; + buf := strarray; + size := 100000; + ClipBoard.GetTextBuf(buf,size); + OS3MainFrm.DataGrid.Rows[row].SetText(buf); +// Use the following instead of the previous 4 if clipboard is unavailable +// TempStream.Position := 0; +// OS3MainFrm.DataGrid.Rows[row].LoadFromStream(TempStream); + NoCases := NoCases + 1; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoCases); + // renumber cases + for i := 1 to NoCases do OS3MainFrm.DataGrid.Cells[0,i] := 'CASE ' + IntToStr(i); + +end; +//------------------------------------------------------------------- + +procedure PrintDict; +var + outline: string; + i : integer; + +begin + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Alignment := taLeftJustify; + outline := OS3MainFrm.FileNameEdit.Text + ' VARIABLE DICTIONARY'; + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + for i:= 0 to NoVariables do + begin + outline := ''; + outline := outline + '| ' + format('%9s',[DictionaryFrm.DictGrid.Cells[0,i]]); + outline := outline + ' | ' + format('%10s',[DictionaryFrm.DictGrid.Cells[1,i]]); + outline := outline + ' | ' + format('%15s',[DictionaryFrm.DictGrid.Cells[2,i]]); + outline := outline + ' | ' + format('%6s',[DictionaryFrm.DictGrid.Cells[3,i]]); + outline := outline + ' | ' + format('%6s',[DictionaryFrm.DictGrid.Cells[4,i]]); + outline := outline + ' | ' + format('%8s',[DictionaryFrm.DictGrid.Cells[5,i]]); + outline := outline + ' | ' + format('%7s',[DictionaryFrm.DictGrid.Cells[6,i]]); + outline := outline + ' | ' + format('%6s',[DictionaryFrm.DictGrid.Cells[7,i]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.ShowModal; +end; +//------------------------------------------------------------------- + +procedure PrintData; +var + outline: string; + startcol: integer; + endcol: integer; + done: boolean; + cellstring: string; + i, j: integer; + +begin + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Alignment := taLeftJustify; + outline := OS3MainFrm.FileNameEdit.Text; + OutPutFrm.RichEdit.Lines.Add(outline); + outline := IntToStr(NoCases); + outline := 'No. of Cases = ' + outline; + outline := outline + ', No. of Variables = '; + outline := outline + IntToStr(NoVariables); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + done := false; + startcol := 1; + while done = false do + begin + endcol := startcol + 7; + if endcol > NoVariables then endcol := NoVariables; + for i:= 0 to NoCases do + begin + outline := ''; + outline := format('%10s',[Trim(OS3MainFrm.DataGrid.Cells[0,i])]); + for j := startcol to endcol do + begin + cellstring := format('%10s',[Trim(OS3MainFrm.DataGrid.Cells[j,i])]); + outline := outline + cellstring; + end; + OutPutFrm.RichEdit.Lines.Add(outline); + end; + if endcol = NoVariables then done := true else + begin + startcol := endcol+1; + OutPutFrm.RichEdit.Lines.Add(''); + end; + end; + OutPutFrm.ShowModal; +end; +//------------------------------------------------------------------- + +procedure OpenTabFile; +label getit; +var + TabFile : TextFile; + namestr : string; + astr : string; + achar : char; + respval : string; + labelsinc : boolean; + row, col : integer; + missopt : integer; + +begin + labelsinc := false; + // check for a currently open file + if NoVariables > 1 then + begin + ShowMessage('WARNING! Close (or Save and Close) the current work.'); + exit; + end; + respval := InputBox('LABELS?','Are variable labels included?','Y'); + if respval = 'Y' then labelsinc := true; + OS3MainFrm.OpenDialog1.Filter := 'Tab field files (*.tab)|*.TAB|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OS3MainFrm.OpenDialog1.FilterIndex := 1; + OS3MainFrm.OpenDialog1.DefaultExt := 'TAB'; + if OS3MainFrm.OpenDialog1.Execute then + begin + NoCases := 0; + NoVariables := 0; + if labelsinc = true then row := 0 else row := 1; + col := 1; + AssignFile(TabFile, OS3MainFrm.OpenDialog1.FileName); { File selected in dialog box } + Reset(tabfile); + OS3MainFrm.FileNameEdit.Text := OS3MainFrm.OpenDialog1.FileName; + astr := ''; + while not EOF(TabFile) do + begin +getit: read(TabFile,achar); + if (ord(achar) < 9) or (ord(achar) > 127) then goto getit; + if ord(achar) = 13 then goto getit; // line feed character + if (ord(achar) <> 9) and (ord(achar) <> 10) then // check for tab or new line + begin + astr := astr + achar; + end + else if ord(achar) = 9 then // tab character found + begin + if (not labelsinc) and (row = 1) then // create a col. label + begin + namestr := 'VAR ' + IntToStr(col); + OS3MainFrm.DataGrid.Cells[col,0] := namestr; + end; + OS3MainFrm.DataGrid.Cells[col,row] := astr; + if col > NoVariables then + begin + NoVariables := col; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + end; + col := col + 1; + astr := ''; + if col >= OS3MainFrm.DataGrid.ColCount then + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + end + else //must be new line character + begin + if (not labelsinc) and (row = 1) then // create a col. label + begin + namestr := 'VAR ' + IntToStr(col); + OS3MainFrm.DataGrid.Cells[col,0] := namestr; + end; + OS3MainFrm.DataGrid.Cells[col,row] := astr; + astr := ''; + if col > NoVariables then + begin + NoVariables := col; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + end; + col := 1; + if row > NoCases then NoCases := row; + OS3MainFrm.DataGrid.Cells[0,row] := 'Case ' + IntToStr(row); + row := row + 1; + if row >= OS3MainFrm.DataGrid.RowCount then + OS3MainFrm.DataGrid.RowCount := OS3MainFrm.DataGrid.RowCount + 1; + end; + end; // END OF FILE + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoCases); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + CloseFile(TabFile); + if NoVariables >= OS3MainFrm.DataGrid.ColCount - 1 then + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + // set up the dictionary + DictionaryFrm.DictGrid.RowCount := NoVariables + 1; + DictionaryFrm.DictGrid.ColCount := 8; + for row := 1 to NoVariables do + begin + DictionaryFrm.DictGrid.Cells[0,row] := IntToStr(row); + DictionaryFrm.DictGrid.Cells[1,row] := 'VAR.' + IntToStr(row); + DictionaryFrm.DictGrid.Cells[2,row] := 'VARIABLE ' + IntToStr(row); + DictionaryFrm.DictGrid.Cells[3,row] := '8'; + DictionaryFrm.DictGrid.Cells[4,row] := 'F'; + DictionaryFrm.DictGrid.Cells[5,row] := '2'; + missopt := OptionsFrm.DefaultMiss; + case missopt of + 0 : DictionaryFrm.DictGrid.Cells[6,row] := ' '; + 1 : DictionaryFrm.DictGrid.Cells[6,row] := '.'; + 2 : DictionaryFrm.DictGrid.Cells[6,row] := '0'; + 3 : DictionaryFrm.DictGrid.Cells[6,row] := '99999'; + end; + DictionaryFrm.DictGrid.Cells[7,row] := 'L'; + end; + for row := 1 to NoVariables do + begin + DictionaryFrm.DictGrid.Cells[1,row] := OS3MainFrm.DataGrid.Cells[row,0]; + VarDefined[row] := true; + end; + OS3MainFrm.DataGrid.RowCount := (NoCases + 1); + OS3MainFrm.DataGrid.ColCount := (NoVariables + 1); + end; + GetTypes; +end; +//------------------------------------------------------------------- + +procedure SaveTabFile; +var + namestr : string; + cellvalue : string; + TabFile : TextFile; + i, j : integer; + +begin + OS3MainFrm.SaveDialog1.Filter := 'Tab field files (*.tab)|*.TAB|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OS3MainFrm.SaveDialog1.FilterIndex := 1; + OS3MainFrm.SaveDialog1.DefaultExt := 'TAB'; + if OS3MainFrm.SaveDialog1.Execute then + begin + namestr := OS3MainFrm.SaveDialog1.FileName; + Assign(TabFile,namestr); + ReWrite(TabFile); + for i := 0 to NoCases do + begin + for j := 1 to NoVariables do //write all but last with a tab + begin + cellvalue := OS3MainFrm.DataGrid.Cells[j,i]; + if cellvalue = '' then cellvalue := '.'; + cellvalue := Trim(cellvalue); + if j < NoVariables then cellvalue := cellvalue + chr(9); + write(TabFile,cellvalue); + end; + writeln(TabFile); + end; + end; + CloseFile(TabFile); +end; +//------------------------------------------------------------------- + +function ValidValue(row, col : integer) : boolean; +var + valid: boolean; + xvalue: string; + cellstring : string; + +begin + valid := true; + if FilterOn = true then + begin + cellstring := Trim(OS3MainFrm.DataGrid.Cells[FilterCol,row]); + if cellstring = 'NO' then valid := false; + ValidValue := valid; + exit; + end; + xvalue := Trim(OS3MainFrm.DataGrid.Cells[col,row]); + if (xvalue = '') and (DictionaryFrm.DictGrid.Cells[4,col] <> 'S') + then valid := false; + if valid then // check for user-defined missing value + begin + if Trim(DictionaryFrm.DictGrid.Cells[6,col]) = xvalue then + valid := false; + end; + ValidValue := valid; +end; +//----------------------------------------------------------------------------- + +function IsFiltered(GridRow : integer) : boolean; +begin + if (FilterOn = true) and (Trim(OS3MainFrm.DataGrid.Cells[FilterCol,GridRow]) = 'NO') then + IsFiltered := true else IsFiltered := false; +end; +//------------------------------------------------------------------- + +procedure MATREAD(VAR a : DblDyneMat; + VAR norows : integer; + VAR nocols : integer; + VAR means : DblDyneVec; + VAR stddevs : DblDyneVec; + VAR NCases : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec; + filename : string); +var i, j : integer; + mat_file : TextFile; +begin + assign(mat_file,filename); + reset(mat_file); + readln(mat_file,norows); + readln(mat_file,nocols); + readln(mat_file,NCases); + for i := 1 to norows do readln(mat_file,RowLabels[i-1]); + for i := 1 to nocols do readln(mat_file,ColLabels[i-1]); + for i := 1 to nocols do readln(mat_file,means[i-1]); + for i := 1 to nocols do readln(mat_file,stddevs[i-1]); + for i := 1 to norows do + for j := 1 to nocols do + readln(mat_file,a[i-1,j-1]); + CloseFile(mat_file); +end; { matrix read routine } +//------------------------------------------------------------------- + +procedure MATSAVE(VAR a : DblDyneMat; + norows : integer; + nocols : integer; + VAR means : DblDyneVec; + VAR stddevs : DblDyneVec; + NCases : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec; + filename : string); +var i, j : integer; + mat_file : TextFile; +begin + assign(mat_file,filename); + rewrite(mat_file); + writeln(mat_file,norows); + writeln(mat_file,nocols); + writeln(mat_file,NCases); + for i := 1 to norows do writeln(mat_file,RowLabels[i-1]); + for i := 1 to nocols do writeln(mat_file,ColLabels[i-1]); + for i := 1 to nocols do writeln(mat_file,means[i-1]); + for i := 1 to nocols do writeln(mat_file,stddevs[i-1]); + for i := 1 to norows do + for j := 1 to nocols do + writeln(mat_file,a[i-1,j-1]); + CloseFile(mat_file); +end; { matrix save routine } +//------------------------------------------------------------------- + +procedure ReOpen(filename : string); +var + fileext : string; + +begin + DictLoaded := false; + + if FileExists(filename) then + begin + fileext := ExtractFileExt(filename); + OS3MainFrm.FileNameEdit.Text := filename; + OS3MainFrm.OpenDialog1.FileName := filename; + if fileext = '.CSV' then OpenCommaFile + else if fileext = '.TAB' then OpenTabFile + else if fileext = '.LAZ' then OpenOS2File + else if fileext = '.SSV' then OpenSpaceFile; + end + else begin + ShowMessage('ERROR! ' + filename + ' not found'); + exit; + end; +end; +//------------------------------------------------------------------- + +procedure OpenCommaFile; +label getit; +var + CommaFile : TextFile; + namestr : string; + astr : string; + achar : char; + respval : string; + labelsinc : boolean; + row, col : integer; + commachar : integer; + missopt : integer; +begin + commachar := ord(','); + labelsinc := false; + // check for a currently open file + if NoVariables > 1 then + begin + ShowMessage('WARNING! Close (or Save and Close) the current work.'); + exit; + end; + respval := InputBox('LABELS?','Are variable labels included?','Y'); + if respval = 'Y' then labelsinc := true; + OS3MainFrm.OpenDialog1.Filter := 'Comma field files (*.CSV)|*.CSV|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OS3MainFrm.OpenDialog1.FilterIndex := 1; + OS3MainFrm.OpenDialog1.DefaultExt := 'CSV'; + if OS3MainFrm.OpenDialog1.Execute then + begin + NoCases := 0; + NoVariables := 0; + if labelsinc = true then row := 0 else row := 1; + col := 1; + AssignFile(CommaFile, OS3MainFrm.OpenDialog1.FileName); { File selected in dialog box } + Reset(CommaFile); + OS3MainFrm.FileNameEdit.Text := OS3MainFrm.OpenDialog1.FileName; + astr := ''; + while not EOF(CommaFile) do + begin +getit: read(CommaFile,achar); + if (ord(achar) < 9) or (ord(achar) > 127) then goto getit; + if ord(achar) = 13 then goto getit; // line feed character + if (ord(achar) <> commachar) and (ord(achar) <> 10) then // check for tab or new line + begin + astr := astr + achar; + end + else if ord(achar) = commachar then // tab character found + begin + if (not labelsinc) and (row = 1) then // create a col. label + begin + namestr := 'VAR ' + IntToStr(col); + OS3MainFrm.DataGrid.Cells[col,0] := namestr; + end; + OS3MainFrm.DataGrid.Cells[col,row] := astr; + if col > NoVariables then + begin + NoVariables := col; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + end; + col := col + 1; + astr := ''; + if col >= OS3MainFrm.DataGrid.ColCount then + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + end + else //must be new line character + begin + if (not labelsinc) and (row = 1) then // create a col. label + begin + namestr := 'VAR ' + IntToStr(col); + OS3MainFrm.DataGrid.Cells[col,0] := namestr; + end; + OS3MainFrm.DataGrid.Cells[col,row] := astr; + astr := ''; + if col > NoVariables then + begin + NoVariables := col; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + end; + col := 1; + if row > NoCases then NoCases := row; + OS3MainFrm.DataGrid.Cells[0,row] := 'Case ' + IntToStr(row); + row := row + 1; + if row >= OS3MainFrm.DataGrid.RowCount then + OS3MainFrm.DataGrid.RowCount := OS3MainFrm.DataGrid.RowCount + 1; + end; + end; // END OF FILE + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoCases); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + CloseFile(CommaFile); + if NoVariables > OS3MainFrm.DataGrid.ColCount - 1 then + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + end; + OS3MainFrm.DataGrid.RowCount := (NoCases + 1); + OS3MainFrm.DataGrid.ColCount := (NoVariables + 1); + // set up the dictionary + DictionaryFrm.DictGrid.RowCount := NoVariables + 1; + DictionaryFrm.DictGrid.ColCount := 8; + for row := 1 to NoVariables do + begin + DictionaryFrm.DictGrid.Cells[0,row] := IntToStr(row); + DictionaryFrm.DictGrid.Cells[1,row] := 'VAR.' + IntToStr(row); + DictionaryFrm.DictGrid.Cells[2,row] := 'VARIABLE ' + IntToStr(row); + DictionaryFrm.DictGrid.Cells[3,row] := '8'; + DictionaryFrm.DictGrid.Cells[4,row] := 'F'; + DictionaryFrm.DictGrid.Cells[5,row] := '2'; + missopt := OptionsFrm.DefaultMiss; + case missopt of + 0 : DictionaryFrm.DictGrid.Cells[6,row] := ' '; + 1 : DictionaryFrm.DictGrid.Cells[6,row] := '.'; + 2 : DictionaryFrm.DictGrid.Cells[6,row] := '0'; + 3 : DictionaryFrm.DictGrid.Cells[6,row] := '99999'; + end; + DictionaryFrm.DictGrid.Cells[7,row] := 'L'; + end; + for row := 1 to NoVariables do + begin + DictionaryFrm.DictGrid.Cells[1,row] := OS3MainFrm.DataGrid.Cells[row,0]; + VarDefined[row] := true; + end; + GetTypes; +end; +//------------------------------------------------------------------- + +procedure SaveCommaFile; +var + namestr : string; + cellvalue : string; + CommaFile : TextFile; + i, j : integer; + +begin + OS3MainFrm.SaveDialog1.Filter := 'Comma field files (*.CSV)|*.CSV|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OS3MainFrm.SaveDialog1.FilterIndex := 1; + OS3MainFrm.SaveDialog1.DefaultExt := 'CSV'; + if OS3MainFrm.SaveDialog1.Execute then + begin + namestr := OS3MainFrm.SaveDialog1.FileName; + Assign(CommaFile,namestr); + ReWrite(CommaFile); + for i := 0 to NoCases do + begin + for j := 1 to NoVariables do //write all but last with a tab + begin + cellvalue := OS3MainFrm.DataGrid.Cells[j,i]; + if cellvalue = '' then cellvalue := '.'; + cellvalue := Trim(cellvalue); + if j < NoVariables then cellvalue := cellvalue + ','; + write(CommaFile,cellvalue); + end; + writeln(CommaFile); + end; + end; + CloseFile(CommaFile); +end; +//------------------------------------------------------------------- + +procedure OpenSpaceFile; +label getit; +var + SpaceFile : TextFile; + namestr : string; + astr : string; + achar : char; + respval : string; + labelsinc : boolean; + row, col : integer; + spacechar : integer; + spacefound : boolean; + missopt : integer; +begin + spacechar := ord(' '); + spacefound := false; + labelsinc := false; + // check for a currently open file + if NoVariables > 1 then + begin + ShowMessage('WARNING! Close (or Save and Close) the current work.'); + exit; + end; + respval := InputBox('LABELS?','Are variable labels included?','Y'); + if respval = 'Y' then labelsinc := true; + OS3MainFrm.OpenDialog1.Filter := 'Comma field files (*.SSV)|*.SSV|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OS3MainFrm.OpenDialog1.FilterIndex := 1; + OS3MainFrm.OpenDialog1.DefaultExt := 'SSV'; + if OS3MainFrm.OpenDialog1.Execute then + begin + NoCases := 0; + NoVariables := 0; + if labelsinc = true then row := 0 else row := 1; + col := 1; + AssignFile(SpaceFile, OS3MainFrm.OpenDialog1.FileName); { File selected in dialog box } + Reset(SpaceFile); + OS3MainFrm.FileNameEdit.Text := OS3MainFrm.OpenDialog1.FileName; + astr := ''; + while not EOF(SpaceFile) do + begin +getit: read(SpaceFile,achar); + if ord(achar) <> spacechar then spacefound := false; + if (ord(achar) < 9) or (ord(achar) > 127) then goto getit; + if ord(achar) = 13 then goto getit; // line feed character + if (ord(achar) <> spacechar) and (ord(achar) <> 10) then // check for space or new line + begin + astr := astr + achar; + end + else if ord(achar) = spacechar then // space character found + begin + if spacefound then goto getit; // extra space + if length(astr) = 0 then goto getit; // leading space + spacefound := true; + if (not labelsinc) and (row = 1) then // create a col. label + begin + namestr := 'VAR ' + IntToStr(col); + OS3MainFrm.DataGrid.Cells[col,0] := namestr; + end; + OS3MainFrm.DataGrid.Cells[col,row] := astr; + if col > NoVariables then + begin + NoVariables := col; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + end; + col := col + 1; + astr := ''; + if col >= OS3MainFrm.DataGrid.ColCount then + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + end + else //must be new line character + begin + spacefound := false; + if (not labelsinc) and (row = 1) then // create a col. label + begin + namestr := 'VAR ' + IntToStr(col); + OS3MainFrm.DataGrid.Cells[col,0] := namestr; + end; + OS3MainFrm.DataGrid.Cells[col,row] := astr; + astr := ''; + if col > NoVariables then + begin + NoVariables := col; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + end; + col := 1; + if row > NoCases then NoCases := row; + OS3MainFrm.DataGrid.Cells[0,row] := 'Case ' + IntToStr(row); + row := row + 1; + if row >= OS3MainFrm.DataGrid.RowCount then + OS3MainFrm.DataGrid.RowCount := OS3MainFrm.DataGrid.RowCount + 1; + end; + end; // END OF FILE + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoCases); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + CloseFile(SpaceFile); + if NoVariables > OS3MainFrm.DataGrid.ColCount - 1 then + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + end; + OS3MainFrm.DataGrid.RowCount := (NoCases + 1); + OS3MainFrm.DataGrid.ColCount := (NoVariables + 1); + // set up the dictionary + DictionaryFrm.DictGrid.RowCount := NoVariables + 1; + DictionaryFrm.DictGrid.ColCount := 8; + for row := 1 to NoVariables do + begin + DictionaryFrm.DictGrid.Cells[0,row] := IntToStr(row); + DictionaryFrm.DictGrid.Cells[1,row] := 'VAR.' + IntToStr(row); + DictionaryFrm.DictGrid.Cells[2,row] := 'VARIABLE ' + IntToStr(row); + DictionaryFrm.DictGrid.Cells[3,row] := '8'; + DictionaryFrm.DictGrid.Cells[4,row] := 'F'; + DictionaryFrm.DictGrid.Cells[5,row] := '2'; + missopt := OptionsFrm.DefaultMiss; + case missopt of + 0 : DictionaryFrm.DictGrid.Cells[6,row] := ' '; + 1 : DictionaryFrm.DictGrid.Cells[6,row] := '.'; + 2 : DictionaryFrm.DictGrid.Cells[6,row] := '0'; + 3 : DictionaryFrm.DictGrid.Cells[6,row] := '99999'; + end; + DictionaryFrm.DictGrid.Cells[7,row] := 'L'; + end; + for row := 1 to NoVariables do + begin + DictionaryFrm.DictGrid.Cells[1,row] := OS3MainFrm.DataGrid.Cells[row,0]; + VarDefined[row] := true; + end; + GetTypes; +end; +//------------------------------------------------------------------- + +procedure SaveSpaceFile; +var + namestr : string; + cellvalue : string; + SpaceFile : TextFile; + i, j : integer; + +begin + OS3MainFrm.SaveDialog1.Filter := 'Comma field files (*.SSV)|*.SSV|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OS3MainFrm.SaveDialog1.FilterIndex := 1; + OS3MainFrm.SaveDialog1.DefaultExt := 'SSV'; + if OS3MainFrm.SaveDialog1.Execute then + begin + namestr := OS3MainFrm.SaveDialog1.FileName; + Assign(SpaceFile,namestr); + ReWrite(SpaceFile); + for i := 0 to NoCases do + begin + for j := 1 to NoVariables do //write all but last with a tab + begin + cellvalue := OS3MainFrm.DataGrid.Cells[j,i]; + if cellvalue = '' then cellvalue := '.'; + cellvalue := Trim(cellvalue); + if j < NoVariables then cellvalue := cellvalue + ' '; + write(SpaceFile,cellvalue); + end; + writeln(SpaceFile); + end; + end; + CloseFile(SpaceFile); +end; +//------------------------------------------------------------------- + +procedure InsertRow; +var + i, j, row : integer; + +begin + row := OS3MainFrm.DataGrid.Row; + OS3MainFrm.DataGrid.RowCount := OS3MainFrm.DataGrid.RowCount + 1; + NoCases := OS3MainFrm.DataGrid.RowCount-1; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoCases); + for i := NoCases downto row+1 do + for j := 1 to NoVariables do + OS3MainFrm.DataGrid.Cells[j,i] := OS3MainFrm.DataGrid.Cells[j,i-1]; + for j := 1 to NoVariables do + OS3MainFrm.DataGrid.Cells[j,row] := ''; + for i := 1 to NoCases do + OS3MainFrm.DataGrid.Cells[0,i] := 'CASE ' + IntToStr(i); +end; +//------------------------------------------------------------------- + +procedure OpenOSData; +var + F : TextFile; + filename : string; + astr : string; + i, j : integer; + NRows, NCols : integer; +begin + DictLoaded := false; + OS3MainFrm.OpenDialog1.DefaultExt := '.OS2'; + OS3MainFrm.OpenDialog1.Filter := 'OpenStat2 (*.OS2)|*.OS2|Tab (*.tab)|*.TAB|space (*.SPC)|*.SPC|All files (*.*)|*.*'; + OS3MainFrm.OpenDialog1.FilterIndex := 1; + if OS3MainFrm.OpenDialog1.Execute then + begin + filename := OS3MainFrm.OpenDialog1.FileName; + OS3MainFrm.FileNameEdit.Text := filename; + AssignFile(F,filename); + Reset(F); + Readln(F,NRows); + readln(F,NCols); + + // initialize the dictionary grid for NCols of variables + // using the default formats (protective measure in case of + // a screw-up where the dictionary was damaged + DictionaryFrm.DictGrid.ColCount := 8; + DictionaryFrm.DictGrid.RowCount := NRows+1; + for i := 1 to NCols do + begin + DictionaryFrm.DictGrid.Cells[0,i] := IntToStr(i); + DictionaryFrm.DictGrid.Cells[1,i] := 'VAR.' + IntToStr(i); + DictionaryFrm.DictGrid.Cells[2,i] := 'VARIABLE ' + IntToStr(i); + DictionaryFrm.DictGrid.Cells[3,i] := '8'; + DictionaryFrm.DictGrid.Cells[4,i] := 'F'; + DictionaryFrm.DictGrid.Cells[5,i] := '2'; + DictionaryFrm.DictGrid.Cells[6,i] := ' '; + DictionaryFrm.DictGrid.Cells[7,i] := 'L'; + end; + DictionaryFrm.DescMemo.Clear; + + // Now read grid data + OS3MainFrm.DataGrid.RowCount := NRows + 1; + OS3MainFrm.DataGrid.ColCount := NCols + 1; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NRows); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NCols); + NoVariables := NCols; + NoCases := NRows; + for i := 0 to NRows do // note - labels in row 0 + begin + for j := 0 to NCols do // note - case no. in col. 0 + begin + Readln(F,astr); + OS3MainFrm.DataGrid.Cells[j,i] := astr; + end; + end; + CloseFile(F); + OS3MainFrm.DataGrid.Cells[0,0] := 'CASE/VAR.'; + + // copy column names into the data dictionary. + for i := 1 to NCols do + begin + DictionaryFrm.DictGrid.Cells[1,i] := OS3MainFrm.DataGrid.Cells[i,0]; + VarDefined[i] := true; + end; + DictionaryFrm.ShowModal; + FormatGrid; + end; +end; +//------------------------------------------------------------------- + +procedure ClearGrid; +var + i, j : integer; +begin + for i := 0 to NoCases do + begin + for j := 0 to NoVariables do OS3MainFrm.DataGrid.Cells[j,i] := ''; + end; + OS3MainFrm.NoVarsEdit.Text := '0'; + OS3MainFrm.NoCasesEdit.Text := '0'; + NoVariables := 0; + NoCases := 0; + OS3MainFrm.DataGrid.RowCount := 2; + OS3MainFrm.DataGrid.ColCount := 2; + OS3MainFrm.DataGrid.Cells[0,1] := 'CASE 1'; + OS3MainFrm.DataGrid.Cells[0,0] := 'CASE/VAR.'; + +end; + +procedure CopyIt; +VAR + rowstart, rowend,colstart, colend, i, j : integer; + buffer : string; + buf : string; + cellvalue : string; + bf : pchar; + +begin + Clipboard.Clear; + rowstart := OS3MainFrm.DataGrid.Selection.Top; + rowend := OS3MainFrm.DataGrid.Selection.Bottom; + colstart := OS3MainFrm.DataGrid.Selection.Left; + colend := OS3MainFrm.DataGrid.Selection.Right; + for i := rowstart to rowend do + begin + for j := colstart to colend do + begin + buf := buf + OS3MainFrm.DataGrid.Cells[j,i]; + buf := buf + chr(9); // add a tab + end; + buf := buf + chr(13); // add a newline + end; + bf := PChar(buf); + Clipboard.SetTextBuf(bf); +end; + +procedure PasteIt; +VAR + astring, cellstr : string; + col, howlong, startcol : integer; + startrows :integer; + header : string; + row, i, j : integer; + buf : pchar; + strarray : array[0..100000] of char; + size : integer; + achar : char; + pos : integer; + gridrowcnt : integer; + +begin + row := OS3MainFrm.DataGrid.Row; + col := OS3MainFrm.DataGrid.Col; + startrows := row; + startcol := col; + if NoVariables = 0 then NoVariables := 1; + if VarDefined[col] = false then + begin + DictionaryFrm.DictGrid.ColCount := 8; + DictionaryFrm.NewVar(col); + end; + +// OS3MainFrm.DataGrid.RowCount := OS3MainFrm.DataGrid.RowCount + 1; + OS3MainFrm.RowEdit.Text := IntToStr(OS3MainFrm.DataGrid.RowCount-1); + if row < NoCases then // move all down before inserting + begin + for i := NoCases downto row do + for j := 1 to NoVariables do + OS3MainFrm.DataGrid.Cells[j,i+1] := OS3MainFrm.DataGrid.Cells[j,i]; + end; + OS3MainFrm.DataGrid.Row := startrows; + OS3MainFrm.DataGrid.Col := startcol; + buf := strarray; + size := 100000; + + // get clipboard info + if (Clipboard.HasFormat(CF_TEXT)) then astring := Clipboard.AsText + else + begin + ShowMessage('The clipboard does not contain text.'); + exit; + end; + + buf := strarray; + size := 100000; + ClipBoard.GetTextBuf(buf,size); + // put buf in a string to parse + astring := buf; + howlong := Length(astring); + pos := 1; + cellstr := ''; + DictionaryFrm.DictGrid.ColCount := 8; + DictionaryFrm.DictGrid.RowCount := 2; + NoVariables := OS3MainFrm.DataGrid.ColCount - 1; + while howlong > 0 do + begin + achar := astring[pos]; + if ord(achar) = 9 then // tab character - end of a grid cell value + begin + OS3MainFrm.DataGrid.Cells[col,row] := cellstr; + col := col + 1; + if col >= OS3MainFrm.DataGrid.ColCount then + begin + OS3MainFrm.DataGrid.ColCount := col; + DictionaryFrm.NewVar(col); + NoVariables := col; + end; + cellstr := ''; + pos := pos + 1; + howlong := howlong - 1; + end; + if (ord(achar) = 10) then + begin + pos := pos + 1; + howlong := howlong - 1; + end; + if (ord(achar) = 12) then + begin + pos := pos + 1; + howlong := howlong - 1; + end; + if (ord(achar) = 13) then // return character or new line - end of a row + begin + OS3MainFrm.DataGrid.Cells[col,row] := cellstr; + col := startcol; + row := row + 1; + if row >= OS3MainFrm.DataGrid.RowCount then + begin + OS3MainFrm.DataGrid.RowCount := row+1; + OS3MainFrm.DataGrid.Cells[0,row] := 'Case ' + IntToStr(row); + end; + + cellstr := ''; + pos := pos + 1; + NoCases := row - 1; + howlong := howlong - 1; + end; + if ord(achar) > 13 then + begin + cellstr := cellstr + achar; + pos := pos + 1; + howlong := howlong - 1; + end; + end; + // delete extraneous row and column + OS3MainFrm.DataGrid.Col := NoVariables; +// DeleteCol; + OS3MainFrm.DataGrid.Row := NoCases+1; +// CutaRow; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoCases+1); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); +end; + +procedure RowColSwap; +VAR + i, j, Rows, Cols : integer; + tempgrid : StrDyneMat; + astring : string; +begin + SetLength(tempgrid,NoCases+1,NoVariables+1); + Rows := NoCases; + Cols := NoVariables; + + // store grid values + for i := 0 to Rows do + begin + for j := 0 to Cols do + tempgrid[i,j] := OS3MainFrm.DataGrid.Cells[j,i]; + end; + + // clear grid + ClearGrid; + + // clear dictionary + DictionaryFrm.DictGrid.ColCount := 8; + DictionaryFrm.DictGrid.RowCount := 1; + OS3MainFrm.FileNameEdit.Text := ''; + + // create new variables = NoCases + NoVariables := 0; + for i := 1 to Rows do + begin + OS3MainFrm.DataGrid.ColCount := i; + DictionaryFrm.NewVar(i); + NoVariables := i; + end; + + // store previous grid columns into the grid rows + OS3MainFrm.DataGrid.RowCount := Cols+1; + for i := 0 to Cols do + begin + for j := 1 to Rows do + begin + OS3MainFrm.DataGrid.Cells[j,i] := tempgrid[j,i]; + end; + end; + for i := 1 to Cols do // OS3MainFrm.DataGrid.Cells[0,i] := 'CASE ' + IntToStr(i); + OS3MainFrm.DataGrid.Cells[0,i] := tempgrid[0,i]; + // finish up + NoCases := Cols; + OS3MainFrm.FileNameEdit.Text := 'SwapTemp'; + OS3MainFrm.NoCasesEdit.Text := IntToStr(Cols); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + tempgrid := nil; +end; + +procedure MatToGrid(VAR mat : DblDyneMat; nsize : integer); +VAR + i, j : integer; +Begin + // clear grid + ClearGrid; + + // clear dictionary + DictionaryFrm.DictGrid.ColCount := 8; + DictionaryFrm.DictGrid.RowCount := 1; + OS3MainFrm.FileNameEdit.Text := ''; + + // create new variables = NoCases + NoVariables := 0; + for i := 1 to nsize do + begin + OS3MainFrm.DataGrid.ColCount := i; + DictionaryFrm.NewVar(i); + NoVariables := i; + end; + // store matrix into the grid rows + OS3MainFrm.DataGrid.RowCount := nsize + 1; + for i := 0 to nsize-1 do + begin + for j := 0 to nsize-1 do + begin + OS3MainFrm.DataGrid.Cells[i+1,j+1] := FloatToStr(mat[i,j]); + end; + end; + for i := 1 to nsize do + begin + OS3MainFrm.DataGrid.Cells[0,i] := 'VAR ' + IntToStr(i); + OS3MainFrm.DataGrid.Cells[i,0] := 'VAR ' + IntToStr(i); + end; + // finish up + NoCases := nsize; + OS3MainFrm.FileNameEdit.Text := 'MATtemp.LAZ'; + OS3MainFrm.NoCasesEdit.Text := IntToStr(nsize); + OS3MainFrm.NoVarsEdit.Text := IntToStr(nsize); +end; + +procedure GetTypes; +VAR + row,col,pos,i,j,strlong,intplaces,decplaces : integer; + cellstr, newcell : string; + strtype, inttype, floattype,isnumber : boolean; + comma, period, achar : char; + X : double; +begin + isnumber := false; + strtype := false; + inttype := false; + floattype := false; + comma := ','; + period := '.'; + + for col := 1 to NoVariables do + begin + for row := 1 to NoCases do + begin + cellstr := trim(OS3MainFrm.DataGrid.Cells[col,row]); + strlong := length(cellstr); + // check for a number type + for i := 1 to strlong do + if (ord(cellstr[i]) < 44) or (ord(cellstr[i]) > 57 ) or (ord(cellstr[i]) = 47 ) then + begin + isnumber := false; + break; + end + else isnumber := true; + if isnumber = false then strtype := true; + if isnumber = true then + begin // determine if an integer or float number + for i := 1 to strlong do + begin + achar := cellstr[i]; + if achar = period then floattype := true; + if achar = comma then floattype := true; + if floattype = true then + begin + pos := i; + break; + end; + end; + if floattype = false then inttype := true; + if floattype = true then + begin // get no. of decimal positions + intplaces := pos - 1; + decplaces := strlong - pos - 1; + end; + end; // end if it is a number + end; // end of row search + // set dictionary values + if strtype = true then + begin + DictionaryFrm.DictGrid.Cells[4,col] := 'S'; + DictionaryFrm.DictGrid.Cells[3,col] := IntToStr(strlong); + DictionaryFrm.DictGrid.Cells[5,col] := '0'; + end; + if inttype = true then + begin + DictionaryFrm.DictGrid.Cells[4,col] := 'I'; + DictionaryFrm.DictGrid.Cells[3,col] := IntToStr(strlong); + DictionaryFrm.DictGrid.Cells[5,col] := '0'; + end; + if floattype = true then + begin + DictionaryFrm.DictGrid.Cells[4,col] := 'F'; + DictionaryFrm.DictGrid.Cells[3,col] := IntToStr(strlong); + DictionaryFrm.DictGrid.Cells[5,col] := IntToStr(decplaces); + end; + isnumber := false; + strtype := false; + inttype := false; + floattype := false; + end; // end of column loop +end; + +function StringsToInt(strcol: integer; VAR newcol : integer; prompt : boolean) : boolean; +label endit; +VAR + i, j, k, NoStrings, col, ngridcols : integer; + String1, String2, TempString, response : string; + dup, savenewcol, strtype : boolean; + StrGrps, OneString : StrDyneVec; + +begin +{ Procedure to convert group strings into group integers with the option + to save the integers in the grid } + strtype := false; + savenewcol := true; + + // Get memory for arrays + SetLength(StrGrps,NoCases+1); + SetLength(OneString,NoCases+1); + + // check to see if strcol is a string variable + if DictionaryFrm.DictGrid.Cells[4,strcol] = 'S' then strtype :=true + else begin + ShowMessage('ERROR! Column selected is not defined as a string variable'); + goto endit; + end; + + // read the strings into the StrGrps array + for i := 1 to NoCases do + StrGrps[i-1] := trim(OS3MainFrm.DataGrid.Cells[strcol,i]); + + // sort the StrGrps array + for i := 0 to NoCases - 1 do + begin + for j := i + 1 to NoCases - 1 do + begin + if (StrGrps[i] > StrGrps[j]) then // swap + begin + TempString := StrGrps[i]; + StrGrps[i] := StrGrps[j]; + StrGrps[j] := TempString; + end; + end; + end; + + // copy unique strings into the OneString array + TempString := StrGrps[0]; + OneString[0] := TempString; + NoStrings := 0; + for i := 1 to NoCases do + begin + if (StrGrps[i] <> TempString) then // a new string found + begin + for k := 0 to NoCases - 1 do // check for existing + begin + if (TempString = OneString[k]) then dup := true + else dup := false; + end; + if (dup = false) then + begin + NoStrings := NoStrings + 1; + OneString[NoStrings] := StrGrps[i]; + TempString := StrGrps[i]; + end; + end; + end; + + // make a new variable in the grid for the group integers + DictionaryFrm.NewVar(NoVariables+1); + DictionaryFrm.DictGrid.Cells[1,NoVariables] := 'GroupCode'; + OS3MainFrm.DataGrid.Cells[NoVariables,0] := 'GroupCode'; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + + DictionaryFrm.DictGrid.Cells[4,NoVariables] := 'I'; + DictionaryFrm.DictGrid.Cells[5,NoVariables] := '0'; + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoVariables); + newcol := NoVariables; + + // oompare case strings with OneString values and use index + 1 + // for the group code in the data grid + for i := 1 to NoCases do + begin + TempString := OS3MainFrm.DataGrid.Cells[strcol,i]; + for j := 0 to NoCases-1 do + begin + if (TempString = OneString[j]) then + OS3MainFrm.DataGrid.Cells[NoVariables,i] := IntToStr(j+1); + end; + end; + + // see if user wants to save the generated group codes + if (prompt = true) then + begin + response := InputBox('Save Code in Grid?','Y or N','Y'); + if ((response = 'n') or (response = 'N')) then + savenewcol := false; + end; + + // clean up memory +endit: OneString := nil; + StrGrps := nil; + + // return results + StringsToInt := savenewcol; +end; + + + +end. diff --git a/applications/lazstats/source_orig/datasmoothunit.lfm b/applications/lazstats/source_orig/datasmoothunit.lfm new file mode 100644 index 000000000..ae1d28f23 --- /dev/null +++ b/applications/lazstats/source_orig/datasmoothunit.lfm @@ -0,0 +1,202 @@ +object SmoothDataForm: TSmoothDataForm + Left = 288 + Height = 360 + Top = 161 + Width = 378 + Caption = 'Data Smoothing' + ClientHeight = 360 + ClientWidth = 378 + OnShow = ResetBtnClick + LCLVersion = '0.9.30' + object Memo1: TMemo + Left = 6 + Height = 79 + Top = 9 + Width = 362 + Lines.Strings = ( + 'This procedure creates a new variable with the label "smoothed"' + 'with data points created from the selected variable. Each new' + 'data point is the average of the immediately preceding value and ' + 'the immediately following value. New values are therefore ' + 'created for the 2nd, 3rd,...,and N-1 values. The process can be' + 'repeated multiple times.' + ) + TabOrder = 0 + end + object Label2: TLabel + Left = 8 + Height = 16 + Top = 96 + Width = 48 + Caption = 'Variables' + ParentColor = False + end + object VarList: TListBox + Left = 8 + Height = 225 + Top = 112 + Width = 166 + ItemHeight = 0 + MultiSelect = True + TabOrder = 1 + end + object InBtn: TBitBtn + Left = 184 + Height = 39 + Top = 112 + Width = 38 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE + 6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580 + 3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3 + 71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7 + 74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7 + 74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = InBtnClick + TabOrder = 2 + end + object OutBtn: TBitBtn + Left = 184 + Height = 39 + Top = 160 + Width = 38 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580 + 3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3 + 71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7 + 74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF + FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = OutBtnClick + TabOrder = 3 + end + object VariableEdit: TEdit + Left = 232 + Height = 23 + Top = 139 + Width = 132 + TabOrder = 4 + Text = 'VariableEdit' + end + object Label1: TLabel + Left = 185 + Height = 16 + Top = 214 + Width = 101 + Caption = 'Repeat smoothing ' + ParentColor = False + end + object RepeatEdit: TEdit + Left = 296 + Height = 23 + Top = 207 + Width = 31 + TabOrder = 5 + Text = 'RepeatEdit' + end + object Label3: TLabel + Left = 331 + Height = 16 + Top = 214 + Width = 33 + Caption = 'times.' + ParentColor = False + end + object ResetBtn: TButton + Left = 282 + Height = 32 + Top = 264 + Width = 80 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 6 + end + object CancelBtn: TButton + Left = 184 + Height = 30 + Top = 304 + Width = 82 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 7 + end + object ComputeBtn: TButton + Left = 282 + Height = 30 + Top = 304 + Width = 80 + Caption = 'Compute' + ModalResult = 1 + OnClick = ComputeBtnClick + TabOrder = 8 + end + object HelpBtn: TButton + Tag = 119 + Left = 184 + Height = 32 + Top = 264 + Width = 82 + Caption = 'Help' + TabOrder = 9 + end +end diff --git a/applications/lazstats/source_orig/datasmoothunit.lrs b/applications/lazstats/source_orig/datasmoothunit.lrs new file mode 100644 index 000000000..4041a50df --- /dev/null +++ b/applications/lazstats/source_orig/datasmoothunit.lrs @@ -0,0 +1,136 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TSmoothDataForm','FORMDATA',[ + 'TPF0'#15'TSmoothDataForm'#14'SmoothDataForm'#4'Left'#3' '#1#6'Height'#3'h'#1 + +#3'Top'#3#161#0#5'Width'#3'z'#1#7'Caption'#6#14'Data Smoothing'#12'ClientHei' + +'ght'#3'h'#1#11'ClientWidth'#3'z'#1#6'OnShow'#7#13'ResetBtnClick'#10'LCLVers' + +'ion'#6#6'0.9.30'#0#5'TMemo'#5'Memo1'#4'Left'#2#6#6'Height'#2'O'#3'Top'#2#9#5 + +'Width'#3'j'#1#13'Lines.Strings'#1#6'?This procedure creates a new variable ' + +'with the label "smoothed"'#6'>with data points created from the selected va' + +'riable. Each new'#6'Adata point is the average of the immediately precedin' + +'g value and '#6';the immediately following value. New values are therefore' + +' '#6'@created for the 2nd, 3rd,...,and N-1 values. The process can be'#6#24 + +'repeated multiple times.'#0#8'TabOrder'#2#0#0#0#6'TLabel'#6'Label2'#4'Left' + +#2#8#6'Height'#2#16#3'Top'#2'`'#5'Width'#2'0'#7'Caption'#6#9'Variables'#11'P' + +'arentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#8#6'Height'#3#225#0#3'To' + +'p'#2'p'#5'Width'#3#166#0#10'ItemHeight'#2#0#11'MultiSelect'#9#8'TabOrder'#2 + +#1#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#184#0#6'Height'#2''''#3'Top'#2'p'#5'Wid' + +'th'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'(' + +#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0 + +#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247 + +'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190'm' + +#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A' + +#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I' + +#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215 + +#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139 + +#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v' + +#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255 + +#165#218#174#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159 + +#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197 + +#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h' + +#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b' + +#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U' + +#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B' + +#219#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I' + +#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#10 + ,'InBtnClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#184#0#6'Heig' + +'ht'#2''''#3'Top'#3#160#0#5'Width'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0 + +'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4 + +#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207 + +'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';' + +#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255 + +#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134#255#156#213#165#255#152#211 + +#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130 + +#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$' + +#255#255#255#255#0#255#255#255#0'h'#199't'#201#127#204#138#255#162#216#171 + +#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204 + +#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'x' + +#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209 + +#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M' + +#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255 + +'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't' + +#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't' + +#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'OutBtnClick'#8'TabOrde' + +'r'#2#3#0#0#5'TEdit'#12'VariableEdit'#4'Left'#3#232#0#6'Height'#2#23#3'Top'#3 + +#139#0#5'Width'#3#132#0#8'TabOrder'#2#4#4'Text'#6#12'VariableEdit'#0#0#6'TLa' + +'bel'#6'Label1'#4'Left'#3#185#0#6'Height'#2#16#3'Top'#3#214#0#5'Width'#2'e'#7 + +'Caption'#6#17'Repeat smoothing '#11'ParentColor'#8#0#0#5'TEdit'#10'RepeatEd' + +'it'#4'Left'#3'('#1#6'Height'#2#23#3'Top'#3#207#0#5'Width'#2#31#8'TabOrder'#2 + +#5#4'Text'#6#10'RepeatEdit'#0#0#6'TLabel'#6'Label3'#4'Left'#3'K'#1#6'Height' + +#2#16#3'Top'#3#214#0#5'Width'#2'!'#7'Caption'#6#6'times.'#11'ParentColor'#8#0 + +#0#7'TButton'#8'ResetBtn'#4'Left'#3#26#1#6'Height'#2' '#3'Top'#3#8#1#5'Width' + +#2'P'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#6#0 + +#0#7'TButton'#9'CancelBtn'#4'Left'#3#184#0#6'Height'#2#30#3'Top'#3'0'#1#5'Wi' + +'dth'#2'R'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#7#0#0#7 + +'TButton'#10'ComputeBtn'#4'Left'#3#26#1#6'Height'#2#30#3'Top'#3'0'#1#5'Width' + ,#2'P'#7'Caption'#6#7'Compute'#11'ModalResult'#2#1#7'OnClick'#7#15'ComputeBtn' + +'Click'#8'TabOrder'#2#8#0#0#7'TButton'#7'HelpBtn'#3'Tag'#2'w'#4'Left'#3#184#0 + +#6'Height'#2' '#3'Top'#3#8#1#5'Width'#2'R'#7'Caption'#6#4'Help'#8'TabOrder'#2 + +#9#0#0#0 +]); diff --git a/applications/lazstats/source_orig/datasmoothunit.pas b/applications/lazstats/source_orig/datasmoothunit.pas new file mode 100644 index 000000000..82914a46e --- /dev/null +++ b/applications/lazstats/source_orig/datasmoothunit.pas @@ -0,0 +1,122 @@ +unit DataSmoothUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, Buttons, MainUnit, Globals, functionsLib, OutPutUnit, DataProcs, + DictionaryUnit, contexthelpunit; + +type + + { TSmoothDataForm } + + TSmoothDataForm = class(TForm) + CancelBtn: TButton; + HelpBtn: TButton; + Label3: TLabel; + ComputeBtn: TButton; + RepeatEdit: TEdit; + Label1: TLabel; + ResetBtn: TButton; + VariableEdit: TEdit; + InBtn: TBitBtn; + Label2: TLabel; + Memo1: TMemo; + OutBtn: TBitBtn; + VarList: TListBox; + procedure ComputeBtnClick(Sender: TObject); + procedure InBtnClick(Sender: TObject); + procedure OutBtnClick(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + SmoothDataForm: TSmoothDataForm; + +implementation + +{ TSmoothDataForm } + +procedure TSmoothDataForm.ResetBtnClick(Sender: TObject); +VAR i : integer; +begin + VarList.Clear; + for i := 1 to NoVariables do + VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + RepeatEdit.Text := '1'; + VariableEdit.Text := ''; + InBtn.Visible := true; + OutBtn.Visible := false; +end; + +procedure TSmoothDataForm.InBtnClick(Sender: TObject); +VAR index : integer; +begin + index := VarList.ItemIndex; + VariableEdit.Text := VarList.Items.Strings[index]; + VarList.Items.Delete(index); + InBtn.Visible := false; + OutBtn.Visible := true; +end; + +procedure TSmoothDataForm.ComputeBtnClick(Sender: TObject); +VAR + DataPts, OutPts : DblDyneVec; + value, dblvalue, avg : double; + VarCol, result, N, Reps, intvalue, i, j, col : integer; + varlabel, strvalue : string; +begin + N := NoCases; + SetLength(DataPts,N); + SetLength(OutPts,N); + Reps := StrToInt(RepeatEdit.Text); + varlabel := VariableEdit.Text; + for i := 1 to NoVariables do + if varlabel = OS3MainFrm.DataGrid.Cells[i,0] then VarCol := i; + for i := 1 to N do + begin + value := StrToFloat(OS3MainFrm.DataGrid.Cells[VarCol,i]); + DataPts[i-1] := value; + end; + // repeat smoothing for Reps times + OutPts[0] := DataPts[0]; + OutPts[N-1] := DataPts[N-1]; + for j := 1 to Reps do + begin + for i := 1 to N-2 do + begin + avg := (DataPts[i-1] + DataPts[i] + DataPts[i+1]) / 3.0; + OutPts[i] := avg; + end; + if j < Reps then + for i := 0 to N-1 do DataPts[i] := OutPts[i]; + end; + // Create a new variable and copy smoothed data into it. + strvalue := 'Smoothed'; + col := NoVariables + 1; + DictionaryFrm.NewVar(NoVariables+1); + DictionaryFrm.DictGrid.Cells[1,NoVariables] := strvalue; + OS3MainFrm.DataGrid.Cells[NoVariables,0] := strvalue; + for i := 0 to N-1 do OS3MainFrm.DataGrid.Cells[col,i+1] := FloatToStr(OutPts[i]); +end; + +procedure TSmoothDataForm.OutBtnClick(Sender: TObject); +begin + VarList.Items.Add(VariableEdit.Text); + VariableEdit.Text := ''; + OutBtn.Visible := false; + InBtn.Visible := true; +end; + +initialization + {$I datasmoothunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/dbldeclineunit.lfm b/applications/lazstats/source_orig/dbldeclineunit.lfm new file mode 100644 index 000000000..146c91aed --- /dev/null +++ b/applications/lazstats/source_orig/dbldeclineunit.lfm @@ -0,0 +1,128 @@ +object DblDeclineFrm: TDblDeclineFrm + Left = 120 + Height = 214 + Top = 126 + Width = 300 + Caption = 'Double Declining Value' + ClientHeight = 214 + ClientWidth = 300 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 9 + Height = 14 + Top = 16 + Width = 52 + Caption = 'Initial Cost' + ParentColor = False + end + object Label2: TLabel + Left = 9 + Height = 14 + Top = 56 + Width = 77 + Caption = 'Life Expectancy' + ParentColor = False + end + object Label3: TLabel + Left = 9 + Height = 14 + Top = 96 + Width = 48 + Caption = 'End Value' + ParentColor = False + end + object Label4: TLabel + Left = 9 + Height = 14 + Top = 136 + Width = 94 + Caption = 'Depreciation Period' + ParentColor = False + end + object Label5: TLabel + Left = 9 + Height = 14 + Top = 176 + Width = 108 + Caption = 'Obtained Depreciation' + ParentColor = False + end + object CostEdit: TEdit + Left = 121 + Height = 21 + Top = 9 + Width = 60 + TabOrder = 0 + Text = 'CostEdit' + end + object LifeEdit: TEdit + Left = 120 + Height = 21 + Top = 49 + Width = 60 + TabOrder = 1 + Text = 'Edit1' + end + object EndEdit: TEdit + Left = 120 + Height = 21 + Top = 89 + Width = 60 + TabOrder = 2 + Text = 'Edit1' + end + object PeriodEdit: TEdit + Left = 120 + Height = 21 + Top = 129 + Width = 60 + TabOrder = 3 + Text = 'Edit1' + end + object DeprecEdit: TEdit + Left = 120 + Height = 21 + Top = 169 + Width = 60 + TabOrder = 4 + Text = 'Edit1' + end + object ResetBtn: TButton + Left = 200 + Height = 29 + Top = 56 + Width = 80 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 5 + end + object ComputeBtn: TButton + Left = 200 + Height = 29 + Top = 104 + Width = 80 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 6 + end + object ReturnBtn: TButton + Left = 200 + Height = 29 + Top = 152 + Width = 80 + Caption = 'Return' + ModalResult = 1 + TabOrder = 7 + end + object HelpBtn: TButton + Tag = 118 + Left = 200 + Height = 32 + Top = 9 + Width = 82 + Caption = 'Help' + OnClick = HelpBtnClick + TabOrder = 8 + end +end diff --git a/applications/lazstats/source_orig/dbldeclineunit.lrs b/applications/lazstats/source_orig/dbldeclineunit.lrs new file mode 100644 index 000000000..c1338a9b0 --- /dev/null +++ b/applications/lazstats/source_orig/dbldeclineunit.lrs @@ -0,0 +1,32 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TDblDeclineFrm','FORMDATA',[ + 'TPF0'#14'TDblDeclineFrm'#13'DblDeclineFrm'#4'Left'#2'x'#6'Height'#3#214#0#3 + +'Top'#2'~'#5'Width'#3','#1#7'Caption'#6#22'Double Declining Value'#12'Client' + +'Height'#3#214#0#11'ClientWidth'#3','#1#6'OnShow'#7#8'FormShow'#10'LCLVersio' + +'n'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#9#6'Height'#2#14#3'Top'#2 + +#16#5'Width'#2'4'#7'Caption'#6#12'Initial Cost'#11'ParentColor'#8#0#0#6'TLab' + +'el'#6'Label2'#4'Left'#2#9#6'Height'#2#14#3'Top'#2'8'#5'Width'#2'M'#7'Captio' + +'n'#6#15'Life Expectancy'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2 + +#9#6'Height'#2#14#3'Top'#2'`'#5'Width'#2'0'#7'Caption'#6#9'End Value'#11'Par' + +'entColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#2#9#6'Height'#2#14#3'Top'#3#136 + +#0#5'Width'#2'^'#7'Caption'#6#19'Depreciation Period'#11'ParentColor'#8#0#0#6 + +'TLabel'#6'Label5'#4'Left'#2#9#6'Height'#2#14#3'Top'#3#176#0#5'Width'#2'l'#7 + +'Caption'#6#21'Obtained Depreciation'#11'ParentColor'#8#0#0#5'TEdit'#8'CostE' + +'dit'#4'Left'#2'y'#6'Height'#2#21#3'Top'#2#9#5'Width'#2'<'#8'TabOrder'#2#0#4 + +'Text'#6#8'CostEdit'#0#0#5'TEdit'#8'LifeEdit'#4'Left'#2'x'#6'Height'#2#21#3 + +'Top'#2'1'#5'Width'#2'<'#8'TabOrder'#2#1#4'Text'#6#5'Edit1'#0#0#5'TEdit'#7'E' + +'ndEdit'#4'Left'#2'x'#6'Height'#2#21#3'Top'#2'Y'#5'Width'#2'<'#8'TabOrder'#2 + +#2#4'Text'#6#5'Edit1'#0#0#5'TEdit'#10'PeriodEdit'#4'Left'#2'x'#6'Height'#2#21 + +#3'Top'#3#129#0#5'Width'#2'<'#8'TabOrder'#2#3#4'Text'#6#5'Edit1'#0#0#5'TEdit' + +#10'DeprecEdit'#4'Left'#2'x'#6'Height'#2#21#3'Top'#3#169#0#5'Width'#2'<'#8'T' + +'abOrder'#2#4#4'Text'#6#5'Edit1'#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#200#0#6 + +'Height'#2#29#3'Top'#2'8'#5'Width'#2'P'#7'Caption'#6#5'Reset'#7'OnClick'#7#13 + +'ResetBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#200#0 + +#6'Height'#2#29#3'Top'#2'h'#5'Width'#2'P'#7'Caption'#6#7'Compute'#7'OnClick' + +#7#15'ComputeBtnClick'#8'TabOrder'#2#6#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3 + +#200#0#6'Height'#2#29#3'Top'#3#152#0#5'Width'#2'P'#7'Caption'#6#6'Return'#11 + +'ModalResult'#2#1#8'TabOrder'#2#7#0#0#7'TButton'#7'HelpBtn'#3'Tag'#2'v'#4'Le' + +'ft'#3#200#0#6'Height'#2' '#3'Top'#2#9#5'Width'#2'R'#7'Caption'#6#4'Help'#7 + +'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#8#0#0#0 +]); diff --git a/applications/lazstats/source_orig/dbldeclineunit.pas b/applications/lazstats/source_orig/dbldeclineunit.pas new file mode 100644 index 000000000..e8b617b4f --- /dev/null +++ b/applications/lazstats/source_orig/dbldeclineunit.pas @@ -0,0 +1,125 @@ +unit DblDeclineUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, Math, contexthelpunit; + +type + + { TDblDeclineFrm } + + TDblDeclineFrm = class(TForm) + HelpBtn: TButton; + ResetBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + CostEdit: TEdit; + LifeEdit: TEdit; + EndEdit: TEdit; + PeriodEdit: TEdit; + DeprecEdit: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + procedure ComputeBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure HelpBtnClick(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + function DoubleDecliningBalance(Cost, Salvage: Extended; Life, Period: Integer): Extended; + private + { private declarations } + public + { public declarations } + end; + +var + DblDeclineFrm: TDblDeclineFrm; + +implementation + +{ TDblDeclineFrm } + +procedure TDblDeclineFrm.ResetBtnClick(Sender: TObject); +begin + CostEdit.Text := ''; + LifeEdit.Text := ''; + EndEdit.Text := ''; + PeriodEdit.Text := ''; + DeprecEdit.Text := ''; +end; + +procedure TDblDeclineFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; + +procedure TDblDeclineFrm.HelpBtnClick(Sender: TObject); +begin + ContextHelpForm.HelpMessage((Sender as TButton).tag); +end; + +procedure TDblDeclineFrm.ComputeBtnClick(Sender: TObject); +VAR + Depreciation, Cost, Salvage : Extended; + Life, Period : integer; +begin + Cost := StrToFloat(CostEdit.Text); + Salvage := StrToFloat(EndEdit.Text); + Life := StrToInt(LifeEdit.Text); + Period := StrToInt(PeriodEdit.Text); + Depreciation := DoubleDecliningBalance(Cost, Salvage, Life, Period); + DeprecEdit.Text := FloatToStr(Depreciation); +end; + +function TDblDeclineFrm.DoubleDecliningBalance(Cost, Salvage: Extended; Life, Period: Integer): Extended; +{ dv := cost * (1 - 2/life)**(period - 1) + DDB = (2/life) * dv + if DDB > dv - salvage then DDB := dv - salvage + if DDB < 0 then DDB := 0 +} +var + DepreciatedVal, Factor: Extended; +begin + Result := 0; + if (Period < 1) or (Life < Period) or (Life < 1) or (Cost <= Salvage) then + Exit; + + {depreciate everything in period 1 if life is only one or two periods} + if ( Life <= 2 ) then + begin + if ( Period = 1 ) then + DoubleDecliningBalance:=Cost-Salvage + else + DoubleDecliningBalance:=0; {all depreciation occurred in first period} + exit; + end; + Factor := 2.0 / Life; + + DepreciatedVal := Cost * IntPower((1.0 - Factor), Period - 1); + {DepreciatedVal is Cost-(sum of previous depreciation results)} + + Result := Factor * DepreciatedVal; + {Nominal computed depreciation for this period. The rest of the + function applies limits to this nominal value. } + + {Only depreciate until total depreciation equals cost-salvage.} + if Result > DepreciatedVal - Salvage then + Result := DepreciatedVal - Salvage; + + {No more depreciation after salvage value is reached. This is mostly a nit. + If Result is negative at this point, it's very close to zero.} + if Result < 0.0 then + Result := 0.0; +end; + +initialization + {$I dbldeclineunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/descriptiveunit.lfm b/applications/lazstats/source_orig/descriptiveunit.lfm new file mode 100644 index 000000000..71a27fb91 --- /dev/null +++ b/applications/lazstats/source_orig/descriptiveunit.lfm @@ -0,0 +1,241 @@ +object DescriptiveFrm: TDescriptiveFrm + Left = 175 + Height = 388 + Top = 91 + Width = 434 + Caption = 'Descriptive Statistics' + ClientHeight = 388 + ClientWidth = 434 + OnShow = FormShow + LCLVersion = '0.9.30' + object Label1: TLabel + Left = 200 + Height = 16 + Top = 279 + Width = 175 + Caption = 'Confidence Interval for the Mean' + ParentColor = False + end + object Label2: TLabel + Left = 8 + Height = 16 + Top = 8 + Width = 48 + Caption = 'Variables' + ParentColor = False + end + object Label3: TLabel + Left = 239 + Height = 16 + Top = 8 + Width = 45 + Caption = 'Selected' + ParentColor = False + end + object VarList: TListBox + Left = 8 + Height = 225 + Top = 24 + Width = 166 + ItemHeight = 0 + MultiSelect = True + TabOrder = 0 + end + object SelList: TListBox + Left = 239 + Height = 225 + Top = 24 + Width = 188 + ItemHeight = 0 + TabOrder = 1 + end + object CIEdit: TEdit + Left = 379 + Height = 23 + Top = 272 + Width = 41 + TabOrder = 2 + Text = '95.0' + end + object ResetBtn: TButton + Left = 312 + Height = 32 + Top = 304 + Width = 80 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 3 + end + object CancelBtn: TButton + Left = 200 + Height = 30 + Top = 344 + Width = 82 + Caption = 'Cancel' + ModalResult = 2 + OnClick = CancelBtnClick + TabOrder = 4 + end + object OKBtn: TButton + Left = 312 + Height = 30 + Top = 344 + Width = 80 + Caption = 'Continue' + ModalResult = 1 + OnClick = OKBtnClick + TabOrder = 5 + end + object InBtn: TBitBtn + Left = 184 + Height = 39 + Top = 24 + Width = 38 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE + 6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580 + 3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3 + 71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7 + 74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7 + 74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = InBtnClick + TabOrder = 6 + end + object OutBtn: TBitBtn + Left = 184 + Height = 39 + Top = 72 + Width = 38 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580 + 3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3 + 71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7 + 74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF + FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = OutBtnClick + TabOrder = 7 + end + object AllBtn: TBitBtn + Left = 184 + Height = 39 + Top = 136 + Width = 38 + Caption = 'ALL' + NumGlyphs = 0 + OnClick = AllBtnClick + TabOrder = 8 + end + object GroupBox1: TGroupBox + Left = 12 + Height = 88 + Top = 264 + Width = 162 + Caption = 'Options' + ClientHeight = 70 + ClientWidth = 158 + TabOrder = 9 + object CaseChk: TCheckBox + Left = 7 + Height = 19 + Top = 2 + Width = 115 + Caption = 'Casewise Deletion' + TabOrder = 0 + end + object CheckBox1: TCheckBox + Left = 7 + Height = 19 + Top = 16 + Width = 101 + Caption = 'z Scores to Grid' + TabOrder = 1 + end + object PcntileChk: TCheckBox + Left = 7 + Height = 19 + Top = 33 + Width = 138 + Caption = 'Show Percentile Ranks' + TabOrder = 2 + end + object AltQrtilesChk: TCheckBox + Left = 6 + Height = 19 + Top = 50 + Width = 116 + Caption = 'Show All Quartiles' + TabOrder = 3 + end + end + object HelpBtn: TButton + Tag = 119 + Left = 200 + Height = 32 + Top = 304 + Width = 82 + Caption = 'Help' + OnClick = HelpBtnClick + TabOrder = 10 + end +end diff --git a/applications/lazstats/source_orig/descriptiveunit.lrs b/applications/lazstats/source_orig/descriptiveunit.lrs new file mode 100644 index 000000000..3846f176d --- /dev/null +++ b/applications/lazstats/source_orig/descriptiveunit.lrs @@ -0,0 +1,141 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TDescriptiveFrm','FORMDATA',[ + 'TPF0'#15'TDescriptiveFrm'#14'DescriptiveFrm'#4'Left'#3#175#0#6'Height'#3#132 + +#1#3'Top'#2'['#5'Width'#3#178#1#7'Caption'#6#22'Descriptive Statistics'#12'C' + +'lientHeight'#3#132#1#11'ClientWidth'#3#178#1#6'OnShow'#7#8'FormShow'#10'LCL' + +'Version'#6#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#3#200#0#6'Height'#2#16#3 + +'Top'#3#23#1#5'Width'#3#175#0#7'Caption'#6' Confidence Interval for the Mean' + +#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#8#6'Height'#2#16#3'Top' + +#2#8#5'Width'#2'0'#7'Caption'#6#9'Variables'#11'ParentColor'#8#0#0#6'TLabel' + +#6'Label3'#4'Left'#3#239#0#6'Height'#2#16#3'Top'#2#8#5'Width'#2'-'#7'Caption' + +#6#8'Selected'#11'ParentColor'#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#8#6'He' + +'ight'#3#225#0#3'Top'#2#24#5'Width'#3#166#0#10'ItemHeight'#2#0#11'MultiSelec' + +'t'#9#8'TabOrder'#2#0#0#0#8'TListBox'#7'SelList'#4'Left'#3#239#0#6'Height'#3 + +#225#0#3'Top'#2#24#5'Width'#3#188#0#10'ItemHeight'#2#0#8'TabOrder'#2#1#0#0#5 + +'TEdit'#6'CIEdit'#4'Left'#3'{'#1#6'Height'#2#23#3'Top'#3#16#1#5'Width'#2')'#8 + +'TabOrder'#2#2#4'Text'#6#4'95.0'#0#0#7'TButton'#8'ResetBtn'#4'Left'#3'8'#1#6 + +'Height'#2' '#3'Top'#3'0'#1#5'Width'#2'P'#7'Caption'#6#5'Reset'#7'OnClick'#7 + +#13'ResetBtnClick'#8'TabOrder'#2#3#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#200 + +#0#6'Height'#2#30#3'Top'#3'X'#1#5'Width'#2'R'#7'Caption'#6#6'Cancel'#11'Moda' + +'lResult'#2#2#7'OnClick'#7#14'CancelBtnClick'#8'TabOrder'#2#4#0#0#7'TButton' + +#5'OKBtn'#4'Left'#3'8'#1#6'Height'#2#30#3'Top'#3'X'#1#5'Width'#2'P'#7'Captio' + +'n'#6#8'Continue'#11'ModalResult'#2#1#7'OnClick'#7#10'OKBtnClick'#8'TabOrder' + +#2#5#0#0#7'TBitBtn'#5'InBtn'#4'Left'#3#184#0#6'Height'#2''''#3'Top'#2#24#5'W' + +'idth'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0 + +'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0 + +#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)' + +#247'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190 + +'m'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255 + +'A'#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139 + +'I'#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160 + +#215#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255 + +#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128 + +#255'v'#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199 + +'t'#255#165#218#174#255#162#216#171#255#158#214#167#255#154#212#163#255#150 + +#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255 + +#129#197#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255 + +#255#0'h'#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255 + +'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163 + +'b'#255'U'#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247 + +';'#136'B'#219#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187 + +'A'#145'I'#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + ,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnCl' + +'ick'#7#10'InBtnClick'#8'TabOrder'#2#6#0#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#184 + +#0#6'Height'#2''''#3'Top'#2'H'#5'Width'#2'&'#10'Glyph.Data'#10':'#4#0#0'6'#4 + +#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0 + +#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0#255#255#255#0#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207 + +'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';' + +#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255 + +#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134#255#156#213#165#255#152#211 + +#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130 + +#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$' + +#255#255#255#255#0#255#255#255#0'h'#199't'#201#127#204#138#255#162#216#171 + +#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204 + +#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'x' + +#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209 + +#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M' + +#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255 + +'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't' + +#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't' + +#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#11'OutBtnClick'#8'TabOrde' + +'r'#2#7#0#0#7'TBitBtn'#6'AllBtn'#4'Left'#3#184#0#6'Height'#2''''#3'Top'#3#136 + +#0#5'Width'#2'&'#7'Caption'#6#3'ALL'#9'NumGlyphs'#2#0#7'OnClick'#7#11'AllBtn' + +'Click'#8'TabOrder'#2#8#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#12#6'Height' + +#2'X'#3'Top'#3#8#1#5'Width'#3#162#0#7'Caption'#6#7'Options'#12'ClientHeight' + +#2'F'#11'ClientWidth'#3#158#0#8'TabOrder'#2#9#0#9'TCheckBox'#7'CaseChk'#4'Le' + ,'ft'#2#7#6'Height'#2#19#3'Top'#2#2#5'Width'#2's'#7'Caption'#6#17'Casewise De' + +'letion'#8'TabOrder'#2#0#0#0#9'TCheckBox'#9'CheckBox1'#4'Left'#2#7#6'Height' + +#2#19#3'Top'#2#16#5'Width'#2'e'#7'Caption'#6#16'z Scores to Grid'#8'TabOrder' + +#2#1#0#0#9'TCheckBox'#10'PcntileChk'#4'Left'#2#7#6'Height'#2#19#3'Top'#2'!'#5 + +'Width'#3#138#0#7'Caption'#6#21'Show Percentile Ranks'#8'TabOrder'#2#2#0#0#9 + +'TCheckBox'#13'AltQrtilesChk'#4'Left'#2#6#6'Height'#2#19#3'Top'#2'2'#5'Width' + +#2't'#7'Caption'#6#18'Show All Quartiles'#8'TabOrder'#2#3#0#0#0#7'TButton'#7 + +'HelpBtn'#3'Tag'#2'w'#4'Left'#3#200#0#6'Height'#2' '#3'Top'#3'0'#1#5'Width'#2 + +'R'#7'Caption'#6#4'Help'#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#10#0#0#0 +]); diff --git a/applications/lazstats/source_orig/descriptiveunit.pas b/applications/lazstats/source_orig/descriptiveunit.pas new file mode 100644 index 000000000..e2787c3a7 --- /dev/null +++ b/applications/lazstats/source_orig/descriptiveunit.pas @@ -0,0 +1,404 @@ +unit DescriptiveUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, ExtCtrls, Buttons, MainUnit, Globals, functionsLib, OutPutUnit, DataProcs, + DictionaryUnit, contexthelpunit; + + +type + + { TDescriptiveFrm } + + TDescriptiveFrm = class(TForm) + CaseChk: TCheckBox; + CheckBox1: TCheckBox; + AltQrtilesChk: TCheckBox; + HelpBtn: TButton; + Label2: TLabel; + Label3: TLabel; + PcntileChk: TCheckBox; + GroupBox1: TGroupBox; + InBtn: TBitBtn; + OutBtn: TBitBtn; + AllBtn: TBitBtn; + ResetBtn: TButton; + CancelBtn: TButton; + OKBtn: TButton; + CIEdit: TEdit; + Label1: TLabel; + VarList: TListBox; + SelList: TListBox; + procedure AllBtnClick(Sender: TObject); + procedure CancelBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure HelpBtnClick(Sender: TObject); + procedure InBtnClick(Sender: TObject); + procedure OKBtnClick(Sender: TObject); + procedure OutBtnClick(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + + private + { private declarations } + sum, variance, stddev, value, mean, min, max, range, skew, prob, df, CI : double; + kurtosis, z, semean, seskew, sekurtosis, deviation, devsqr, M2, M3, M4 : double; + Q1, Q2, Q3, Q12, Q13, Q14, Q15, Q16, Q17, Q18, Q22, Q23, Q24, Q25, Q26 : double; + Q27, Q28, Q32, Q33, Q34, Q35, Q36, Q37, Q38, IQrange : double; + ncases, noselected : integer; + cellstring, gridstring, outline : string; + selected : IntDyneVec; + + public + { public declarations } + end; + +var + DescriptiveFrm: TDescriptiveFrm; + +implementation + +{ TDescriptiveFrm } + +procedure TDescriptiveFrm.ResetBtnClick(Sender: TObject); +var + i : integer; + +begin + VarList.Clear; + SelList.Clear; + for i := 1 to NoVariables do + VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + CaseChk.Checked := false; + OutBtn.Enabled := false; + CaseChk.Checked := false; + Selected := nil; +end; + +procedure TDescriptiveFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; + +procedure TDescriptiveFrm.HelpBtnClick(Sender: TObject); +begin + ContextHelpForm.HelpMessage((Sender as TButton).tag); +end; + +procedure TDescriptiveFrm.InBtnClick(Sender: TObject); +var + index, i : integer; + +begin + index := VarList.Items.Count; + i := 0; + while i < index do + begin + if (VarList.Selected[i]) then + begin + SelList.Items.Add(VarList.Items.Strings[i]); + VarList.Items.Delete(i); + index := index - 1; + i := 0; + end + else i := i + 1; + end; + OutBtn.Enabled := true; +end; + +procedure TDescriptiveFrm.OKBtnClick(Sender: TObject); +var + i, j, k, m : integer; + num, den, cases : double; + values, pcntrank : DblDyneVec; + +begin + noselected := SelList.Items.Count; + SetLength(Selected,noselected); + // Get selected variables + for i := 1 to noselected do + begin + cellstring := SelList.Items.Strings[i-1]; + for j := 1 to NoVariables do + if cellstring = OS3MainFrm.DataGrid.Cells[j,0] then selected[i-1] := j; + end; + + OutPutFrm.RichEdit.Clear; +// OutPutFrm.RichEdit.ParaGraph.Alignment := taLeftJustify; + OutPutFrm.RichEdit.Lines.Add('DISTRIBUTION PARAMETER ESTIMATES'); + OutPutFrm.RichEdit.Lines.Add(''); + SetLength(Values,NoCases); + SetLength(pcntrank,NoCases); + for j := 1 to noselected do + begin + deviation := 0.0; + devsqr := 0.0; + M2 := 0.0; + M3 := 0.0; + M4 := 0.0; + sum := 0.0; + variance := 0.0; + stddev := 0.0; + range := 0.0; + skew := 0.0; + kurtosis := 0.0; + ncases := 0; + df := 0.0; + seskew := 0.0; + kurtosis := 0.0; + sekurtosis := 0.0; + k := selected[j-1]; + CI := StrToFloat(CIEdit.Text) / 100.0; + prob := CI; + CI := (1.0 - CI) / 2.0; + CI := 1.0 - CI; + + if CheckBox1.Checked then // add a new column to the grid + begin + gridstring := OS3MainFrm.DataGrid.Cells[k,0]; + gridstring := Gridstring + 'z'; + DictionaryFrm.NewVar(NoVariables+1); + DictionaryFrm.DictGrid.Cells[1,NoVariables] := gridstring; + OS3MainFrm.DataGrid.Cells[NoVariables,0] := gridstring; + end; + + // Accumulate sums of squares, sums, etc. for variable j + min := 1.0e20; + max := -1.0e20; + for i := 1 to NoCases do + begin + if not GoodRecord(i,noselected,selected) then continue; + if CaseChk.Checked then + begin + if not ValidValue(i,selected[j-1]) then continue; + end + else if not GoodRecord(i,noselected,selected) then continue; + value := StrToFloat(OS3MainFrm.DataGrid.Cells[k,i]); + ncases := ncases + 1; + values[ncases-1] := value; + df := df + 1.0; + sum := sum + value; + variance := variance + (value * value); + if (value < min) then min := value; + if (value > max) then max := value; + end; +{ for i := 0 to ncases - 1 do // this is for debugging + begin + outline := format('Value = %8.3f',[values[i]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; } + if ncases > 0 then + begin + mean := sum / ncases; + range := max - min; + end; + if ncases > 1 then + begin + variance := variance - (sum * sum) / ncases; + variance := variance / (ncases - 1); + stddev := sqrt(variance); + semean := sqrt(variance / ncases); + if ncases < 120 then CI := semean * inverset(CI,df) + else CI := semean * inversez(CI); + end; + if variance = 0.0 then + begin + cellstring := OS3MainFrm.DataGrid.Cells[k,0]; + ShowMessage('No Variability in '+ cellstring + ' variable - ending analysis'); + exit; + end; + if ncases > 3 then // obtain skew, kurtosis and z scores + begin + for i := 1 to NoCases do + begin + if CaseChk.Checked then + begin + if not ValidValue(i,selected[j-1]) then continue; + end + else if not GoodRecord(i,noselected,selected) then continue; + value := StrToFloat(OS3MainFrm.DataGrid.Cells[k,i]); + if stddev > 0.0 then + begin + deviation := value - mean; + devsqr := deviation * deviation; + M2 := M2 + devsqr; + M3 := M3 + (deviation * devsqr); + M4 := M4 + (devsqr * devsqr); + z := (value - mean) / stddev; + if CheckBox1.Checked then + begin + cellstring := format('%8.5f',[z]); + OS3MainFrm.DataGrid.Cells[NoVariables,i] := cellstring; + end; + end; + end; + if ncases > 2 then + begin + skew := (ncases * M3) / + ((ncases - 1) * (ncases - 2) * stddev * variance); + cases := ncases; + num := 6.0 * cases * (cases - 1.0); + den := (cases - 2.0) * (cases + 1.0) * (cases + 3.0); + seskew := sqrt(num / den); + end; + if ncases > 3 then + begin + kurtosis := (ncases * (ncases + 1) * M4) - + (3 * M2 * M2 * (ncases - 1)); + kurtosis := kurtosis / + ( (ncases - 1) * (ncases - 2) * (ncases - 3) * (variance * variance) ); + sekurtosis := sqrt( (4.0 * (ncases * ncases - 1) * (seskew * seskew) ) / + ( (ncases - 3) * (ncases + 5) ) ); + end; + end; + // output results for the kth variable + cellstring := OS3MainFrm.DataGrid.Cells[k,0]; + outline := format('%s (N = %d) Sum = %14.3f',[cellstring,ncases,sum]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Mean = %10.3f Variance = %10.3f Std.Dev. = %10.3f', + [mean, variance, stddev]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Std.Error of Mean = %10.3f',[semean]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('%4.2f percent Confidence Interval for the mean = %8.3f to %8.3f', + [prob * 100.0, mean - CI, mean + CI]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Range = %10.3f Minimum = %10.3f Maximum = %10.3f', + [range, min, max]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Skewness = %10.3f Std. Error of Skew = %10.3f', + [skew, seskew]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Kurtosis = %10.3f Std. Error Kurtosis = %10.3f', + [kurtosis, sekurtosis]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + if ncases > 4 then // get percentiles and quartiles + begin + // get percentile ranks + if pcntilechk.Checked then PRank(k,pcntrank); + + // sort values and get quartiles + for i := 0 to ncases - 2 do + begin + for m := i + 1 to ncases -1 do + begin + if values[i] > values[m] then + begin + value := values[i]; + values[i] := values[m]; + values[m] := value; + end; + end; + end; + Q1 := Quartiles(2,0.25,ncases,values); + Q2 := Quartiles(2,0.5,ncases,values); + Q3 := Quartiles(2,0.75,ncases,values); + IQrange := Q3 - Q1; + outline := format('First Quartile = %8.3f',[Q1]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Median = %8.3f',[Q2]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Third Quartile = %8.3f',[Q3]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Interquartile range = %8.3f',[IQrange]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + end; + if (AltQrtilesChk.Checked) then + begin + OutPutFrm.RichEdit.Lines.Add('Alternative Methods for Obtaining Quartiles'); + OutPutFrm.RichEdit.Lines.Add(' Method 1 2 3 4 5 6 7 8'); + OutPutFrm.RichEdit.Lines.Add('Pcntile'); + Q1 := Quartiles(1,0.25,ncases,values); + Q12 := Quartiles(2,0.25,ncases,values); + Q13 := Quartiles(3,0.25,ncases,values); + Q14 := Quartiles(4,0.25,ncases,values); + Q15 := Quartiles(5,0.25,ncases,values); + Q16 := Quartiles(6,0.25,ncases,values); + Q17 := Quartiles(7,0.25,ncases,values); + Q18 := Quartiles(8,0.25,ncases,values); + outline := format('Q1 %8.3f%8.3f%8.3f%8.3f%8.3f%8.3f%8.3f%8.3f', + [Q1,Q12,Q13,Q14,Q15,Q16,Q17,Q18]); + OutPutFrm.RichEdit.Lines.Add(outline); + Q2 := Quartiles(1,0.5,ncases,values); + Q22 := Quartiles(2,0.5,ncases,values); + Q23 := Quartiles(3,0.5,ncases,values); + Q24 := Quartiles(4,0.5,ncases,values); + Q25 := Quartiles(5,0.5,ncases,values); + Q26 := Quartiles(6,0.5,ncases,values); + Q27 := Quartiles(7,0.5,ncases,values); + Q28 := Quartiles(8,0.5,ncases,values); + outline := format('Q2 %8.3f%8.3f%8.3f%8.3f%8.3f%8.3f%8.3f%8.3f', + [Q2,Q22,Q23,Q24,Q25,Q26,Q27,Q28]); + OutPutFrm.RichEdit.Lines.Add(outline); + Q3 := Quartiles(1,0.75,ncases,values); + Q32 := Quartiles(2,0.75,ncases,values); + Q33 := Quartiles(3,0.75,ncases,values); + Q34 := Quartiles(4,0.75,ncases,values); + Q35 := Quartiles(5,0.75,ncases,values); + Q36 := Quartiles(6,0.75,ncases,values); + Q37 := Quartiles(7,0.75,ncases,values); + Q38 := Quartiles(8,0.75,ncases,values); + outline := format('Q3 %8.3f%8.3f%8.3f%8.3f%8.3f%8.3f%8.3f%8.3f', + [Q3,Q32,Q33,Q34,Q35,Q36,Q37,Q38]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add('NOTES:'); + OutPutFrm.RichEdit.Lines.Add('Method 1 is the weighted average at X[np] where n is no. of cases, p is percentile / 100'); + OutPutFrm.RichEdit.Lines.Add('Method 2 is the weighted average at X[(n+1)p] This is used in this program.'); + OutPutFrm.RichEdit.Lines.Add('Method 3 is the empirical distribution function.'); + OutPutFrm.RichEdit.Lines.Add('Method 4 is called the empirical distribution function - averaging.'); + OutPutFrm.RichEdit.Lines.Add('Method 5 is called the empirical distribution function = Interpolation.'); + OutPutFrm.RichEdit.Lines.Add('Method 6 is the closest observation method.'); + OutPutFrm.RichEdit.Lines.Add('Method 7 is from the TrueBasic Statistics Graphics Toolkit.'); + OutPutFrm.RichEdit.Lines.Add('Method 8 was used in an older Microsoft Excel version.'); + OutPutFrm.RichEdit.Lines.Add('See the internet site http://www.xycoon.com/ for the above.'); + OutPutFrm.RichEdit.Lines.Add('========================================================'); + OutPutFrm.RichEdit.Lines.Add(''); + end; // end of experimental alternatives + end; // next j variable + OutPutFrm.ShowModal; + Selected := nil; + Values := nil; + pcntrank := nil; +end; + +procedure TDescriptiveFrm.OutBtnClick(Sender: TObject); +var + index: integer; + +begin + index := SelList.ItemIndex; + VarList.Items.Add(SelList.Items.Strings[index]); + SelList.Items.Delete(index); + InBtn.Enabled := true; + if SelList.Items.Count = 0 then OutBtn.Enabled := false; +end; + +procedure TDescriptiveFrm.CancelBtnClick(Sender: TObject); +begin + selected := nil; +end; + +procedure TDescriptiveFrm.AllBtnClick(Sender: TObject); +var + i : integer; + +begin + for i := 0 to VarList.Items.Count-1 do + SelList.Items.Add(VarList.Items.Strings[i]); + VarList.Clear; + OutBtn.Enabled := true; + InBtn.Enabled := false; +end; + +initialization + {$I descriptiveunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/dictionaryunit.lfm b/applications/lazstats/source_orig/dictionaryunit.lfm new file mode 100644 index 000000000..c1206740f --- /dev/null +++ b/applications/lazstats/source_orig/dictionaryunit.lfm @@ -0,0 +1,145 @@ +object DictionaryFrm: TDictionaryFrm + Left = 95 + Height = 477 + Top = 97 + Width = 656 + Caption = 'Dictionary Form' + ClientHeight = 477 + ClientWidth = 656 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 8 + Height = 14 + Top = 15 + Width = 310 + Caption = 'Note: Pressing the down arrow key will add a new row (variable)' + ParentColor = False + end + object DictGrid: TStringGrid + Left = 0 + Height = 249 + Top = 88 + Width = 642 + ColCount = 7 + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goRowSelect, goSmoothScroll] + RowCount = 2 + TabOrder = 0 + OnClick = DictGridClick + OnKeyDown = DictGridKeyDown + end + object Panel1: TPanel + Left = 0 + Height = 47 + Top = 430 + Width = 656 + Align = alBottom + ClientHeight = 47 + ClientWidth = 656 + TabOrder = 1 + object Label2: TLabel + Left = 8 + Height = 14 + Top = -382 + Width = 251 + Caption = 'Note: Do NOT delete a row if the data column exists' + ParentColor = False + end + object ReturnBtn: TButton + Left = 536 + Height = 32 + Top = 2 + Width = 93 + Caption = 'OK' + ModalResult = 1 + OnClick = ReturnBtnClick + TabOrder = 0 + end + object RowInstBtn: TButton + Left = 96 + Height = 32 + Top = 2 + Width = 111 + Caption = 'Insert Row Before' + OnClick = RowInstBtnClick + TabOrder = 1 + end + end + object CancelBtn: TButton + Left = 432 + Height = 32 + Top = 432 + Width = 93 + Caption = 'Cancel' + ModalResult = 2 + OnClick = CancelBtnClick + TabOrder = 2 + end + object TypeCombo: TComboBox + Left = 408 + Height = 21 + Top = 8 + Width = 106 + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'Type' + '(I)nteger' + '(F)loating Point' + '(S)tring' + '(M)oney' + '(D)ate' + ) + OnSelect = TypeComboSelect + Style = csDropDownList + TabOrder = 3 + Text = 'Type' + end + object JustCombo: TComboBox + Left = 536 + Height = 21 + Top = 8 + Width = 104 + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'Justification' + '(L)eft' + '(C)enter' + '(R)ight' + ) + OnSelect = JustComboSelect + Style = csDropDownList + TabOrder = 4 + Text = 'Justification' + end + object DescMemo: TMemo + Left = 6 + Height = 82 + Top = 342 + Width = 632 + Lines.Strings = ( + 'Memo2' + ) + TabOrder = 5 + end + object HelpBtn: TButton + Tag = 120 + Left = 8 + Height = 32 + Top = 40 + Width = 82 + Caption = 'Help' + OnClick = HelpBtnClick + TabOrder = 6 + end + object RowDelBtn: TButton + Left = 6 + Height = 32 + Top = 432 + Width = 82 + Caption = 'Delete Row' + OnClick = RowDelBtnClick + TabOrder = 7 + end +end diff --git a/applications/lazstats/source_orig/dictionaryunit.lrs b/applications/lazstats/source_orig/dictionaryunit.lrs new file mode 100644 index 000000000..101c3c8dd --- /dev/null +++ b/applications/lazstats/source_orig/dictionaryunit.lrs @@ -0,0 +1,38 @@ +LazarusResources.Add('TDictionaryFrm','FORMDATA',[ + 'TPF0'#14'TDictionaryFrm'#13'DictionaryFrm'#4'Left'#2'_'#6'Height'#3#221#1#3 + +'Top'#2'a'#5'Width'#3#144#2#7'Caption'#6#15'Dictionary Form'#12'ClientHeight' + +#3#221#1#11'ClientWidth'#3#144#2#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8 + +'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#14#3'Top'#2#15#5'Wi' + +'dth'#3'6'#1#7'Caption'#6'?Note: Pressing the down arrow key will add a new ' + +'row (variable)'#11'ParentColor'#8#0#0#11'TStringGrid'#8'DictGrid'#4'Left'#2 + +#0#6'Height'#3#249#0#3'Top'#2'X'#5'Width'#3#130#2#8'ColCount'#2#7#7'Options' + +#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goHorzLine'#13 + +'goRangeSelect'#9'goEditing'#11'goRowSelect'#14'goSmoothScroll'#0#8'RowCount' + +#2#2#8'TabOrder'#2#0#7'OnClick'#7#13'DictGridClick'#9'OnKeyDown'#7#15'DictGr' + +'idKeyDown'#0#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2'/'#3'Top'#3#174#1 + +#5'Width'#3#144#2#5'Align'#7#8'alBottom'#12'ClientHeight'#2'/'#11'ClientWidt' + +'h'#3#144#2#8'TabOrder'#2#1#0#6'TLabel'#6'Label2'#4'Left'#2#8#6'Height'#2#14 + +#3'Top'#3#130#254#5'Width'#3#251#0#7'Caption'#6'3Note: Do NOT delete a row i' + +'f the data column exists'#11'ParentColor'#8#0#0#7'TButton'#9'ReturnBtn'#4'L' + +'eft'#3#24#2#6'Height'#2' '#3'Top'#2#2#5'Width'#2']'#7'Caption'#6#2'OK'#11'M' + +'odalResult'#2#1#7'OnClick'#7#14'ReturnBtnClick'#8'TabOrder'#2#0#0#0#7'TButt' + +'on'#10'RowInstBtn'#4'Left'#2'`'#6'Height'#2' '#3'Top'#2#2#5'Width'#2'o'#7'C' + +'aption'#6#17'Insert Row Before'#7'OnClick'#7#15'RowInstBtnClick'#8'TabOrder' + +#2#1#0#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#176#1#6'Height'#2' '#3'Top'#3 + +#176#1#5'Width'#2']'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#7'OnClick'#7 + +#14'CancelBtnClick'#8'TabOrder'#2#2#0#0#9'TComboBox'#9'TypeCombo'#4'Left'#3 + +#152#1#6'Height'#2#21#3'Top'#2#8#5'Width'#2'j'#10'ItemHeight'#2#13#9'ItemInd' + +'ex'#2#0#13'Items.Strings'#1#6#4'Type'#6#9'(I)nteger'#6#16'(F)loating Point' + +#6#8'(S)tring'#6#7'(M)oney'#6#6'(D)ate'#0#8'OnSelect'#7#15'TypeComboSelect'#5 + +'Style'#7#14'csDropDownList'#8'TabOrder'#2#3#4'Text'#6#4'Type'#0#0#9'TComboB' + +'ox'#9'JustCombo'#4'Left'#3#24#2#6'Height'#2#21#3'Top'#2#8#5'Width'#2'h'#10 + +'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1#6#13'Justification'#6 + +#6'(L)eft'#6#8'(C)enter'#6#7'(R)ight'#0#8'OnSelect'#7#15'JustComboSelect'#5 + +'Style'#7#14'csDropDownList'#8'TabOrder'#2#4#4'Text'#6#13'Justification'#0#0 + +#5'TMemo'#8'DescMemo'#4'Left'#2#6#6'Height'#2'R'#3'Top'#3'V'#1#5'Width'#3'x' + +#2#13'Lines.Strings'#1#6#5'Memo2'#0#8'TabOrder'#2#5#0#0#7'TButton'#7'HelpBtn' + +#3'Tag'#2'x'#4'Left'#2#8#6'Height'#2' '#3'Top'#2'('#5'Width'#2'R'#7'Caption' + +#6#4'Help'#7'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#6#0#0#7'TButton'#9'Ro' + +'wDelBtn'#4'Left'#2#6#6'Height'#2' '#3'Top'#3#176#1#5'Width'#2'R'#7'Caption' + +#6#10'Delete Row'#7'OnClick'#7#14'RowDelBtnClick'#8'TabOrder'#2#7#0#0#0 +]); diff --git a/applications/lazstats/source_orig/dictionaryunit.pas b/applications/lazstats/source_orig/dictionaryunit.pas new file mode 100644 index 000000000..16805f865 --- /dev/null +++ b/applications/lazstats/source_orig/dictionaryunit.pas @@ -0,0 +1,352 @@ +unit DictionaryUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, Grids, ExtCtrls, Globals, OptionsUnit, contexthelpunit; + +type + + { TDictionaryFrm } + + TDictionaryFrm = class(TForm) + HelpBtn: TButton; + Label2: TLabel; + DescMemo: TMemo; + RowDelBtn: TButton; + RowInstBtn: TButton; + JustCombo: TComboBox; + TypeCombo: TComboBox; + Label1: TLabel; + ReturnBtn: TButton; + CancelBtn: TButton; + DictGrid: TStringGrid; + Panel1: TPanel; + procedure CancelBtnClick(Sender: TObject); + procedure DictGridClick(Sender: TObject); + procedure DictGridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState + ); + procedure FormShow(Sender: TObject); + procedure HelpBtnClick(Sender: TObject); + procedure JustComboClick(Sender: TObject); + procedure JustComboSelect(Sender: TObject); + procedure ReturnBtnClick(Sender: TObject); + procedure RowDelBtnClick(Sender: TObject); + procedure RowInstBtnClick(Sender: TObject); + procedure Defaults(Sender: TObject; row : integer); + procedure TypeComboSelect(Sender: TObject); + + private + { private declarations } + public + { public declarations } + procedure DelRow(row : integer); + procedure NewVar(row : integer); + procedure PasteVar(row : integer); + procedure CopyVar(row : integer); + end; + +var + DictionaryFrm: TDictionaryFrm; + +implementation + +{ TDictionaryFrm } + +uses MainUnit; + +procedure TDictionaryFrm.ReturnBtnClick(Sender: TObject); +var + i, j, count : integer; + NoRows : integer; +begin + // determine number of rows with complete data + NoRows := 0; + for i := 1 to DictGrid.RowCount - 1 do + begin + count := 0; + for j := 1 to 5 do + begin + if DictGrid.Cells[j,i] <> '' then count := count + 1; + end; + if count > 4 then NoRows := NoRows + 1; + end; + if NoRows < DictGrid.RowCount - 1 then + begin + ShowMessage('Error! A definition entry for one or more variables missing!'); + DictGrid.SetFocus; + exit; + end; + + // Place short labels in main grid + OS3MainFrm.DataGrid.ColCount := NoRows + 1; + for i := 1 to NoRows do OS3MainFrm.DataGrid.Cells[i,0] := DictGrid.Cells[1,i]; + + // Make sure integers have a 0 for decimals + for i := 1 to NoRows do + if DictGrid.Cells[4,i] = 'I' then DictGrid.Cells[5,i] := '0'; + OS3MainFrm.NoVarsEdit.Text := IntToStr(OS3MainFrm.DataGrid.ColCount-1); + if OS3MainFrm.FileNameEdit.Text = '' then exit; +end; + +procedure TDictionaryFrm.RowDelBtnClick(Sender: TObject); +var + index : integer; + i, j : integer; + +begin + index := DictGrid.Row; + if index = DictGrid.RowCount-1 then // last row + begin + for i := 0 to 7 do DictGrid.Cells[i,index] := ''; + DictGrid.RowCount := DictGrid.RowCount - 1; + VarDefined[index] := false; + end + else + begin // move lines below current lines up and delete last + for i := index+1 to DictGrid.RowCount - 1 do + begin + for j := 0 to 6 do DictGrid.Cells[j,i-1] := DictGrid.Cells[j,i]; + VarDefined[i-1] := VarDefined[i]; + end; + VarDefined[DictGrid.RowCount-1] := false; + DictGrid.RowCount := DictGrid.RowCount - 1; + for i := 1 to DictGrid.RowCount - 1 do // renumber rows + DictGrid.Cells[0,i] := IntToStr(i); + end; +end; + +procedure TDictionaryFrm.RowInstBtnClick(Sender: TObject); +var + index : integer; + i, j : integer; + +begin + index := DictGrid.Row; + DictGrid.RowCount := DictGrid.RowCount + 1; // add new row to grid + // move all rows from index down 1 + for i := DictGrid.RowCount - 1 downto index+1 do + begin + for j := 1 to 6 do + begin + DictGrid.Cells[j,i] := DictGrid.Cells[j,i-1]; + end; + VarDefined[i] := VarDefined[i-1]; + end; + + // place default values in new row + Defaults(Self,index); + VarDefined[index] := true; +end; + + +procedure TDictionaryFrm.FormShow(Sender: TObject); +begin + DictGrid.ColCount := 8; + if NoVariables = 0 then DictGrid.RowCount := 2 + else DictGrid.RowCount := NoVariables + 1; + + // insert headings + DictGrid.Cells[0,0] := 'VAR/CHAR.'; + DictGrid.Cells[1,0] := 'Short Name'; + DictGrid.Cells[2,0] := 'Long Name'; + DictGrid.Cells[3,0] := 'Width'; + DictGrid.Cells[4,0] := 'Type'; + DictGrid.Cells[5,0] := 'Decimals'; + DictGrid.Cells[6,0] := 'Missing'; + DictGrid.Cells[7,0] := 'Justify'; + DictGrid.Cells[0,1] := '1'; + DictGrid.ColWidths[1] := 100; + DictGrid.ColWidths[2] := 200; + DictGrid.ColWidths[3] := 50; + DictGrid.ColWidths[4] := 50; + DictGrid.ColWidths[5] := 50; + DictGrid.ColWidths[6] := 50; + DictGrid.ColWidths[7] := 50; + + // check for absence of a defined variable + if VarDefined[1] = false then + begin + // load defaults + Defaults(Self,1); + VarDefined[1] := true; + end; +end; + +procedure TDictionaryFrm.HelpBtnClick(Sender: TObject); +begin + ContextHelpForm.HelpMessage((Sender as TButton).tag); +end; + +procedure TDictionaryFrm.JustComboClick(Sender: TObject); +var + achar : char; + astr : string; + index : integer; + GRow : integer; + +begin + index := JustCombo.ItemIndex; + astr := JustCombo.Items.Strings[index]; + achar := astr[2]; + GRow := DictGrid.Row; + DictGrid.Cells[7,GRow] := achar; + JustCombo.Text := 'Justification'; +end; + +procedure TDictionaryFrm.JustComboSelect(Sender: TObject); +var + achar : char; + astr : string; + index : integer; + GRow : integer; + +begin + index := JustCombo.ItemIndex; + astr := JustCombo.Items.Strings[index]; + achar := astr[2]; + GRow := DictGrid.Row; + if GRow>0 then DictGrid.Cells[7,GRow] := achar; + JustCombo.Text := 'Justification'; + DictGrid.SetFocus; +end; + +procedure TDictionaryFrm.CancelBtnClick(Sender: TObject); +begin + DictionaryFrm.Hide; +end; + +procedure TDictionaryFrm.DictGridClick(Sender: TObject); +begin + DictGrid.SelectedColor := clGray; +end; + +procedure TDictionaryFrm.DictGridKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +var + x, y, v : integer; +begin + x := DictGrid.Row; + y := DictGrid.Col; + v := ord(Key); + case v of + 13 : if y = 7 then DictGrid.Col := 1 else DictGrid.Col := DictGrid.Col + 1; + 40 : begin // arrow down key + if x = DictGrid.RowCount - 1 then + begin + if DictGrid.RowCount < (x + 2) then + DictGrid.RowCount := DictGrid.RowCount + 1; + Defaults(Self,x+1); + VarDefined[x+1] := true; + end; + end; + end; +end; + +procedure TDictionaryFrm.Defaults(Sender: TObject; row : integer); +var i : integer; +begin + DictGrid.Cells[0,row] := IntToStr(row); + DictGrid.Cells[1,row] := 'VAR.' + IntToStr(row); + DictGrid.Cells[2,row] := 'VARIABLE ' + IntToStr(row); + DictGrid.Cells[3,row] := '8'; + DictGrid.Cells[4,row] := 'F'; + DictGrid.Cells[5,row] := '2'; + DictGrid.Cells[6,row] := ' '; + DictGrid.Cells[7,row] := 'L'; + for i := 1 to DictGrid.RowCount - 1 do DictGrid.Cells[0,i] := IntToStr(i); + if OptionsFrm.DefaultMiss = 0 then DictGrid.Cells[6,row] := ''; + if OptionsFrm.DefaultMiss = 1 then DictGrid.Cells[6,row] := '.'; + if OptionsFrm.DefaultMiss = 2 then DictGrid.Cells[6,row] := '0'; + If OptionsFrm.DefaultMiss = 3 then DictGrid.Cells[6,row] := '99999'; + if OptionsFrm.DefaultJust <> 0 then + begin + if OptionsFrm.DefaultJust = 1 then DictGrid.Cells[7,row] := 'C' + else DictGrid.Cells[7,row] := 'R'; + end; +end; + +procedure TDictionaryFrm.TypeComboSelect(Sender: TObject); +var + achar : char; + astr : string; + index : integer; + GRow : integer; +begin + index := TypeCombo.ItemIndex; + astr := TypeCombo.Items.Strings[index]; + achar := astr[2]; + GRow := DictGrid.Row; + if GRow>0 then + begin + DictGrid.Cells[4,GRow] := achar; + if achar='F' then DictGrid.Cells[5,GRow] := '3' // set decimal digits + else DictGrid.Cells[5,GRow] := '0'; + end; + TypeCombo.Text := 'Type'; + DictGrid.SetFocus; +end; + +procedure TDictionaryFrm.DelRow(row : integer); +begin + DictGrid.Row := row; + TempVarItm.Clear; + DictGrid.Rows[row].SaveToStream(TempVarItm); + RowDelBtnClick(Self); +end; +//------------------------------------------------------------------- + +procedure TDictionaryFrm.NewVar(row : integer); +var + i, j : integer; +begin + DictGrid.RowCount := DictGrid.RowCount + 1; // add new row + NoVariables := NoVariables + 1; + if (row < NoVariables) AND (NoVariables > 1) then // move current rows down 1 + begin + for i := NoVariables downto row + 1 do + begin + for j := 1 to 7 do DictGrid.Cells[j,i] := DictGrid.Cells[j,i-1]; + VarDefined[i] := VarDefined[i-1]; + end; + end; + // put default values in new variable + Defaults(Self,row); + VarDefined[row] := true; + + // add to grid if grid column does not exist + if OS3MainFrm.DataGrid.ColCount < row then + begin + OS3MainFrm.DataGrid.ColCount := OS3MainFrm.DataGrid.ColCount + 1; + OS3MainFrm.DataGrid.Cells[row,0] := DictionaryFrm.DictGrid.Cells[1,row]; + end; + ReturnBtnClick(Self); +end; +//------------------------------------------------------------------- + +procedure TDictionaryFrm.PasteVar(row : integer); +var i : integer; +begin + TempVarItm.Position := 0; + DictGrid.Rows[row].LoadFromStream(TempVarItm); + for i := 1 to DictGrid.RowCount - 1 do DictGrid.Cells[0,i] := IntToStr(i); +// FormShow(Self); +end; +//------------------------------------------------------------------- + +procedure TDictionaryFrm.CopyVar(row : integer); +begin + DictGrid.Row := row; + TempVarItm.Clear; + DictGrid.Rows[row].SaveToStream(TempVarItm); +end; +//------------------------------------------------------------------- + +initialization + {$I dictionaryunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/difunit.lfm b/applications/lazstats/source_orig/difunit.lfm new file mode 100644 index 000000000..a907e6983 --- /dev/null +++ b/applications/lazstats/source_orig/difunit.lfm @@ -0,0 +1,513 @@ +object DIFFrm: TDIFFrm + Left = 140 + Height = 455 + Top = 99 + Width = 537 + Caption = 'DIF Specifications' + ClientHeight = 455 + ClientWidth = 537 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 8 + Height = 14 + Top = 16 + Width = 90 + Caption = 'Available Variables' + ParentColor = False + end + object Label2: TLabel + Left = 211 + Height = 14 + Top = 16 + Width = 72 + Caption = 'Items Selected' + ParentColor = False + end + object Label3: TLabel + Left = 214 + Height = 14 + Top = 208 + Width = 85 + Caption = 'Grouping Variable' + ParentColor = False + end + object Label4: TLabel + Left = 207 + Height = 14 + Top = 288 + Width = 116 + Caption = 'Reference Group Code?' + ParentColor = False + end + object Label5: TLabel + Left = 207 + Height = 14 + Top = 320 + Width = 91 + Caption = 'Focal Group Code?' + ParentColor = False + end + object Label6: TLabel + Left = 207 + Height = 14 + Top = 352 + Width = 99 + Caption = 'No. of Score Levels?' + ParentColor = False + end + object Label7: TLabel + Left = 376 + Height = 14 + Top = 264 + Width = 119 + Caption = 'Enter Bounds for Levels:' + ParentColor = False + end + object Label8: TLabel + Left = 376 + Height = 14 + Top = 296 + Width = 28 + Caption = 'Down' + ParentColor = False + end + object Label9: TLabel + Left = 448 + Height = 14 + Top = 296 + Width = 14 + Caption = 'Up' + ParentColor = False + end + object Label10: TLabel + Left = 488 + Height = 14 + Top = 296 + Width = 26 + Caption = 'Level' + ParentColor = False + end + object Label11: TLabel + Left = 377 + Height = 14 + Top = 351 + Width = 63 + Caption = 'Lower Bound' + ParentColor = False + end + object UpBoundlabel: TLabel + Left = 373 + Height = 14 + Top = 384 + Width = 67 + Caption = 'Upper Bound:' + ParentColor = False + end + object VarList: TListBox + Left = 8 + Height = 296 + Top = 35 + Width = 157 + ItemHeight = 0 + MultiSelect = True + TabOrder = 0 + end + object ItemInBtn: TBitBtn + Left = 173 + Height = 27 + Top = 40 + Width = 30 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE + 6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580 + 3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3 + 71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7 + 74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7 + 74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = ItemInBtnClick + TabOrder = 1 + end + object ItemOutBtn: TBitBtn + Left = 173 + Height = 27 + Top = 72 + Width = 30 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580 + 3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3 + 71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7 + 74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF + FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = ItemOutBtnClick + TabOrder = 2 + end + object AllBtn: TBitBtn + Left = 173 + Height = 27 + Top = 120 + Width = 30 + Caption = 'ALL' + NumGlyphs = 0 + OnClick = AllBtnClick + TabOrder = 3 + end + object GrpInBtn: TBitBtn + Left = 173 + Height = 27 + Top = 208 + Width = 30 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00216324B81D5E2006FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF002A702F38256929F7216324D9FFFFFF00FFFFFF00FFFFFF00FFFFFF0061BE + 6DFF5DB868FF58B162FF53A95CFF4DA156FF47994FFF419149FF3B8842FF3580 + 3BFF3F8845FF59A15EFF448B49FF216324CFFFFFFF00FFFFFF00FFFFFF0065C3 + 71FFA0D7A9FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF458C4AFF216324C4FFFFFF00FFFFFF0068C7 + 74FFA5DAAEFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF4A9150FF256929C9FFFFFF00FFFFFF0068C7 + 74FF68C774FF65C371FF61BE6DFF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF5AA362FF559D5CFF2F7835D1FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00419149F73B8842DBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0047994FBB41914906FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = GrpInBtnClick + TabOrder = 4 + end + object GrpOutBtn: TBitBtn + Left = 173 + Height = 27 + Top = 240 + Width = 30 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF004DA1560647994FB8FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0053A95CD94DA156F747994F38FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF005DB868CF71BE7BFF7AC183FF5BAA64FF47994FFF419149FF3B8842FF3580 + 3BFF2F7835FF2A702FFF256929FF216324FF1D5E20FFFFFFFF00FFFFFF0065C3 + 71C47BC886FF9CD5A5FF98D3A1FF94D09DFF90CE98FF8BCB93FF87C98EFF82C6 + 89FF7EC384FF7AC180FF76BE7CFF72BD78FF216324FFFFFFFF00FFFFFF0068C7 + 74C97FCC8AFFA2D8ABFF9ED6A7FF9AD4A3FF96D29FFF93CF9AFF8ECC95FF89CA + 90FF85C78BFF81C587FF7DC282FF78C07EFF256929FFFFFFFF00FFFFFF00FFFF + FF0068C774D180CD8BFF7CC987FF5DB868FF58B162FF53A95CFF4DA156FF4799 + 4FFF419149FF3B8842FF35803BFF2F7835FF2A702FFFFFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C774DB65C371F7FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0068C7740668C774BBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + NumGlyphs = 0 + OnClick = GrpOutBtnClick + TabOrder = 5 + end + object ItemsList: TListBox + Left = 211 + Height = 149 + Top = 35 + Width = 148 + ItemHeight = 0 + TabOrder = 6 + end + object GroupVarEdit: TEdit + Left = 211 + Height = 21 + Top = 224 + Width = 147 + TabOrder = 7 + Text = 'GroupVarEdit' + end + object RefGrpEdit: TEdit + Left = 329 + Height = 21 + Top = 281 + Width = 34 + TabOrder = 8 + Text = 'RefGrpEdit' + end + object TrgtGrpEdit: TEdit + Left = 329 + Height = 21 + Top = 310 + Width = 34 + TabOrder = 9 + Text = 'Edit1' + end + object LevelsEdit: TEdit + Left = 329 + Height = 21 + Top = 344 + Width = 34 + OnExit = LevelsEditExit + TabOrder = 10 + Text = 'Edit1' + end + object GroupBox1: TGroupBox + Left = 368 + Height = 233 + Top = 16 + Width = 160 + Caption = 'Options' + ClientHeight = 215 + ClientWidth = 156 + TabOrder = 11 + object ItemStatsChk: TCheckBox + Left = 7 + Height = 17 + Top = 3 + Width = 88 + Caption = 'Item Statistics' + TabOrder = 0 + end + object TestStatsChk: TCheckBox + Left = 7 + Height = 17 + Top = 23 + Width = 87 + Caption = 'Test Statistics' + TabOrder = 1 + end + object ItemCorrsChk: TCheckBox + Left = 7 + Height = 17 + Top = 47 + Width = 125 + Caption = 'Item Intercorrelations' + TabOrder = 2 + end + object ItemTestChk: TCheckBox + Left = 8 + Height = 17 + Top = 71 + Width = 128 + Caption = 'Item-Test Correlations' + TabOrder = 3 + end + object AlphaChk: TCheckBox + Left = 8 + Height = 17 + Top = 95 + Width = 95 + Caption = 'Alpha Reliability' + TabOrder = 4 + end + object MHChk: TCheckBox + Left = 7 + Height = 17 + Top = 119 + Width = 99 + Caption = 'Mantel-Haenszel' + TabOrder = 5 + end + object LogisticChk: TCheckBox + Left = 8 + Height = 17 + Top = 143 + Width = 111 + Caption = 'Logistic Regression' + TabOrder = 6 + end + object CurvesChk: TCheckBox + Left = 8 + Height = 17 + Top = 167 + Width = 109 + Caption = 'Item Char. Curves' + TabOrder = 7 + end + object CountsChk: TCheckBox + Left = 7 + Height = 17 + Top = 191 + Width = 82 + Caption = 'Level Counts' + TabOrder = 8 + end + end + object LevelScroll: TScrollBar + Left = 376 + Height = 16 + Top = 315 + Width = 89 + Min = 1 + PageSize = 0 + Position = 1 + TabOrder = 12 + OnScroll = LevelScrollScroll + end + object LevelNoEdit: TEdit + Left = 481 + Height = 21 + Top = 313 + Width = 33 + TabOrder = 13 + Text = 'LevelNoEdit' + end + object LowBoundEdit: TEdit + Left = 480 + Height = 21 + Top = 344 + Width = 33 + OnExit = LowBoundEditExit + TabOrder = 14 + Text = 'Edit4' + end + object UpBoundEdit: TEdit + Left = 480 + Height = 21 + Top = 376 + Width = 33 + OnExit = UpBoundEditExit + TabOrder = 15 + Text = 'Edit4' + end + object ResetBtn: TButton + Left = 104 + Height = 32 + Top = 408 + Width = 69 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 16 + end + object CancelBtn: TButton + Left = 192 + Height = 32 + Top = 408 + Width = 69 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 17 + end + object ComputeBtn: TButton + Left = 280 + Height = 32 + Top = 408 + Width = 77 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 18 + end + object ReturnBtn: TButton + Left = 373 + Height = 32 + Top = 408 + Width = 72 + Caption = 'Return' + ModalResult = 1 + OnClick = ReturnBtnClick + TabOrder = 19 + end + object HelpBtn: TButton + Tag = 122 + Left = 8 + Height = 32 + Top = 408 + Width = 82 + Caption = 'Help' + OnClick = HelpBtnClick + TabOrder = 20 + end +end diff --git a/applications/lazstats/source_orig/difunit.lrs b/applications/lazstats/source_orig/difunit.lrs new file mode 100644 index 000000000..7c2a99012 --- /dev/null +++ b/applications/lazstats/source_orig/difunit.lrs @@ -0,0 +1,285 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TDIFFrm','FORMDATA',[ + 'TPF0'#7'TDIFFrm'#6'DIFFrm'#4'Left'#3#140#0#6'Height'#3#199#1#3'Top'#2'c'#5'W' + +'idth'#3#25#2#7'Caption'#6#18'DIF Specifications'#12'ClientHeight'#3#199#1#11 + +'ClientWidth'#3#25#2#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6#8'0.9.28.2'#0#6 + +'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#14#3'Top'#2#16#5'Width'#2'Z'#7'Ca' + +'ption'#6#19'Available Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4 + +'Left'#3#211#0#6'Height'#2#14#3'Top'#2#16#5'Width'#2'H'#7'Caption'#6#14'Item' + +'s Selected'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#3#214#0#6'Hei' + +'ght'#2#14#3'Top'#3#208#0#5'Width'#2'U'#7'Caption'#6#17'Grouping Variable'#11 + +'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#207#0#6'Height'#2#14#3'Top' + +#3' '#1#5'Width'#2't'#7'Caption'#6#21'Reference Group Code?'#11'ParentColor' + +#8#0#0#6'TLabel'#6'Label5'#4'Left'#3#207#0#6'Height'#2#14#3'Top'#3'@'#1#5'Wi' + +'dth'#2'['#7'Caption'#6#17'Focal Group Code?'#11'ParentColor'#8#0#0#6'TLabel' + +#6'Label6'#4'Left'#3#207#0#6'Height'#2#14#3'Top'#3'`'#1#5'Width'#2'c'#7'Capt' + +'ion'#6#20'No. of Score Levels?'#11'ParentColor'#8#0#0#6'TLabel'#6'Label7'#4 + +'Left'#3'x'#1#6'Height'#2#14#3'Top'#3#8#1#5'Width'#2'w'#7'Caption'#6#24'Ente' + +'r Bounds for Levels:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label8'#4'Left'#3'x' + +#1#6'Height'#2#14#3'Top'#3'('#1#5'Width'#2#28#7'Caption'#6#4'Down'#11'Parent' + +'Color'#8#0#0#6'TLabel'#6'Label9'#4'Left'#3#192#1#6'Height'#2#14#3'Top'#3'(' + +#1#5'Width'#2#14#7'Caption'#6#2'Up'#11'ParentColor'#8#0#0#6'TLabel'#7'Label1' + +'0'#4'Left'#3#232#1#6'Height'#2#14#3'Top'#3'('#1#5'Width'#2#26#7'Caption'#6#5 + +'Level'#11'ParentColor'#8#0#0#6'TLabel'#7'Label11'#4'Left'#3'y'#1#6'Height'#2 + +#14#3'Top'#3'_'#1#5'Width'#2'?'#7'Caption'#6#11'Lower Bound'#11'ParentColor' + +#8#0#0#6'TLabel'#12'UpBoundlabel'#4'Left'#3'u'#1#6'Height'#2#14#3'Top'#3#128 + +#1#5'Width'#2'C'#7'Caption'#6#12'Upper Bound:'#11'ParentColor'#8#0#0#8'TList' + +'Box'#7'VarList'#4'Left'#2#8#6'Height'#3'('#1#3'Top'#2'#'#5'Width'#3#157#0#10 + +'ItemHeight'#2#0#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitBtn'#9'ItemInBt' + +'n'#4'Left'#3#173#0#6'Height'#2#27#3'Top'#2'('#5'Width'#2#30#10'Glyph.Data' + +#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0 + +#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'!c$'#184#29'^' + +' '#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247'!c$'#217#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0'a'#190'm'#255']'#184'h'#255'X'#177 + +'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255 + +'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I'#255'!c$'#207#255#255#255 + +#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215#169#255#156#213#165#255 + +#152#211#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142 + +#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'E'#140'J' + +#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255#165#218#174#255#162 + +#216#171#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255 + +#142#204#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130 + +#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h'#199't'#255'h'#199 + +'t'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255 + +'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U'#157'\'#255'/x5' + +#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B'#219#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I'#6#255#255#255 + ,#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#14'ItemInBtnClick' + +#8'TabOrder'#2#1#0#0#7'TBitBtn'#10'ItemOutBtn'#4'Left'#3#173#0#6'Height'#2#27 + +#3'Top'#2'H'#5'Width'#2#30#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0 + +#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd' + +#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'M'#161'V'#6'G' + +#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'S'#169'\'#217'M'#161 + +'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207'q'#190'{'#255'z'#193#131 + +#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/' + +'x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255#255#255#0#255#255#255#0'e' + +#195'q'#196'{'#200#134#255#156#213#165#255#152#211#161#255#148#208#157#255 + +#144#206#152#255#139#203#147#255#135#201#142#255#130#198#137#255'~'#195#132 + +#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$'#255#255#255#255#0#255 + +#255#255#0'h'#199't'#201#127#204#138#255#162#216#171#255#158#214#167#255#154 + +#212#163#255#150#210#159#255#147#207#154#255#142#204#149#255#137#202#144#255 + +#133#199#139#255#129#197#135#255'}'#194#130#255'x'#192'~'#255'%i)'#255#255 + +#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209#128#205#139#255'|'#201 + +#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O' + +#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255#255#255#255 + +#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#219'e'#195'q'#247#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#6'h'#199't'#187#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#9'Num' + ,'Glyphs'#2#0#7'OnClick'#7#15'ItemOutBtnClick'#8'TabOrder'#2#2#0#0#7'TBitBtn' + +#6'AllBtn'#4'Left'#3#173#0#6'Height'#2#27#3'Top'#2'x'#5'Width'#2#30#7'Captio' + +'n'#6#3'ALL'#9'NumGlyphs'#2#0#7'OnClick'#7#11'AllBtnClick'#8'TabOrder'#2#3#0 + +#0#7'TBitBtn'#8'GrpInBtn'#4'Left'#3#173#0#6'Height'#2#27#3'Top'#3#208#0#5'Wi' + +'dth'#2#30#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'(' + +#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0 + +#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0'!c$'#184#29'^ '#6#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'*p/8%i)'#247 + +'!c$'#217#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'a'#190'm' + +#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A' + +#145'I'#255';'#136'B'#255'5'#128';'#255'?'#136'E'#255'Y'#161'^'#255'D'#139'I' + +#255'!c$'#207#255#255#255#0#255#255#255#0#255#255#255#0'e'#195'q'#255#160#215 + +#169#255#156#213#165#255#152#211#161#255#148#208#157#255#144#206#152#255#139 + +#203#147#255#135#201#142#255#130#198#137#255'~'#195#132#255'z'#193#128#255'v' + +#190'|'#255'E'#140'J'#255'!c$'#196#255#255#255#0#255#255#255#0'h'#199't'#255 + +#165#218#174#255#162#216#171#255#158#214#167#255#154#212#163#255#150#210#159 + +#255#147#207#154#255#142#204#149#255#137#202#144#255#133#199#139#255#129#197 + +#135#255'}'#194#130#255'J'#145'P'#255'%i)'#201#255#255#255#0#255#255#255#0'h' + +#199't'#255'h'#199't'#255'e'#195'q'#255'a'#190'm'#255']'#184'h'#255'X'#177'b' + +#255'S'#169'\'#255'M'#161'V'#255'G'#153'O'#255'A'#145'I'#255'Z'#163'b'#255'U' + +#157'\'#255'/x5'#209#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'A'#145'I'#247';'#136'B' + +#219#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'G'#153'O'#187'A'#145'I' + +#6#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#13 + +'GrpInBtnClick'#8'TabOrder'#2#4#0#0#7'TBitBtn'#9'GrpOutBtn'#4'Left'#3#173#0#6 + +'Height'#2#27#3'Top'#3#240#0#5'Width'#2#30#10'Glyph.Data'#10':'#4#0#0'6'#4#0 + +#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0 + +#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + ,#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0'M'#161'V'#6'G'#153'O'#184#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0'S'#169'\'#217'M'#161'V'#247'G'#153'O8'#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0']'#184'h'#207 + +'q'#190'{'#255'z'#193#131#255'['#170'd'#255'G'#153'O'#255'A'#145'I'#255';' + +#136'B'#255'5'#128';'#255'/x5'#255'*p/'#255'%i)'#255'!c$'#255#29'^ '#255#255 + +#255#255#0#255#255#255#0'e'#195'q'#196'{'#200#134#255#156#213#165#255#152#211 + +#161#255#148#208#157#255#144#206#152#255#139#203#147#255#135#201#142#255#130 + +#198#137#255'~'#195#132#255'z'#193#128#255'v'#190'|'#255'r'#189'x'#255'!c$' + +#255#255#255#255#0#255#255#255#0'h'#199't'#201#127#204#138#255#162#216#171 + +#255#158#214#167#255#154#212#163#255#150#210#159#255#147#207#154#255#142#204 + +#149#255#137#202#144#255#133#199#139#255#129#197#135#255'}'#194#130#255'x' + +#192'~'#255'%i)'#255#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't'#209 + +#128#205#139#255'|'#201#135#255']'#184'h'#255'X'#177'b'#255'S'#169'\'#255'M' + +#161'V'#255'G'#153'O'#255'A'#145'I'#255';'#136'B'#255'5'#128';'#255'/x5'#255 + +'*p/'#255#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't' + +#219'e'#195'q'#247#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0'h'#199't' + +#6'h'#199't'#187#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 + +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255 + +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255 + +#255#0#255#255#255#0#9'NumGlyphs'#2#0#7'OnClick'#7#14'GrpOutBtnClick'#8'TabO' + +'rder'#2#5#0#0#8'TListBox'#9'ItemsList'#4'Left'#3#211#0#6'Height'#3#149#0#3 + +'Top'#2'#'#5'Width'#3#148#0#10'ItemHeight'#2#0#8'TabOrder'#2#6#0#0#5'TEdit' + +#12'GroupVarEdit'#4'Left'#3#211#0#6'Height'#2#21#3'Top'#3#224#0#5'Width'#3 + +#147#0#8'TabOrder'#2#7#4'Text'#6#12'GroupVarEdit'#0#0#5'TEdit'#10'RefGrpEdit' + +#4'Left'#3'I'#1#6'Height'#2#21#3'Top'#3#25#1#5'Width'#2'"'#8'TabOrder'#2#8#4 + +'Text'#6#10'RefGrpEdit'#0#0#5'TEdit'#11'TrgtGrpEdit'#4'Left'#3'I'#1#6'Height' + +#2#21#3'Top'#3'6'#1#5'Width'#2'"'#8'TabOrder'#2#9#4'Text'#6#5'Edit1'#0#0#5'T' + +'Edit'#10'LevelsEdit'#4'Left'#3'I'#1#6'Height'#2#21#3'Top'#3'X'#1#5'Width'#2 + +'"'#6'OnExit'#7#14'LevelsEditExit'#8'TabOrder'#2#10#4'Text'#6#5'Edit1'#0#0#9 + +'TGroupBox'#9'GroupBox1'#4'Left'#3'p'#1#6'Height'#3#233#0#3'Top'#2#16#5'Widt' + +'h'#3#160#0#7'Caption'#6#7'Options'#12'ClientHeight'#3#215#0#11'ClientWidth' + +#3#156#0#8'TabOrder'#2#11#0#9'TCheckBox'#12'ItemStatsChk'#4'Left'#2#7#6'Heig' + +'ht'#2#17#3'Top'#2#3#5'Width'#2'X'#7'Caption'#6#15'Item Statistics'#8'TabOrd' + +'er'#2#0#0#0#9'TCheckBox'#12'TestStatsChk'#4'Left'#2#7#6'Height'#2#17#3'Top' + +#2#23#5'Width'#2'W'#7'Caption'#6#15'Test Statistics'#8'TabOrder'#2#1#0#0#9'T' + +'CheckBox'#12'ItemCorrsChk'#4'Left'#2#7#6'Height'#2#17#3'Top'#2'/'#5'Width'#2 + +'}'#7'Caption'#6#22'Item Intercorrelations'#8'TabOrder'#2#2#0#0#9'TCheckBox' + +#11'ItemTestChk'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'G'#5'Width'#3#128#0#7'C' + +'aption'#6#22'Item-Test Correlations'#8'TabOrder'#2#3#0#0#9'TCheckBox'#8'Alp' + +'haChk'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'_'#5'Width'#2'_'#7'Caption'#6#17 + +'Alpha Reliability'#8'TabOrder'#2#4#0#0#9'TCheckBox'#5'MHChk'#4'Left'#2#7#6 + +'Height'#2#17#3'Top'#2'w'#5'Width'#2'c'#7'Caption'#6#15'Mantel-Haenszel'#8'T' + ,'abOrder'#2#5#0#0#9'TCheckBox'#11'LogisticChk'#4'Left'#2#8#6'Height'#2#17#3 + +'Top'#3#143#0#5'Width'#2'o'#7'Caption'#6#19'Logistic Regression'#8'TabOrder' + +#2#6#0#0#9'TCheckBox'#9'CurvesChk'#4'Left'#2#8#6'Height'#2#17#3'Top'#3#167#0 + +#5'Width'#2'm'#7'Caption'#6#17'Item Char. Curves'#8'TabOrder'#2#7#0#0#9'TChe' + +'ckBox'#9'CountsChk'#4'Left'#2#7#6'Height'#2#17#3'Top'#3#191#0#5'Width'#2'R' + +#7'Caption'#6#12'Level Counts'#8'TabOrder'#2#8#0#0#0#10'TScrollBar'#11'Level' + +'Scroll'#4'Left'#3'x'#1#6'Height'#2#16#3'Top'#3';'#1#5'Width'#2'Y'#3'Min'#2#1 + +#8'PageSize'#2#0#8'Position'#2#1#8'TabOrder'#2#12#8'OnScroll'#7#17'LevelScro' + +'llScroll'#0#0#5'TEdit'#11'LevelNoEdit'#4'Left'#3#225#1#6'Height'#2#21#3'Top' + +#3'9'#1#5'Width'#2'!'#8'TabOrder'#2#13#4'Text'#6#11'LevelNoEdit'#0#0#5'TEdit' + +#12'LowBoundEdit'#4'Left'#3#224#1#6'Height'#2#21#3'Top'#3'X'#1#5'Width'#2'!' + +#6'OnExit'#7#16'LowBoundEditExit'#8'TabOrder'#2#14#4'Text'#6#5'Edit4'#0#0#5 + +'TEdit'#11'UpBoundEdit'#4'Left'#3#224#1#6'Height'#2#21#3'Top'#3'x'#1#5'Width' + +#2'!'#6'OnExit'#7#15'UpBoundEditExit'#8'TabOrder'#2#15#4'Text'#6#5'Edit4'#0#0 + +#7'TButton'#8'ResetBtn'#4'Left'#2'h'#6'Height'#2' '#3'Top'#3#152#1#5'Width'#2 + +'E'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#16#0#0 + +#7'TButton'#9'CancelBtn'#4'Left'#3#192#0#6'Height'#2' '#3'Top'#3#152#1#5'Wid' + +'th'#2'E'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#17#0#0#7 + +'TButton'#10'ComputeBtn'#4'Left'#3#24#1#6'Height'#2' '#3'Top'#3#152#1#5'Widt' + +'h'#2'M'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder' + +#2#18#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3'u'#1#6'Height'#2' '#3'Top'#3#152 + +#1#5'Width'#2'H'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#7'OnClick'#7#14 + +'ReturnBtnClick'#8'TabOrder'#2#19#0#0#7'TButton'#7'HelpBtn'#3'Tag'#2'z'#4'Le' + +'ft'#2#8#6'Height'#2' '#3'Top'#3#152#1#5'Width'#2'R'#7'Caption'#6#4'Help'#7 + +'OnClick'#7#12'HelpBtnClick'#8'TabOrder'#2#20#0#0#0 +]); diff --git a/applications/lazstats/source_orig/difunit.pas b/applications/lazstats/source_orig/difunit.pas new file mode 100644 index 000000000..fe2c9825d --- /dev/null +++ b/applications/lazstats/source_orig/difunit.pas @@ -0,0 +1,1005 @@ +unit DIFUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, Buttons, MainUnit, Globals, Math, OutPutUnit, MatrixLib, + DataProcs, FunctionsLib, GraphLib, contexthelpunit; + +type DynamicCharArray = array of char; + +type + + { TDIFFrm } + + TDIFFrm = class(TForm) + HelpBtn: TButton; + ResetBtn: TButton; + CancelBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + ItemStatsChk: TCheckBox; + TestStatsChk: TCheckBox; + ItemCorrsChk: TCheckBox; + ItemTestChk: TCheckBox; + AlphaChk: TCheckBox; + MHChk: TCheckBox; + LogisticChk: TCheckBox; + CurvesChk: TCheckBox; + CountsChk: TCheckBox; + RefGrpEdit: TEdit; + TrgtGrpEdit: TEdit; + LevelsEdit: TEdit; + LevelNoEdit: TEdit; + LowBoundEdit: TEdit; + UpBoundEdit: TEdit; + GroupBox1: TGroupBox; + ItemInBtn: TBitBtn; + ItemOutBtn: TBitBtn; + AllBtn: TBitBtn; + GrpInBtn: TBitBtn; + GrpOutBtn: TBitBtn; + GroupVarEdit: TEdit; + Label1: TLabel; + Label10: TLabel; + Label11: TLabel; + UpBoundlabel: TLabel; + Label2: TLabel; + ItemsList: TListBox; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + LevelScroll: TScrollBar; + VarList: TListBox; + procedure AllBtnClick(Sender: TObject); + procedure ComputeBtnClick(Sender: TObject); + procedure HelpBtnClick(Sender: TObject); + procedure UpBoundEditExit(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure GrpInBtnClick(Sender: TObject); + procedure GrpOutBtnClick(Sender: TObject); + procedure ItemInBtnClick(Sender: TObject); + procedure ItemOutBtnClick(Sender: TObject); + procedure LevelScrollScroll(Sender: TObject; ScrollCode: TScrollCode; + var ScrollPos: Integer); + procedure LevelsEditExit(Sender: TObject); + procedure LowBoundEditExit(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + procedure ReturnBtnClick(Sender: TObject); + private + { private declarations } + NoItems : integer; + nolevels : integer; + tmean, tvar, tsd : double; + ColNoSelected : IntDyneVec; + ColLabels, RowLabels : StrDyneVec; + Means, Variances, StdDevs : DblDyneVec; + CorMat : DblDyneMat; // correlations among items and total score + Data : IntDyneMat; //store item scores and total score + Ubounds : IntDyneVec; // upper and lower bounds of score groups + Lbounds : IntdyneVec; + Code : DynamicCharArray; // blank, A, B or C ETS codes + Level10OK : IntdyneMat; // check that each item category >= 10 + RMHRight : IntDyneMat; // no. right for items by score group in reference group + RMHWrong : IntDyneMat; // no. wrong for items by score group in reference group + FMHRight : IntDyneMat; // no. right for items by score group in focus group + FMHWrong : IntDyneMat; // no. wrong for items by score group in focus group + RScrGrpCnt : IntDyneMat; // total responses for score groups in reference group + FScrGrpCnt : IntDyneMat; // total responses for score groups in focus group + NT : IntDyneMat; // total right and wrong in each category of each item + Alpha : DblDyneVec; + AlphaNum : DblDyneVec; + AlphaDen : DblDyneVec; + MHDiff : DblDyneVec; + ExpA : DblDyneMat; + VarA : DblDyneMat; + SumA : DblDyneVec; + SumExpA : DblDyneVec; + SumVarA : DblDyneVec; + ChiSqr : DblDyneVec; + Prob : DblDyneVec; + SEMHDDif : DblDyneVec; + Aster : StrDyneVec; + C : DblDyneVec; + CodeRF : DynamicCharArray; + Tot : IntDyneVec; + procedure AlphaRel(Sender: TObject); + procedure ItemCorrs(Sender: TObject); + procedure ItemTestCorrs(Sender: TObject); + procedure ItemCurves(Sender: TObject); + + public + { public declarations } + end; + +var + DIFFrm: TDIFFrm; + +implementation + +{ TDIFFrm } + +procedure TDIFFrm.ResetBtnClick(Sender: TObject); +VAR i : integer; +begin + VarList.Clear; + ItemsList.Clear; + GroupVarEdit.Text := ''; + ItemInBtn.Visible := true; + ItemOutBtn.Visible := false; + AllBtn.Visible := true; + GrpInBtn.Visible := true; + GrpOutBtn.Visible := false; + ItemStatsChk.Checked := true; + TestStatsChk.Checked := false; + ItemCorrsChk.Checked := false; + ItemTestChk.Checked := false; + MHChk.Checked := true; + LogisticChk.Checked := false; + RefGrpEdit.Text := ''; + TrgtGrpEdit.Text := ''; + for i := 1 to NoVariables do + VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + if NoVariables > 0 then LevelScroll.Max := NoVariables; + LevelNoEdit.Text := '1'; + LowBoundEdit.Text := '0'; + UpBoundEdit.Text := '2'; + //allocate space on heap + SetLength(ColLabels,NoVariables+1); + SetLength(RowLabels,NoVariables+1); + SetLength(Means,NoVariables); + SetLength(Variances,NoVariables); + SetLength(StdDevs,NoVariables); + SetLength(CorMat,NoVariables,NoVariables); + SetLength(Data,NoCases,NoVariables+3); //group, items, total, flag + SetLength(Lbounds,NoVariables); + SetLength(Ubounds,NoVariables); + SetLength(Tot,NoCases); + SetLength(ColNoSelected,NoVariables); +end; + +procedure TDIFFrm.ReturnBtnClick(Sender: TObject); +begin + ColNoSelected := nil; + C := nil; + SEMHDDif := nil; + Aster := nil; + Prob := nil; + ChiSqr := nil; + SumVarA := nil; + SumExpA := nil; + SumA := nil; + VarA := nil; + ExpA := nil; + CodeRF := nil; + MHDiff := nil; + AlphaDen := nil; + AlphaNum := nil; + Alpha := nil; + NT := nil; + Level10OK := nil; + Code := nil; + FScrGrpCnt := nil; + RScrGrpCnt := nil; + FMHWrong := nil; + FMHRight := nil; + RMHWrong := nil; + RMHRight := nil; + Tot := nil; + Ubounds := nil; + Lbounds := nil; + Data := nil; + CorMat := nil; + StdDevs := nil; + Variances := nil; + Means := nil; + RowLabels := nil; + ColLabels := nil; + DIFfrm.Hide; +end; + +procedure TDIFFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(Self); +end; + +procedure TDIFFrm.GrpInBtnClick(Sender: TObject); +VAR index : integer; +begin + if VarList.ItemIndex < 0 then + begin + GrpInBtn.Visible := false; + exit; + end; + index := VarList.ItemIndex; + GroupVarEdit.Text := VarList.Items.Strings[index]; + VarList.Items.Delete(index); + GrpInBtn.Visible := false; + GrpOutBtn.Visible := true; +end; + +procedure TDIFFrm.GrpOutBtnClick(Sender: TObject); +begin + VarList.Items.Add(GroupVarEdit.Text); + GroupVarEdit.Text := ''; + GrpInBtn.Visible := true; + GrpOutBtn.Visible := false; +end; + +procedure TDIFFrm.ItemInBtnClick(Sender: TObject); +VAR i, index : integer; +begin + if VarList.ItemIndex < 0 then + begin + ItemInBtn.Visible := false; + exit; + end; + index := VarList.Items.Count; + i := 0; + while i < index do + begin + if (VarList.Selected[i]) then + begin + ItemsList.Items.Add(VarList.Items.Strings[i]); + VarList.Items.Delete(i); + index := index - 1; + i := 0; + end + else i := i + 1; + end; + ItemOutBtn.Visible := true; +end; + +procedure TDIFFrm.ItemOutBtnClick(Sender: TObject); +VAR index : integer; +begin + index := ItemsList.ItemIndex; + if index < 0 then + begin + ItemOutBtn.Visible := false; + exit; + end; + VarList.Items.Add(ItemsList.Items.Strings[index]); + ItemsList.Items.Delete(index); + ItemInBtn.Visible := true; +end; + +procedure TDIFFrm.LevelScrollScroll(Sender: TObject; ScrollCode: TScrollCode; + var ScrollPos: Integer); +var + scrlpos : integer; + level : integer; +begin + level := StrToInt(LevelNoEdit.Text); + scrlpos := LevelScroll.Position; + if ((scrlpos > level) and (level <= StrToInt(LevelsEdit.Text))) then + begin + LevelNoEdit.Text := IntToStr(scrlpos); + LowBoundEdit.SetFocus; + exit; + end; + if scrlpos < level then + begin + level := scrlpos; + if level > 0 then + begin + LevelNoEdit.Text := IntToStr(level); + LowBoundEdit.Text := IntToStr(Lbounds[level-1]); + UpBoundEdit.Text := IntToStr(Ubounds[level-1]); + end; + LowBoundEdit.SetFocus; + end; +end; + +procedure TDIFFrm.LevelsEditExit(Sender: TObject); +begin + LevelScroll.Max := StrToInt(LevelsEdit.Text); + LowBoundEdit.SetFocus; +end; + +procedure TDIFFrm.LowBoundEditExit(Sender: TObject); +VAR i : integer; +begin + i := StrToInt(LevelNoEdit.Text); + Lbounds[i-1] := StrToInt(LowBoundEdit.Text); + UpBoundEdit.SetFocus; +end; + +procedure TDIFFrm.ComputeBtnClick(Sender: TObject); +Label LoopStart; +var + i, j, k : integer; + itm : integer; + grpvar : integer; + subjgrp : integer; + value : integer; + subjscore : integer; + scrgrpsize : integer; + lower, upper : integer; + sum : integer; + cellstring : string; + title : string; + nsize : array [1..2] of integer; + Rtm, Wtm : double; + TotPurge : integer; + LoopIt : integer; + RItem, FItem : integer; +begin + LoopIt := 0; + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add('Mantel-Haenszel DIF Analysis adapted by Bill Miller from'); + OutPutFrm.RichEdit.Lines.Add('EZDIF written by Niels G. Waller'); + OutPutFrm.RichEdit.Lines.Add(''); + + NoItems := ItemsList.Items.Count; + for k := 1 to 2 do nsize[k] := 0; + + // get items to analyze and their labels + for i := 1 to NoItems do // items to analyze + begin + for j := 1 to NoVariables do // variables in grid + begin + cellstring := OS3MainFrm.DataGrid.Cells[j,0]; + if cellstring = ItemsList.Items.Strings[i-1] then + begin // matched - save info + ColNoSelected[i-1] := j; + ColLabels[i-1] := cellstring; + RowLabels[i-1] := cellstring; + end; // end match + end; // next j + end; // next i + ColLabels[NoItems] := 'TOTAL'; + RowLabels[NoItems] := 'TOTAL'; + + // get the variable number of the grouping code + grpvar := 0; + for i := 1 to NoVariables do + begin + cellstring := OS3MainFrm.DataGrid.Cells[i,0]; + if cellstring = GroupVarEdit.Text then grpvar := i; + end; + if grpvar = 0 then + begin + ShowMessage('Error - No group variable found.'); + exit; + end; + + // get number of test score levels + nolevels := StrToInt(LevelsEdit.Text); + + // read data (score group and items) + for i := 1 to NoCases do + begin + subjscore := 0; + value := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[grpvar,i]))); + subjgrp := 0; + if value = StrToInt(RefGrpEdit.Text) then subjgrp := 1; // reference grp + if value = StrToInt(TrgtGrpEdit.Text) then subjgrp := 2; // target group + if subjgrp = 0 then + begin + ShowMessage('Error - Bad group code for a subject.'); + exit; + end; + Data[i-1,0] := subjgrp; + nsize[subjgrp] := nsize[subjgrp] + 1; + for j := 1 to NoItems do + begin + itm := ColNoSelected[j-1]; + value := Round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[itm,i]))); + if value = 1 then subjscore := subjscore + 1; + Data[i-1,j] := value; + end; + Tot[i-1] := subjscore; + end; + + // obtain item means, variances, standard deviations for total subjects + for i := 0 to NoItems-1 do + begin + Means[i] := 0.0; + Variances[i] := 0.0; + StdDevs[i] := 0.0; + for j := 0 to NoCases - 1 do + begin + Means[i] := Means[i] + Data[j,i+1]; + Variances[i] := Variances[i] + (Data[j,i+1] * Data[j,i+1]); + end; + Variances[i] := (Variances[i] - (Means[i] * Means[i] / NoCases)) / (NoCases - 1); + if Variances[i] <= 0 then + begin + cellstring := format('Item %d has zero variance. Unselect the item.', + [i+1]); + ShowMessage(cellstring); + ResetBtnClick(Self); + exit; + end; + StdDevs[i] := sqrt(Variances[i]); + Means[i] := Means[i] / NoCases; + end; + + // obtain total score mean, variance and stddev + tmean := 0.0; + tvar := 0.0; + tsd := 0.0; + for i := 0 to NoCases - 1 do + begin + tmean := tmean + Tot[i]; + tvar := tvar + (Tot[i] * Tot[i]); + end; + tvar := (tvar - (tmean * tmean / NoCases)) / (NoCases - 1); + tsd := sqrt(tvar); + tmean := tmean / NoCases; + + // print descriptives if checked + if ItemStatsChk.Checked then + begin + title := 'Total Means'; + DynVectorPrint(Means,NoItems,title,ColLabels,NoCases); + title := 'Total Variances'; + DynVectorPrint(Variances,NoItems,title,ColLabels,NoCases); + title := 'Total Standard Deviations'; + DynVectorPrint(StdDevs,NoItems,title,ColLabels,NoCases); + end; + + // Show total test score statistics if checked + if TestStatsChk.Checked then + begin + cellstring := format('Total Score: Mean = %10.3f, Variance = %10.3f, Std.Dev. = %10.3f', + [tmean, tvar, tsd]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + cellstring := format('Reference group size = %d, Focus group size = %d', + [nsize[1],nsize[2]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + + // get Cronbach alpha for total group if checked + if AlphaChk.Checked then AlphaRel(Self); + + // Get item intercorrelations for total group if checked + if ItemCorrsChk.Checked then + begin + ItemCorrs(Self); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + + // Get item-total score correlations for total group if checked + if ItemTestChk.Checked then + begin + ItemTestCorrs(Self); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + + // Show upper and lower bounds for score group bins + OutPutFrm.RichEdit.Lines.Add('Conditioning Levels'); + OutPutFrm.RichEdit.Lines.Add('Lower Upper'); + for i := 0 to nolevels-1 do + begin + cellstring := format('%5d %5d',[Lbounds[i],Ubounds[i]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + + // check for zero variance in each group + for k := 1 to 2 do // group + begin + for i := 0 to NoItems-1 do // item + begin + sum := 0; + for j := 0 to NoCases-1 do // subject + begin + if Data[j,0] = k then // group match ? + begin + sum := sum + Data[j,i+1]; + end; + end; + end; + if ((sum = 0) or (sum = NoVariables)) then + begin + cellstring := format('Item %d in group %d has zero variance.', + [i+1,k]); + ShowMessage(cellstring); + exit; + end; + end; + + // Get count of no. right and wrong for each item in each group + SetLength(RMHRight,nolevels,NoItems); + SetLength(RMHWrong,nolevels,NoItems); + SetLength(FMHRight,nolevels,NoItems); + SetLength(FMHWrong,nolevels,NoItems); + SetLength(RScrGrpCnt,nolevels,NoItems); + SetLength(FScrGrpCnt,nolevels,NoItems); + SetLength(Code,NoItems); + SetLength(Level10OK,nolevels,NoItems); + SetLength(NT,nolevels,NoItems); + SetLength(Alpha,NoItems); + SetLength(AlphaNum,NoItems); + SetLength(AlphaDen,NoItems); + SetLength(MHDiff,NoItems); + SetLength(CodeRF,NoItems); + SetLength(ExpA,nolevels,NoItems); + SetLength(VarA,nolevels,NoItems); + SetLength(SumA,NoItems); + SetLength(SumExpA,NoItems); + SetLength(SumVarA,NoItems); + SetLength(ChiSqr,NoItems); + SetLength(Prob,NoItems); + SetLength(Aster,NoItems); + SetLength(SEMHDDif,NoItems); + SetLength(C,NoItems); + +LoopStart: + // clear arrays + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + RMHRight[k,j] := 0; + RMHWrong[k,j] := 0; + RScrGrpCnt[k,j] := 0; + FMHRight[k,j] := 0; + FMHWrong[k,j] := 0; + FScrGrpCnt[k,j] := 0; + Level10OK[k,j] := 1; + NT[k,j] := 0; + ExpA[k,j] := 0.0; + VarA[k,j] := 0.0; + end; + Alpha[j] := 0.0; + AlphaNum[j] := 0.0; + AlphaDen[j] := 0.0; + MHDiff[j] := 0.0; + CodeRF[j] := ' '; + Prob[j] := 0.0; + end; + + LoopIt := LoopIt + 1; + OutPutFrm.RichEdit.Clear; + cellstring := format('COMPUTING M-H CHI-SQUARE, PASS # %d',[LoopIt]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + for k := 0 to nolevels-1 do + begin + for i := 0 to NoCases-1 do + begin + subjgrp := Data[i,0]; + for j := 0 to NoItems-1 do + begin + RItem := 0; + value := Data[i,j+1]; + if ((LoopIt = 2) and (Code[j] = 'C')) then RItem := value; + if value = 1 then + begin + if ((Tot[i]+RItem >= Lbounds[k]) and + (Tot[i]+RItem <= Ubounds[k])) then + begin + if subjgrp = 1 then + begin + RMHRight[k,j] := RMHRight[k,j] + 1; + RScrGrpCnt[k,j] := RScrGrpCnt[k,j] + 1; + end; // if reference group + if subjgrp = 2 then + begin + FMHRight[k,j] := FMHRight[k,j] + 1; + FScrGrpCnt[k,j] := FScrGrpCnt[k,j] + 1; + end; // if focus group + end; // end if () and () + end; // value = 1 + if value = 0 then + begin + if ((Tot[i]+RItem >= Lbounds[k]) and + (Tot[i]+RItem <= Ubounds[k])) then + begin + if subjgrp = 1 then + begin + RMHWrong[k,j] := RMHWrong[k,j] + 1; + RScrGrpCnt[k,j] := RScrGrpCnt[k,j] + 1; + end; + if subjgrp = 2 then + begin + FMHWrong[k,j] := FMHWrong[k,j] + 1; + FScrGrpCnt[k,j] := FScrGrpCnt[k,j] + 1; + end; + end; + end; // if value = 0 + end; // next j + end; // next i + end; // next k + for j := 0 to NoItems-1 do Code[j] := 'Z'; // clean out ETS code + + // print score group counts for Reference and focus subjects + if CountsChk.Checked then + begin + for i := 0 to nolevels-1 do + RowLabels[i] := format('%3d-%3d',[Lbounds[i],Ubounds[i]]); + DynIntMatPrint(RScrGrpCnt,nolevels,NoItems,'Score Level Counts by Item',RowLabels,ColLabels, + 'Cases in Reference Group'); + DynIntMatPrint(FScrGrpCnt,nolevels,NoItems,'Score Level Counts by Item',RowLabels,ColLabels, + 'Cases in Focus Group'); + end; + + // Plot Item curves if checked + if ((CurvesChk.Checked) and (LoopIt = 1)) then ItemCurves(Self); + + // check for minimum of 10 per category in each item + // compute NT + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + if ((RScrGrpCnt[k,j] < 10) or (FScrGrpCnt[k,j] < 10)) then + Level10OK[k,j] := 0 // insufficient n + else Level10OK[k,j] := 1; // 10 or more - OK + NT[k,j] := RScrGrpCnt[k,j] + FScrGrpCnt[k,j]; + end; + end; + + for k := 0 to nolevels-1 do + begin + if Level10OK[k,0] = 0 then + begin + cellstring := format('Insufficient data found in level: %d - %d', + [Lbounds[k],Ubounds[k]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + end; + + // compute alpha + for j := 0 to NoItems - 1 do + begin + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + AlphaNum[j] := AlphaNum[j] + (RMHRight[k,j] * FMHWrong[k,j]) / NT[k,j]; + AlphaDen[j] := AlphaDen[j] + (RMHWrong[k,j] * FMHRight[k,j]) / NT[k,j]; + end; + end; + end; + + for j := 0 to NoItems-1 do + begin + if AlphaDen[j] = 0.0 then + begin + cellstring := format('Window too small at item %d level %d', + [j+1,k+1]); + ShowMessage(cellstring); + exit; + end + else begin + Alpha[j] := AlphaNum[j] / AlphaDen[j]; + MHDiff[j] := -2.35 * ln(Alpha[j]); + end; + end; + + // compute expected values + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + ExpA[k,j] := (RScrGrpCnt[k,j] * (RMHRight[k,j] + FMHRight[k,j] )) / + NT[k,j]; + end; + end; + end; + + // compute variances + for j := 0 to NoItems-1 do + begin + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + Rtm := RMHRight[k,j] + FMHRight[k,j]; + Wtm := RMHWrong[k,j] + FMHWrong[k,j]; + VarA[k,j] := (RScrGrpCnt[k,j] * FScrGrpCnt[k,j] * Rtm * Wtm) / + ( NT[k,j] * NT[k,j] * (NT[k,j]-1) ); + end; + end; + end; + + // compute chi-squares + for j := 0 to NoItems-1 do + begin + SumA[j] := 0.0; + SumExpA[j] := 0.0; + SumVarA[j] := 0.0; + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + SumA[j] := SumA[j] + RMHRight[k,j]; + SumExpA[j] := SumExpA[j] + ExpA[k,j]; + SumVarA[j] := SumVarA[j] + VarA[k,j]; + end; + end; + end; + + for j := 0 to NoItems-1 do + begin + ChiSqr[j] := (sqr((Abs(SumA[j] - SumExpA[j]) - 0.5))) / SumVarA[j]; + Prob[j] := 1.0 - chisquaredprob(ChiSqr[j],1); + if Prob[j] > 0.05 then Aster[j] := ''; + if Prob[j] <= 0.05 then Aster[j] := '*'; + if Prob[j] <= 0.01 then Aster[j] := '**'; + if Prob[j] <= 0.005 then Aster[j] := '***'; + end; + + // compute std. errors + for j := 0 to NoItems-1 do + begin + C[j] := 0.0; + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + C[j] := C[j] + ((RMHRight[k,j] * FMHWrong[k,j]) / NT[k,j]); + end; + end; + + for j := 0 to NoItems - 1 do + begin + SEMHDDif[j] := 0.0; + for k := 0 to nolevels-1 do + begin + if Level10OK[k,j] = 1 then + begin + SEMHDDif[j] := SEMHDDif[j] + ( (RMHRight[k,j] * FMHWrong[k,j] ) + + ( Alpha[j] * RMHWrong[k,j] * FMHRight[k,j])) * + ( RMHRight[k,j] + FMHWrong[k,j] + Alpha[j] * + ( RMHWrong[k,j] + FMHRight[k,j] )) / ( 2.0 * NT[k,j] * NT[k,j]); + end; + end; + end; + + for j := 0 to NoItems-1 do + SEMHDDif[j] := (2.35 / C[j]) * sqrt(SEMHDDif[j]); + + // code results with ETS codes + for j := 0 to NoItems-1 do + begin + if ( (abs(MHDiff[j]) > 1.5) and ((abs(MHDiff[j]) - (1.96 * SEMHDDif[j]) + > 1.0))) then Code[j] := 'C'; + if ((abs(MHDiff[j]) - (1.96 * SEMHDDif[j]) <= 0.0) or + (abs(MHDiff[j]) <= 1.0)) then code[j] := 'A'; + if ((code[j] <> 'A') and (code[j] <> 'C')) then code[j] := 'B'; + end; + + // purge + TotPurge := 0; + for j := 0 to NoItems-1 do + begin + if (code[j] = 'C') then + begin + TotPurge := TotPurge + 1; + for i := 0 to NoCases - 1 do Tot[i] := Tot[i] - Data[i,j+1]; + if Alpha[j] > 1.0 then CodeRF[j] := 'R'; + if Alpha[j] < 1.0 then CodeRF[j] := 'F'; + end; + end; + + // show results +// OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add( + 'CODES ITEM SIG. ALPHA CHI2 P-VALUE MH D-DIF S.E. MH D-DIF'); + for j := 0 to noitems-1 do + begin + cellstring := format('%1s %1s %4d %3s %6.3f %7.3f %6.3f %6.3f %6.3f', + [code[j],CodeRF[j], j+1, Aster[j],Alpha[j],ChiSqr[j],Prob[j],MHDiff[j], + SEMHDDif[j]]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + OutPutFrm.RichEdit.Lines.Add(''); + if LoopIt = 1 then + begin + cellstring := format('No. of items purged in pass 1 = %d',[TotPurge]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + OutPutFrm.RichEdit.Lines.Add('Item Numbers:'); + for j := 0 to NoItems-1 do + begin + if Code[j] = 'C' then + begin + cellstring := format('%d',[j+1]); + OutPutFrm.RichEdit.Lines.Add(cellstring); + end; + end; + end; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + if LoopIt < 2 then goto LoopStart; +end; + +procedure TDIFFrm.HelpBtnClick(Sender: TObject); +begin + ContextHelpForm.HelpMessage((Sender as TButton).tag); +end; + +procedure TDIFFrm.UpBoundEditExit(Sender: TObject); +VAR i : integer; +begin + i := StrToInt(LevelNoEdit.Text); + Ubounds[i-1] := StrToInt(UpBoundEdit.Text); + if i = StrToInt(LevelsEdit.Text) then + begin + ComputeBtn.SetFocus; + exit; + end; + LowBoundEdit.Text := IntToStr(Ubounds[i-1] + 1); + LowBoundEdit.SetFocus; +end; + +procedure TDIFFrm.AllBtnClick(Sender: TObject); +VAR i : integer; +begin + if VarList.Items.Count < 1 then exit; + for i := 0 to VarList.Items.Count - 1 do + ItemsList.Items.Add(VarList.Items.Strings[i]); + VarList.Clear; + ItemInBtn.Visible := false; + ItemOutBtn.Visible := true; +end; + +procedure TDIFfrm.AlphaRel(Sender: TObject); +var + i : integer; + Alpha1, SEMeas : double; + outline : string; +begin + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add(''); + Alpha1 := 0.0; + + for i := 0 to NoItems-1 do + Alpha1 := Alpha1 + variances[i]; // sum of item variances + Alpha1 := Alpha1 / tvar; + Alpha1 := 1.0 - Alpha1; + Alpha1 := (NoItems / (NoItems - 1.0)) * Alpha1; + SEMeas := tsd * sqrt(1.0 - Alpha1); + outline := format('Alpha Reliability Estimate for Test = %6.4f S.E. of Measurement = %8.3f', + [Alpha1,SEMeas]); + OutPutFrm.RichEdit.Lines.Add(outline); +// OutPutFrm.ShowModal; +end; + +procedure TDIFfrm.ItemCorrs(Sender: TObject); +var + i, j, k : integer; + title : string; +begin + // cross-products + for i := 0 to NoItems-1 do + for j := 0 to NoItems-1 do + for k := 0 to NoCases-1 do + CorMat[i,j] := CorMat[i,j] + (Data[k,i+1] * Data[k,j+1]); + // covariances + for i := 0 to NoItems-1 do + for j := 0 to NoItems-1 do + CorMat[i,j] := (CorMat[i,j] - (NoCases * Means[i] * Means[j])) / + (NoCases-1); + + // correlations + for i := 0 to NoItems-1 do + for j := 0 to NoItems-1 do + CorMat[i,j] := CorMat[i,j] / (StdDevs[i] * StdDevs[j]); + + // show results + OutPutFrm.RichEdit.Clear; + title := 'Correlations Among Items'; + MAT_PRINT(CorMat,NoItems,NoItems,title,RowLabels,ColLabels,NoCases); +end; + +procedure TDIFfrm.ItemTestCorrs(Sender: TObject); +var + i, j : integer; + Cors : DblDyneVec; + title : string; +begin + SetLength(Cors,NoItems); + // cross-products + for i := 0 to NoItems-1 do + for j := 0 to NoCases-1 do + Cors[i] := Cors[i] + (Data[j,i+1] * Tot[j]); + // covariances + for i := 0 to NoItems-1 do + Cors[i] := (Cors[i] - (NoCases * Means[i] * tmean)) / (NoCases-1); + // correlations + for i := 0 to NoItems-1 do + Cors[i] := Cors[i] / (StdDevs[i] * tsd); + // show results +// OutPutFrm.RichEdit.Clear; + title := 'Item-Total Correlations'; + DynVectorPrint(Cors,NoItems,title,ColLabels,NoCases); + // release memory + Cors := nil; +end; + +procedure TDIFfrm.ItemCurves(Sender: TObject); +var + i, ii, j : integer; + XPlotPts : DblDyneMat; + YPlotPts : DblDyneMat; + LabelStr, outline, xTitle, yTitle : string; + max : integer; +begin + SetLength(YPlotPts,2,nolevels); + SetLength(XPlotPts,1,nolevels); + + // get maximum no. of scores in either groups bins + for i := 0 to NoItems-1 do + begin + max := 0; + for j := 0 to nolevels-1 do + begin + if RMHRight[j,i] > max then max := RMHRight[j,i]; + if FMHRight[j,i] > max then max := FMHRight[j,i]; + end; + + // Plot reference group in blue, focus group in red + for ii := 1 to 2 do // possible group curves + begin + for j := 0 to nolevels-1 do //get points to plot + begin + XPlotPts[0,j] := Lbounds[j]; + if ii = 1 then YPlotPts[ii-1,j] := RMHRight[j,i]; + if ii = 2 then YPlotPts[ii-1,j] := FMHRight[j,i]; + end; + end; // next group + + // Plot the points + GraphFrm.BackColor := clWhite; + GraphFrm.ShowLeftWall := true; + GraphFrm.ShowRightWall := true; + GraphFrm.ShowBottomWall := true; + GraphFrm.ShowBackWall := true; + GraphFrm.BackColor := clYellow; + GraphFrm.WallColor := clBlue; + GraphFrm.FloorColor := clBlue; + outline := format('Blue = Reference, Red = Focus for item %d',[i+1]); + GraphFrm.Heading := outline; + xTitle := 'Lower bounds of levels'; + GraphFrm.XTitle := xTitle; + yTitle := 'Frequencies'; + GraphFrm.YTitle := yTitle; + GraphFrm.nosets := 2; + GraphFrm.nbars := nolevels; + GraphFrm.barwideprop := 0.5; + GraphFrm.miny := 0.0; + GraphFrm.maxy := max; + GraphFrm.AutoScale := false; + GraphFrm.GraphType := 5; // 2d line charts + GraphFrm.PtLabels := false; + for ii := 1 to 2 do + begin + if ii = 1 then LabelStr := 'Reference'; + if ii = 2 then LabelStr := 'Focus'; + GraphFrm.SetLabels[ii] := LabelStr; + end; + GraphFrm.Ypoints := YPlotPts; + GraphFrm.Xpoints := XPlotPts; + GraphFrm.ShowModal; + end; // next item + + XPlotPts := nil; + YPlotPts := nil; +end; + +initialization + {$I difunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/distribunit.pas b/applications/lazstats/source_orig/distribunit.pas new file mode 100644 index 000000000..a588a5de8 --- /dev/null +++ b/applications/lazstats/source_orig/distribunit.pas @@ -0,0 +1,596 @@ +unit DISTRIBUNIT; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, BlankFrmUnit, OutPutUnit, FunctionsLib, Globals, + Printers, Math; + + type + TwoCol = array[1..2,1..100] of double; + +type + + { TDistribFrm } + + TDistribFrm = class(TForm) + AlphaEdit: TEdit; + DF1Edit: TEdit; + DF2Edit: TEdit; + MeanEdit: TEdit; + ResetBtn: TButton; + CancelBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + GroupBox2: TGroupBox; + AlphaLabel: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + NDChk: TCheckBox; + ChiChk: TCheckBox; + FChk: TCheckBox; + GroupBox1: TGroupBox; + procedure ChiChkClick(Sender: TObject); + procedure ComputeBtnClick(Sender: TObject); + procedure FChkClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure NDChkClick(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + private + { private declarations } + procedure NDPlot(Sender : TObject); + procedure ChiPlot(Sender : TObject); + procedure FPlot(Sender : TObject); + procedure Hscale(Xmin, Xmax : double; Nsteps : integer; + acolor : TColor; FontSize : integer; + X, Y, Xlength : integer; + charLabel : string; Sender : TObject); + procedure Vscale(Ymin, Ymax : double; Nsteps : integer; + acolor : TColor; FontSize : integer; + X, Y, Ylength : integer; + charLabel : string; Sender : TObject); + procedure NormPts(zMin, zMax : double; Npts : integer; + VAR realpts : TwoCol; + Sender : TObject); + procedure PltPts(realpts : TwoCol; + Xmax, Xmin, Ymax, Ymin : double; + Npts, XaxisStart, YaxisStart, XaxisRange : integer; + YaxisRange : integer; + acolor : TColor; Sender : TObject); + procedure ChiPts(cMin, cMax : double; + Npts, df : integer; + VAR realpts : TwoCol; + Sender : TObject); + procedure FPts(FMin, FMax : double; + Npts, df1, df2 : integer; + VAR realpts : TwoCol; + Sender : TObject); + function chi2func(chisqr, df : double) : double; + function Ffunc(F : double; df1, df2 : integer) : double; + + public + { public declarations } + end; + +var + DistribFrm: TDistribFrm; + +implementation + +{ TDistribFrm } + +procedure TDistribFrm.ResetBtnClick(Sender: TObject); +begin + NDChk.Checked := false; + ChiChk.Checked := false; + FChk.Checked := false; + AlphaEdit.Text := '0.05'; + DF1Edit.Text := ''; + DF2Edit.Text := ''; + MeanEdit.Text := ''; + GroupBox2.Visible := false; +end; + +procedure TDistribFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; + +procedure TDistribFrm.NDChkClick(Sender: TObject); +begin + if NDChk.Checked then + begin + GroupBox2.Visible := true; + AlphaLabel.Visible := true; + AlphaEdit.Visible := true; + DF1Edit.Visible := false; + Label2.Visible := false; + Label3.Visible := false; + Label4.Visible := false; + DF2Edit.Visible := false; + MeanEdit.Visible := false; + end + else GroupBox2.Visible := false; +end; + +procedure TDistribFrm.ComputeBtnClick(Sender: TObject); +begin + if NDChk.Checked then + begin + NDPlot(self); + end; + if ChiChk.Checked then + begin + ChiPlot(self); + end; + if FChk.Checked then + begin + FPlot(self); + end; +end; + +procedure TDistribFrm.FChkClick(Sender: TObject); +begin + if FChk.Checked then + begin + GroupBox2.Visible := true; + Label3.Visible := true; + AlphaLabel.Visible := true; + AlphaEdit.Visible := true; + DF1Edit.Visible := true; + DF2Edit.Visible := true; + Label2.Visible := true; + Label4.Visible := false; + MeanEdit.Visible := false; + end + else GroupBox2.Visible := false; +end; + +procedure TDistribFrm.ChiChkClick(Sender: TObject); +begin + if ChiChk.Checked then + begin + GroupBox2.Visible := true; + Label2.Visible := true; + DF1Edit.Visible := true; + Label3.Visible := false; + Label4.Visible := false; + AlphaLabel.Visible := true; + AlphaEdit.Visible := true; + DF2Edit.Visible := false; + MeanEdit.Visible := false; + end + else + begin + GroupBox2.Visible := false; + end; +end; + +procedure TDistribFrm.NDPlot(Sender: TObject); +var + charLabel : string; + Clwidth, Clheight,X, Y, XaxisStart, XaxisEnd, YaxisStart, YaxisEnd : integer; + i, Xrange, Yrange, t : integer; + alpha, h, z, hprop, zprop : double; + realpts : TwoCol; + +begin + for i := 1 to 100 do realpts[1,i] := 0.0; + for i := 1 to 100 do realpts[2,i] := 0.0; + charLabel := 'Normal Distribution. Alpha = '; + BlankFrm.Image1.Canvas.Clear; + BlankFrm.Image1.Canvas.Pen.Color := clBlack; + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + BlankFrm.Image1.Canvas.Clear; + BlankFrm.Image1.Canvas.FloodFill(1,1,clWhite,fsborder); + BlankFrm.Image1.Canvas.Pen.Width := 2; + Clwidth := BlankFrm.Image1.Width; + Clheight := BlankFrm.Image1.Height; + XaxisStart := Clwidth div 8; + XaxisEnd := Clwidth - (Clwidth div 8); + YaxisStart := (Clheight * 7) div 10; + YaxisEnd := Clheight div 10; + Xrange := XaxisEnd - XaxisStart; + Yrange := YaxisStart - YaxisEnd; + alpha := StrToFloat(AlphaEdit.Text); + BlankFrm.Show; + + // Create values of normal curve + NormPts(-4.0, 4.0, 100, realpts, self); + PltPts(realpts, 4.0, -4.0, 0.5, 0.0, 100, XaxisStart, YaxisStart, Xrange, + Yrange, clBlack, self); + + // Draw line for alpha z := 1.645 + charLabel := charLabel + AlphaEdit.Text; + BlankFrm.Caption := charLabel; + z := inversez(1.0 - alpha); + zprop := (4.0 + z) / 8.0; + h := (1.0 / sqrt(2.0 * 3.1415)) * (1.0 / exp(z * z / 2.0)); + hprop := (0.5 - h) / 0.5; + X := round( zprop * Xrange)+ XaxisStart; + Y := YaxisEnd + round( hprop * Yrange); + BlankFrm.Image1.Canvas.MoveTo(X,YaxisStart); + BlankFrm.Image1.Canvas.LineTo(X,Y-10); // alpha cutoff + + // floodfill rejection section with red + BlankFrm.Image1.Canvas.Brush.Color := clRed; + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + + // create labeled axis + Hscale(-4.0, 4.0, 11, clWhite, 10, XaxisStart, YaxisStart, Xrange,'z SCALE',self); + Vscale(0.0, 0.5, 11, clWhite, 10, XaxisStart, YaxisStart, Yrange, 'DENSITY',self); + + // Print Heading + t := BlankFrm.Image1.Canvas.TextWidth(charLabel); + X := (BlankFrm.Width div 2) - (t div 2); + BlankFrm.Image1.Canvas.TextOut(X,0,charLabel); + charLabel := 'Critical Value = '; + charLabel := charLabel + format('%6.3f',[z]); + t := BlankFrm.Image1.Canvas.TextWidth(charLabel); + X := (BlankFrm.Image1.Width div 2) - (t div 2); + BlankFrm.Image1.Canvas.TextOut(X,BlankFrm.Image1.Canvas.TextHeight(charLabel),charLabel); +end; + +procedure TDistribFrm.ChiPlot(Sender: TObject); +var + charLabel : string; + Clwidth, Clheight, X, Y, XaxisStart, XaxisEnd, YaxisStart, YaxisEnd : integer; + i, Xrange, Yrange, df, t : integer; + alpha, h, z, hprop, zprop, MaxChi, MaxProb : double; + realpts : TwoCol; + +begin + BlankFrm.Image1.Canvas.Clear; + for i := 1 to 100 do realpts[1,i] := 0.0; + for i := 1 to 100 do realpts[2,i] := 0.0; + charLabel := 'Chi Squared Distribution. Alpha = '; + MaxProb := 0.0; + BlankFrm.Image1.Canvas.Pen.Color := clBlack; + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + BlankFrm.Image1.Canvas.Clear; + BlankFrm.Image1.Canvas.FloodFill(1,1,clWhite,fsborder); + BlankFrm.Image1.Canvas.Pen.Width := 2; + Clwidth := BlankFrm.Image1.Width; + Clheight := BlankFrm.Image1.Height; + XaxisStart := Clwidth div 8; + XaxisEnd := Clwidth - (Clwidth div 8); + YaxisStart := (Clheight * 7) div 10; + YaxisEnd := Clheight div 10; + Xrange := XaxisEnd - XaxisStart; + Yrange := YaxisStart - YaxisEnd; + alpha := StrToFloat(AlphaEdit.Text); + charLabel := charLabel + AlphaEdit.Text; + df := StrToInt(DF1Edit.Text); + if (df < 1) or (df > 100) then exit; + charLabel := charLabel + ' D.F. = '; + charLabel := charLabel + DF1Edit.Text; + BlankFrm.Caption := charLabel; + BlankFrm.Show; + + // Create values of chi-squared curve + MaxChi := 125.0; + ChiPts(0.0, MaxChi, 100, df, realpts, self); + for i := 1 to 100 do + begin + if (realpts[2,i] > MaxProb) then MaxProb := realpts[2,i]; + end; + PltPts(realpts, MaxChi, 0.0, MaxProb, 0.0, 100, XaxisStart, YaxisStart, Xrange, + Yrange, clBlack, self); + + // Draw line for alpha + z := inversechi(1.0-alpha,df); + zprop := z / MaxChi; + h := chi2func(z,df); + hprop := (MaxProb - h) / MaxProb; + X := round( zprop * Xrange)+ XaxisStart; + Y := YaxisEnd + round( hprop * Yrange); + BlankFrm.Image1.Canvas.MoveTo(X,YaxisStart); + BlankFrm.Image1.Canvas.LineTo(X,Y); // alpha cutoff + + // floodfill main section with blue + BlankFrm.Image1.Canvas.Brush.Color := clBlue; + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + + // create charLabeled axis + Hscale(0.0, MaxChi, 11, clWhite, 10, XaxisStart, YaxisStart, + Xrange,'CHI SQUARED SCALE',self); + Vscale(0.0, MaxProb, 11, clWhite, 10, XaxisStart, YaxisStart, + Yrange, 'DENSITY',self); + + // Print Heading + t := BlankFrm.Image1.Canvas.TextWidth(charLabel); + X := (BlankFrm.Width div 2) - (t div 2); + BlankFrm.Image1.Canvas.TextOut(X,0,charLabel); + charLabel := 'Critical Value = '; + charLabel := charLabel + format('%6.3f',[z]); + t := BlankFrm.Image1.Canvas.TextWidth(charLabel); + X := (BlankFrm.Image1.Width div 2) - (t div 2); + BlankFrm.Image1.Canvas.TextOut(X,BlankFrm.Image1.Canvas.TextHeight(charLabel),charLabel); +end; + +procedure TDistribFrm.FPlot(Sender: TObject); +var + charLabel : string; + Clwidth, Clheight, X, Y, XaxisStart, XaxisEnd, YaxisStart, YaxisEnd : integer; + i, Xrange, Yrange, t, df1, df2 : integer; + realpts : TwoCol; + alpha, h, F, hprop, Fprop, MaxProb, MaxF : double; + done : boolean; +begin + BlankFrm.Image1.Canvas.Clear; + for i := 1 to 100 do realpts[1,i] := 0.0; + for i := 1 to 100 do realpts[2,i] := 0.0; + MaxProb := 0.0; + charLabel := 'F Distribution. Alpha = '; + BlankFrm.Image1.Canvas.Pen.Color := clBlack; + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + BlankFrm.Image1.Canvas.Clear; + BlankFrm.Image1.Canvas.FloodFill(1,1,clWhite,fsborder); + BlankFrm.Image1.Canvas.Pen.Width := 2; + Clwidth := BlankFrm.Image1.Width; + Clheight := BlankFrm.Image1.Height; + XaxisStart := Clwidth div 8; + XaxisEnd := Clwidth - (Clwidth div 8); + YaxisStart := (Clheight * 7) div 10; + YaxisEnd := Clheight div 10; + Xrange := XaxisEnd - XaxisStart; + Yrange := YaxisStart - YaxisEnd; + alpha := StrToFloat(AlphaEdit.Text); + charLabel := charLabel + AlphaEdit.Text; + df1 := StrToInt(DF1Edit.Text); + charLabel := charLabel + ' D.F.1 = '; + charLabel := charLabel + DF1Edit.Text; + df2 := StrToInt(DF2Edit.Text); + charLabel := charLabel + ' , D.F.2 = '; + charLabel := charLabel + DF2Edit.Text; + BlankFrm.Caption := charLabel; + BlankFrm.Show; + + // Create values of F curve + MaxF := 20.0; + done := false; + while not done do + begin + h := Ffunc(MaxF, df1, df2); + if (h < 0.001) then MaxF := MaxF - 1.0 + else done := true; + end; + + FPts(0.0, MaxF, 100, df1, df2, realpts, self); + for i := 1 to 100 do + begin + if (realpts[2,i] > MaxProb) then MaxProb := realpts[2,i]; + end; + PltPts(realpts, MaxF, 0.0, MaxProb, 0.0, 100, XaxisStart, YaxisStart, Xrange, + Yrange, clBlack, self); + + // Draw line for alpha + F := fpercentpoint(1.0-alpha,df1,df2); + Fprop := F / MaxF; + h := Ffunc(F,df1,df2); + hprop := (MaxProb - h) / MaxProb; + X := round( Fprop * Xrange)+ XaxisStart; + Y := YaxisEnd + round( hprop * Yrange); + BlankFrm.Image1.Canvas.MoveTo(X,YaxisStart); + BlankFrm.Image1.Canvas.LineTo(X,Y); // alpha cutoff + + // floodfill main section with blue + BlankFrm.Canvas.Brush.Color := clBlue; + + // create charLabeled axis + Hscale(0.0, MaxF, 11, clWhite, 10, XaxisStart, YaxisStart, + Xrange,'F SCALE',self); + Vscale(0.0, MaxProb, 11, clWhite, 10, XaxisStart, YaxisStart, + Yrange, 'DENSITY',self); + + // Print Heading + t := BlankFrm.Image1.Canvas.TextWidth(charLabel); + X := (BlankFrm.Image1.Width div 2) - (t div 2); + BlankFrm.Image1.Canvas.TextOut(X,0,charLabel); + charLabel := 'Critical Value = '; + charLabel := charLabel + format('%6.3f',[F]); + t := BlankFrm.Image1.Canvas.TextWidth(charLabel); + X := (BlankFrm.Image1.Width div 2) - (t div 2); + BlankFrm.Image1.Canvas.TextOut(X,BlankFrm.Image1.Canvas.TextHeight(charLabel),charLabel); +end; + +procedure TDistribFrm.Hscale(Xmin, Xmax: double; Nsteps: integer; + acolor: TColor; FontSize: integer; X, Y, Xlength: integer; charLabel: string; + Sender: TObject); +var + i, TickEnd, Xpos, Ypos, TextX : integer; + Xincr, Xval : double; + Svalue, Ast : string; +begin + BlankFrm.Image1.Canvas.MoveTo(X,Y); + BlankFrm.Image1.Canvas.LineTo(X+Xlength,Y); + BlankFrm.Image1.Canvas.Font.Size := FontSize; + BlankFrm.Image1.Canvas.Brush.Color := acolor; + TickEnd := Y + 10; + Xincr := (Xmax - Xmin) / Nsteps; + for i := 0 to Nsteps do + begin + Xpos := round(((Xlength / Nsteps) * i) + X); + BlankFrm.Image1.Canvas.MoveTo(Xpos,Y); + BlankFrm.Image1.Canvas.LineTo(Xpos,TickEnd); + TextX := Xpos - 8; + Xval := Xmin + ( i * Xincr); + Svalue := format('%4.2f',[Xval]); + Ast := Svalue; + BlankFrm.Image1.Canvas.TextOut(TextX, Y+15, Ast); + end; + // print charLabel below X axis + Ypos := Y + 30; + Xpos := round((BlankFrm.Width / 2) - (BlankFrm.Image1.Canvas.TextWidth(charLabel) / 2)); + BlankFrm.Image1.Canvas.TextOut(Xpos,Ypos,charLabel); +end; + +procedure TDistribFrm.Vscale(Ymin, Ymax: double; Nsteps: integer; + acolor: TColor; FontSize: integer; X, Y, Ylength: integer; charLabel: string; + Sender: TObject); +var + TickEnd, Ypos, Xpos, TextY : integer; + Yincr, Yval : double; + Svalue, symbol, Ast : string; + chpixs, i : integer; +begin + BlankFrm.Image1.Canvas.MoveTo(X,Y); + BlankFrm.Image1.Canvas.LineTo(X,Y-Ylength); + BlankFrm.Image1.Canvas.Font.Size := FontSize; + BlankFrm.Image1.Canvas.Brush.Color := acolor; + TickEnd := X - 10; + Yincr := (Ymax - Ymin) / Nsteps; + TextY := 0; + for i := 0 to Nsteps do + begin + Ypos := round(Y - ((Ylength / Nsteps) * i)); + BlankFrm.Image1.Canvas.MoveTo(X,Ypos); + BlankFrm.Image1.Canvas.LineTo(TickEnd,Ypos); + TextY := TickEnd - 30; + Yval := Ymin + ( i * Yincr); + Svalue := format('%4.2f',[Yval]); + Ast := Svalue; + BlankFrm.Image1.Canvas.TextOut(TextY, Ypos-8, Ast); + end; + // print charLabel vertically + Xpos := TextY - 15; + for i := 1 to Length(charLabel) do + begin + chpixs := BlankFrm.Image1.Canvas.TextHeight(charLabel); + Ypos := round(Y - (Ylength / 2) - ( (Length(charLabel) * chpixs) / 2 ) + (chpixs * i)); + symbol := charLabel[i]; +// symbol[2] := 0; + BlankFrm.Image1.Canvas.TextOut(Xpos,Ypos,symbol); + end; +end; + +procedure TDistribFrm.NormPts(zMin, zMax: double; Npts: integer; + var realpts: TwoCol; Sender: TObject); +var + zIncr, z, h : double; + i : integer; +begin + zIncr := (zMax - zMin) / Npts; + for i := 1 to Npts do + begin + z := zMin + (zIncr * i); + h := (1.0 / sqrt(2.0 * 3.14159265358979)) * + ( 1.0 / exp(z * z / 2.0)); + realpts[1,i] := z; + realpts[2,i] := h; + end; +end; + +procedure TDistribFrm.PltPts(realpts: TwoCol; Xmax, Xmin, Ymax, Ymin: double; + Npts, XaxisStart, YaxisStart, XaxisRange: integer; YaxisRange: integer; + acolor: TColor; Sender: TObject); +var + hprop, zprop, z, h : double; + i, X, Y : integer; + intpts : array[1..100] of TPoint; +begin + for i := 1 to Npts do + begin + z := realpts[1,i]; + h := realpts[2,i]; + zprop := (z - Xmin) / (Xmax - Xmin); + X := round((zprop * XaxisRange) + XaxisStart); + hprop := (h - Ymin) / (Ymax - Ymin); + Y := round(YaxisStart - (hprop * YaxisRange)); + intpts[i] := Point(X,Y); + end; + BlankFrm.Image1.Canvas.Pen.Color := acolor; + BlankFrm.Image1.Canvas.Polyline(Slice(intpts,Npts - 1)); +end; + +procedure TDistribFrm.ChiPts(cMin, cMax: double; Npts, df: integer; + var realpts: TwoCol; Sender: TObject); +var + ratio1, ratio2, ratio3, cIncr, chi, h : double; + i : integer; +begin + ratio1 := df / 2.0; + ratio2 := (df - 2.0) / 2.0; + cIncr := (cMax - cMin) / Npts; + for i := 1 to Npts do + begin + chi := cMin + (cIncr * i); +// h := inversechi(chi, df); + ratio3 := chi / 2.0; + h := (1.0 / (power(2.0,ratio1) * exp(lngamma(ratio1)))) * power(chi,ratio2) * ( 1.0 / exp(ratio3)); + realpts[1,i] := chi; + realpts[2,i] := h; + end; +end; + +procedure TDistribFrm.FPts(FMin, FMax: double; Npts, df1, df2: integer; + var realpts: TwoCol; Sender: TObject); +var + FIncr, F, h : double; + i : integer; +begin + FIncr := (FMax - FMin) / Npts; + for i := 1 to Npts do + begin + F := FMin + (FIncr * i); + h := Ffunc(F, df1, df2); + realpts[1,i] := F; + realpts[2,i] := h; + end; +end; + +function TDistribFrm.chi2func(chisqr, df: double): double; +var + ratio1, ratio2, ratio3, h : double; +begin + // Returns the height of the density curve for the chi-squared statistic + ratio1 := df / 2.0; + ratio2 := (df - 2.0) / 2.0; + ratio3 := chisqr / 2.0; + h := (1.0 / (power(2.0,ratio1) * exp(lngamma(ratio1)))) * power(chisqr,ratio2) * ( 1.0 / exp(ratio3)); + Result := h; +end; + +function TDistribFrm.Ffunc(F: double; df1, df2: integer): double; +var + ratio1, ratio2, ratio3, ratio4, h : double; + part1, part2, part3, part4, part5, part6, part7, part8, part9 : double; +begin + // Returns the height of the density curve for the F statistic + ratio1 := (df1 + df2) / 2.0; + ratio2 := (df1 - 2.0) / 2.0; + ratio3 := df1 / 2.0; + ratio4 := df2 / 2.0; + part1 := exp(lngamma(ratio1)); + part2 := power(df1,ratio3); + part3 := power(df2,ratio4); + part4 := exp(lngamma(ratio3)); + part5 := exp(lngamma(ratio4)); + part6 := power(F,ratio2); + part7 := power((F*df1+df2),ratio1); + part8 := (part1 * part2 * part3) / (part4 * part5); + if (part7 = 0.0) then part9 := 0.0 + else part9 := part6 / part7; + h := part8 * part9; +{ + ratio1 := (df1 + df2) / 2.0; + ratio2 := (df1 - 2.0) / 2.0; + ratio3 := df1 / 2.0; + ratio4 := df2 / 2.0; + ffunc := ((gamma(ratio1) * realraise(df1,ratio3) * + realraise(df2,ratio4)) / + (gamma(ratio3) * gamma(ratio4))) * + (realraise(f,ratio2) / realraise((f*df1+df2),ratio1)); +} + Result := h; +end; + +initialization + {$I distribunit.lrs} + +end. +