diff --git a/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.lfm b/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.lfm index a0163a7a4..6a0b21dce 100644 --- a/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.lfm +++ b/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.lfm @@ -254,15 +254,16 @@ inherited HierarchForm: THierarchForm Height = 421 Width = 397 ActivePage = StatsPage + TabIndex = 2 inherited ReportPage: TTabSheet Caption = 'Results' end - object StatsPage: TTabSheet[1] - Caption = 'Descriptive Stats' + inherited ChartPage: TTabSheet + Caption = 'Groups Count vs. Errors Plot' TabVisible = False end - inherited ChartPage: TTabSheet[2] - Caption = 'Groups Count vs. Errors Plot' + object StatsPage: TTabSheet[2] + Caption = 'Descriptive Stats' TabVisible = False end end diff --git a/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.pas b/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.pas index f8755ceca..f90b81779 100644 --- a/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.pas +++ b/applications/lazstats/source/forms/analysis/multivariate/hierarchunit.pas @@ -7,14 +7,10 @@ unit HierarchUnit; {$mode objfpc}{$H+} -{$DEFINE OLD_PLOT} - interface uses - Classes, SysUtils, Forms, Controls, Graphics, Dialogs, - StdCtrls, Buttons, ExtCtrls, ComCtrls, - {$IFDEF OLD_PLOT} GraphLib, {$ENDIF} + Classes, SysUtils, Forms, Controls, Graphics, StdCtrls, Buttons, ExtCtrls, ComCtrls, MainUnit, Globals, MatrixLib, ReportFrameUnit, BasicStatsReportAndChartFormUnit; type @@ -74,7 +70,7 @@ implementation uses TAChartUtils, TACustomSeries, - Utils, DataProcs, ChartFrameUnit; + Utils, GridProcs, DataProcs, ChartFrameUnit; { THierarchForm } @@ -128,7 +124,6 @@ var variances: DblDyneVec = nil; stddevs: DblDyneVec = nil; Distance : DblDyneMat = nil; - cellstring: string; i, j, k, k1, k3, L, w3, n3, n4, n5, M, col, count: integer; GrpCnt, Nrows, Ncols, NoSelected: integer; X, Y, d1, x1, MaxError: double; @@ -156,6 +151,12 @@ begin nCols := NoSelected; nRows := NoCases; + for i := 0 to nCols-1 do // nCols = NoSelected! + begin + varLabels[i] := PredList.Items[i]; + colSelected[i] := GetVariableIndex(OS3MainFrm.DataGrid, varLabels[i]); + end; + { for i := 0 to nCols - 1 do begin cellstring := PredList.Items.Strings[i]; @@ -168,7 +169,8 @@ begin end; end; end; - for i := 0 to NoCases-1 do rowlabels[i] := IntToStr(i); + } + for i := 0 to NoCases-1 do rowLabels[i] := OS3MainFrm.DataGrid.Cells[0, i+1]; //IntToStr(i); end else begin SetLength(w2,NoSelected); @@ -185,9 +187,15 @@ begin SetLength(varlabels,NoCases); SetLength(rowlabels,NoSelected); SetLength(ColSelected,NoSelected); - Ncols := NoCases; - Nrows := NoSelected; + nCols := NoCases; + nRows := NoSelected; //Get labels of selected variables + for i := 0 to nRows - 1 do // nRows = NoSelected! + begin + rowLabels[i] := PredList.Items[i]; + colSelected[i] := GetVariableIndex(OS3MainFrm.DataGrid, rowLabels[i]); + end; + { for i := 0 to nRows - 1 do begin cellstring := PredList.Items.Strings[i]; @@ -200,8 +208,9 @@ begin end; end; end; + } for i := 0 to NoCases-1 do - varlabels[i] := IntToStr(i); + varlabels[i] := OS3MainFrm.DataGrid.Cells[0, i+1]; //IntToStr(i); end; if MaxGrpsChk.Checked then @@ -413,30 +422,33 @@ next1: goto next1; // Print group memberships of all objects, if optioned - lReport.Add(''); - for i := 1 to nRows do + if MembersChk.Checked then begin - if (k5[i-1] = i) then + lReport.Add(''); + for i := 1 to nRows do begin - L := 0; - for j := 1 to Nrows do + if (k5[i-1] = i) then begin - if (k5[j-1] = i) then + L := 0; + for j := 1 to Nrows do begin - L := L + 1; - L1[L-1] := k4[j-1]; - if k3 = 1 then L1[L-1] := j; + if (k5[j-1] = i) then + begin + L := L + 1; + L1[L-1] := k4[j-1]; + if k3 = 1 then L1[L-1] := j; + end; end; - end; - if k3 = 1 then - begin - lReport.Add('Group %d (n = %d)', [i, L]); - for j := 1 to L do - lReport.Add(' Object: %s', [rowlabels[L1[j-1]-1]]); + if k3 = 1 then + begin + lReport.Add('Group %d (n = %d)', [i, L]); + for j := 1 to L do + lReport.Add(' Object: %s', [rowLabels[L1[j-1]-1]]); + end; // end if end; // end if - end; // end if - end; // next i - lReport.Add(''); + end; // next i + lReport.Add(''); + end; goto next1; //until n3 = 2; end; // end if @@ -447,29 +459,6 @@ next1: begin ChartPage.TabVisible := true; Plot_GroupCount_Error(XAxis, YAxis, GrpCnt); - - {$IFDEF OLD_PLOTS} - SetLength(GraphFrm.Ypoints,1,GrpCnt); - SetLength(GraphFrm.Xpoints,1,GrpCnt); - for i := 1 to GrpCnt do - begin - GraphFrm.Ypoints[0,i-1] := YAxis[i-1]; - GraphFrm.Xpoints[0,i-1] := XAxis[i-1]; - end; - GraphFrm.nosets := 1; - GraphFrm.nbars := GrpCnt; - GraphFrm.Heading := 'NO. GROUPS VERSUS GROUPING ERROR'; - GraphFrm.XTitle := 'NO. GROUPS'; - GraphFrm.YTitle := 'ERROR'; -// GraphFrm.Ypoints[1] := YAxis; -// GraphFrm.Xpoints[1] := XAxis; - GraphFrm.AutoScaled := true; - GraphFrm.PtLabels := false; - GraphFrm.GraphType := 7; // 2d points - GraphFrm.BackColor := clCream; - GraphFrm.ShowBackWall := true; - GraphFrm.ShowModal; - {$ENDIF} end else ChartPage.TabVisible := false; @@ -653,7 +642,6 @@ end; procedure THierarchForm.VarListDblClick(Sender: TObject); var index: Integer; - s: String; begin index := VarList.ItemIndex; if index > -1 then diff --git a/applications/lazstats/source_orig/ERRORCURVESUNIT.lfm b/applications/lazstats/source_orig/ERRORCURVESUNIT.lfm new file mode 100644 index 000000000..cd03354a7 --- /dev/null +++ b/applications/lazstats/source_orig/ERRORCURVESUNIT.lfm @@ -0,0 +1,151 @@ +object ErrorCurvesFrm: TErrorCurvesFrm + Left = 172 + Height = 276 + Top = 104 + Width = 383 + Caption = 'Alpha and Beta Curves for z tests' + ClientHeight = 276 + ClientWidth = 383 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 7 + Height = 14 + Top = 87 + Width = 135 + Caption = 'Mean of the Null Hypothesis' + ParentColor = False + end + object Label2: TLabel + Left = 7 + Height = 14 + Top = 119 + Width = 171 + Caption = 'Mean of the Alternative Hypothesis' + ParentColor = False + end + object Label3: TLabel + Left = 7 + Height = 14 + Top = 151 + Width = 182 + Caption = 'Standard Deviation of the Distribution' + ParentColor = False + end + object Label4: TLabel + Left = 7 + Height = 14 + Top = 184 + Width = 170 + Caption = 'Probability of Making a Type I Error' + ParentColor = False + end + object Label5: TLabel + Left = 7 + Height = 14 + Top = 216 + Width = 174 + Caption = 'Probability of Making a Type II Error' + ParentColor = False + end + object NullMeanEdit: TEdit + Left = 198 + Height = 21 + Top = 80 + Width = 60 + TabOrder = 0 + Text = 'NullMeanEdit' + end + object AltMeanEdit: TEdit + Left = 198 + Height = 21 + Top = 112 + Width = 60 + TabOrder = 1 + Text = 'Edit1' + end + object SDEdit: TEdit + Left = 198 + Height = 21 + Top = 144 + Width = 60 + TabOrder = 2 + Text = 'Edit1' + end + object TypeIEdit: TEdit + Left = 198 + Height = 21 + Top = 176 + Width = 60 + TabOrder = 3 + Text = 'Edit1' + end + object TypeIIEdit: TEdit + Left = 198 + Height = 21 + Top = 208 + Width = 60 + TabOrder = 4 + Text = 'Edit1' + end + object ResetBtn: TButton + Left = 288 + Height = 29 + Top = 72 + Width = 70 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 5 + end + object CancelBtn: TButton + Left = 288 + Height = 29 + Top = 9 + Width = 70 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 6 + end + object ComputeBtn: TButton + Left = 288 + Height = 29 + Top = 136 + Width = 70 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 7 + end + object ReturnBtn: TButton + Left = 288 + Height = 29 + Top = 200 + Width = 70 + Caption = 'Return' + ModalResult = 1 + TabOrder = 8 + end + object NullType: TRadioGroup + Left = 8 + Height = 67 + Top = 0 + Width = 252 + AutoFill = True + Caption = 'Null Hypothesis Characteristic:' + 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 = 49 + ClientWidth = 248 + ItemIndex = 1 + Items.Strings = ( + 'One-tailed (Directional alterntive)' + 'Two-tailed (non-directional alterntive)' + ) + TabOrder = 9 + end +end diff --git a/applications/lazstats/source_orig/ERRORCURVESUNIT.lrs b/applications/lazstats/source_orig/ERRORCURVESUNIT.lrs new file mode 100644 index 000000000..98b06e4ae --- /dev/null +++ b/applications/lazstats/source_orig/ERRORCURVESUNIT.lrs @@ -0,0 +1,42 @@ +LazarusResources.Add('TErrorCurvesFrm','FORMDATA',[ + 'TPF0'#15'TErrorCurvesFrm'#14'ErrorCurvesFrm'#4'Left'#3#172#0#6'Height'#3#20#1 + +#3'Top'#2'h'#5'Width'#3#127#1#7'Caption'#6'!Alpha and Beta Curves for z test' + +'s'#12'ClientHeight'#3#20#1#11'ClientWidth'#3#127#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'W'#5'Width'#3#135#0#7'Caption'#6#27'Mean of the Null Hypothesis' + +#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'#2#7#6'Height'#2#14#3'Top' + +#2'w'#5'Width'#3#171#0#7'Caption'#6'"Mean of the Alternative Hypothesis'#11 + +'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#7#6'Height'#2#14#3'Top'#3 + +#151#0#5'Width'#3#182#0#7'Caption'#6'&Standard Deviation of the Distribution' + +#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#2#7#6'Height'#2#14#3'Top' + +#3#184#0#5'Width'#3#170#0#7'Caption'#6'$Probability of Making a Type I Error' + +#11'ParentColor'#8#0#0#6'TLabel'#6'Label5'#4'Left'#2#7#6'Height'#2#14#3'Top' + +#3#216#0#5'Width'#3#174#0#7'Caption'#6'%Probability of Making a Type II Erro' + +'r'#11'ParentColor'#8#0#0#5'TEdit'#12'NullMeanEdit'#4'Left'#3#198#0#6'Height' + +#2#21#3'Top'#2'P'#5'Width'#2'<'#8'TabOrder'#2#0#4'Text'#6#12'NullMeanEdit'#0 + +#0#5'TEdit'#11'AltMeanEdit'#4'Left'#3#198#0#6'Height'#2#21#3'Top'#2'p'#5'Wid' + +'th'#2'<'#8'TabOrder'#2#1#4'Text'#6#5'Edit1'#0#0#5'TEdit'#6'SDEdit'#4'Left'#3 + +#198#0#6'Height'#2#21#3'Top'#3#144#0#5'Width'#2'<'#8'TabOrder'#2#2#4'Text'#6 + +#5'Edit1'#0#0#5'TEdit'#9'TypeIEdit'#4'Left'#3#198#0#6'Height'#2#21#3'Top'#3 + +#176#0#5'Width'#2'<'#8'TabOrder'#2#3#4'Text'#6#5'Edit1'#0#0#5'TEdit'#10'Type' + +'IIEdit'#4'Left'#3#198#0#6'Height'#2#21#3'Top'#3#208#0#5'Width'#2'<'#8'TabOr' + +'der'#2#4#4'Text'#6#5'Edit1'#0#0#7'TButton'#8'ResetBtn'#4'Left'#3' '#1#6'Hei' + +'ght'#2#29#3'Top'#2'H'#5'Width'#2'F'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'R' + +'esetBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#9'CancelBtn'#4'Left'#3' '#1#6 + +'Height'#2#29#3'Top'#2#9#5'Width'#2'F'#7'Caption'#6#6'Cancel'#11'ModalResult' + +#2#2#8'TabOrder'#2#6#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3' '#1#6'Height'#2 + +#29#3'Top'#3#136#0#5'Width'#2'F'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'Com' + +'puteBtnClick'#8'TabOrder'#2#7#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3' '#1#6 + +'Height'#2#29#3'Top'#3#200#0#5'Width'#2'F'#7'Caption'#6#6'Return'#11'ModalRe' + +'sult'#2#1#8'TabOrder'#2#8#0#0#11'TRadioGroup'#8'NullType'#4'Left'#2#8#6'Hei' + +'ght'#2'C'#3'Top'#2#0#5'Width'#3#252#0#8'AutoFill'#9#7'Caption'#6#31'Null Hy' + +'pothesis Characteristic:'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizi' + +'ng.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogeno' + +'usChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResiz' + +'e'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.Shr' + +'inkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRigh' + +'tThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#2'1' + +#11'ClientWidth'#3#248#0#9'ItemIndex'#2#1#13'Items.Strings'#1#6'#One-tailed ' + +'(Directional alterntive)'#6'''Two-tailed (non-directional alterntive)'#0#8 + +'TabOrder'#2#9#0#0#0 +]); diff --git a/applications/lazstats/source_orig/ESSAYUNIT.PAS b/applications/lazstats/source_orig/ESSAYUNIT.PAS new file mode 100644 index 000000000..0c3b1a662 --- /dev/null +++ b/applications/lazstats/source_orig/ESSAYUNIT.PAS @@ -0,0 +1,420 @@ +unit EssayUnit; + +{$MODE Delphi} + +interface + +uses + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, ExtCtrls, ItemBankGlobals, ExtDlgs, FunctionsUnit; + +type + TEssayFrm = class(TForm) + Label2: TLabel; + ItemNoEdit: TEdit; + ItemNoScroll: TScrollBar; + Label1: TLabel; + CodeCombo: TComboBox; + Label14: TLabel; + BMPFileEdit: TEdit; + Label15: TLabel; + BrowseBtn: TButton; + ClearBtn: TButton; + Label16: TLabel; + BMPImage: TImage; + Label18: TLabel; + ItemWeightEdit: TEdit; + Panel1: TPanel; + Label9: TLabel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label13: TLabel; + PcntEdit: TEdit; + IRT1Edit: TEdit; + IRT2Edit: TEdit; + IRT3Edit: TEdit; + NoSelEdit: TEdit; + Label3: TLabel; + StemMemo: TMemo; + NewBtn: TButton; + SaveBtn: TButton; + DeleteBtn: TButton; + ReturnBtn: TButton; + AnswerMemo: TMemo; + Label4: TLabel; + OpenPictureDialog1: TOpenPictureDialog; + Label5: TLabel; + SymbolBox: TListBox; + Label6: TLabel; + OpenDialog1: TOpenDialog; + procedure FormShow(Sender: TObject); + procedure ShowEssayItem(Sender: TObject; itemno : integer); + procedure ReturnBtnClick(Sender: TObject); + procedure NewBtnClick(Sender: TObject); + procedure SaveBtnClick(Sender: TObject); + procedure LoadRecord(VAR NewRcd : EssayItemRcd; Sender : TObject); + procedure DeleteBtnClick(Sender: TObject); + procedure BrowseBtnClick(Sender: TObject); + procedure ItemNoScrollScroll(Sender: TObject; ScrollCode: TScrollCode; + var ScrollPos: Integer); + procedure ClearBtnClick(Sender: TObject); + procedure SymbolBoxClick(Sender: TObject); + procedure StemMemoEnter(Sender: TObject); + procedure AnswerMemoEnter(Sender: TObject); + private + { Private declarations } + maxitems : integer; + ARcd : EssayItemRcd; + symbol : char; + EditBox : integer; + public + { Public declarations } + end; + +var + EssayFrm: TEssayFrm; + +implementation + +{$R *.lfm} + +procedure TEssayFrm.FormShow(Sender: TObject); +var + F : TextFile; + S : string; + TF : File of EssayItemRcd; + i : integer; +begin + StemMemo.Clear; + AnswerMemo.Clear; + ItemNoScroll.Min := 1; + ItemNoScroll.Max := 1; + ItemNoEdit.Text := '1'; + ItemNoScroll.Position := 1; + CodeCombo.Text := ''; + BMPFileEdit.Text := ''; + PcntEdit.Text := '0'; + IRT1Edit.Text := '0'; + IRT2Edit.Text := '0'; + IRT3Edit.Text := '0'; + NoSelEdit.Text := '0'; + ItemWeightEdit.Text := '0'; + maxitems := 0; + OpenDialog1.DefaultExt := '.COD'; + OpenDialog1.Filter := 'Code files (*.cod)|*.COD|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OpenDialog1.FilterIndex := 1; + OpenDialog1.FileName := BankPath + ExtractFileName(BankName) + '.COD'; + OpenDialog1.Title := 'Name of Item Code File:'; + if OpenDialog1.Execute then + begin + AssignFile(F,OpenDialog1.filename); + ReSet(F); + while not EOF(F) do + begin + readln(F,S); + CodeCombo.Items.Add(S); + end; + end + else begin + ShowMessage('You must first open a file of item codes.'); + exit; + end; + CloseFile(F); + S := BankPath + 'EssayFile' + ExtractFileName(BankName); + EssayFName := S; + if FileExists(S) { *Converted from FileExists* } then + begin + AssignFile(TF,S); + Reset(TF); + while not EOF(TF) do + begin + read(TF,EssayItem); + maxitems := maxitems + 1; + end; + CloseFile(TF); + if maxitems > ItemNoScroll.Max then + ItemNoScroll.Max := maxitems; + ItemNoScroll.Min := 1; + end + else begin // create empty file + AssignFile(TF,S); + rewrite(TF); + CloseFile(TF); + end; + for i := 1 to 20 do ARcd.BestAns[i] := ''; + if maxitems > 0 then + begin + ItemNoScroll.Position := 1; + ShowEssayItem(self,1); + end; + SymbolBox.Clear; + for i := 127 to 255 do SymbolBox.Items.Add(chr(ord(i))); +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.ShowEssayItem(Sender: TObject; itemno : integer); +var + S : string; + F : File of EssayItemRcd; + where : longint; + Frecd : EssayItemRcd; + i : integer; + +begin + ItemNoEdit.Text := IntToStr(ItemNoScroll.Position); + S := BankPath + 'EssayFile' + ExtractFileName(BankName); + AssignFile(F,S); + Reset(F); + where := itemno-1; + Seek(F,where); + read(F,FRecd); + CloseFile(F); + CodeCombo.Text := Frecd.Code; + BMPFileEdit.Text := Frecd.Picture; + PcntEdit.Text := FloatToStr(Frecd.PcntPass); + if BMPFileEdit.Text <> '' then + begin + if FileExists(Frecd.Picture) { *Converted from FileExists* } then + begin + BMPImage.Picture.LoadFromFile(Frecd.Picture); + BMPImage.Visible := true; + end + else begin +// ShowMessage('Image ' + Frecd.Picture + ' not found.'); + BMPFileEdit.Text := ''; + Frecd.Picture := ''; + end; + end + else BMPImage.Visible := false; + ItemWeightEdit.Text := IntToStr(Frecd.ItemWeight); + IRT1Edit.Text := FloatToStr(Frecd.IRT[1]); + IRT2Edit.Text := FloatToStr(Frecd.IRT[2]); + IRT3Edit.Text := FLoatToStr(Frecd.IRT[3]); + StemMemo.Clear; + for i := 1 to 20 do + begin + S := Frecd.ItemStem[i]; + if length(S) > 0 then StemMemo.Lines.Add(S); + end; + AnswerMemo.Clear; + for i := 1 to 20 do + begin + S := Frecd.BestAns[i]; + if length(S) > 0 then AnswerMemo.Lines.Add(S); + end; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.ReturnBtnClick(Sender: TObject); +begin + EssayFrm.Hide; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.NewBtnClick(Sender: TObject); +begin + StemMemo.Clear; + AnswerMemo.Clear; + ItemNoScroll.Max := maxitems + 1; + ItemNoScroll.Position := ItemNoScroll.Max; + ItemNoEdit.Text := IntToStr(ItemNoScroll.Position); + CodeCombo.Text := ''; + BMPFileEdit.Text := ''; + BMPImage.Visible := false; + PcntEdit.Text := '0'; + IRT1Edit.Text := '0'; + IRT2Edit.Text := '0'; + IRT3Edit.Text := '0'; + NoSelEdit.Text := '0'; + ItemWeightEdit.Text := '0'; + BMPImage.Visible := false; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.SaveBtnClick(Sender: TObject); +var + NewRcd : EssayItemRcd; + itemno : integer; + +begin + itemno := ItemNoScroll.Position; + LoadRecord(NewRcd,self); + WriteESItem(itemno,NewRcd); + if itemno > maxitems then + begin + maxitems := itemno; + ItemNoScroll.Max := maxitems+1; + end; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.LoadRecord(VAR NewRcd : EssayItemRcd; Sender : TObject); +var + i : integer; + S : string; +begin + NewRcd.ItemNo := ItemNoScroll.Position; + NewRcd.Code := CodeCombo.Text; + for i := 0 to StemMemo.Lines.Count-1 do + begin + S := Trim(StemMemo.Lines[i]); + NewRcd.ItemStem[i+1] := S; + end; + if StemMemo.Lines.Count < 20 then + for i := StemMemo.Lines.Count+1 to 20 do NewRcd.ItemStem[i] := ''; + for i := 0 to AnswerMemo.Lines.Count-1 do + begin + S := Trim(AnswerMemo.Lines[i]); + NewRcd.BestAns[i+1] := S; + end; + if AnswerMemo.Lines.Count < 20 then + for i := AnswerMemo.Lines.Count+1 to 20 do NewRcd.BestAns[i] := ''; + NewRcd.ItemWeight := StrToInt(ItemWeightEdit.Text); + NewRcd.Picture := BMPFileEdit.Text; + NewRcd.PcntPass := StrToFloat(PcntEdit.Text); + NewRcd.IRT[1] := StrToFloat(IRT1Edit.Text); + NewRcd.IRT[2] := StrToFloat(IRT2Edit.Text); + NewRcd.IRT[3] := StrToFloat(IRT3Edit.Text); + NewRcd.FreqElect := StrToInt(NoSelEdit.Text); +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.DeleteBtnClick(Sender: TObject); +var + FOld : File of EssayItemRcd; + FNew : File of EssayItemRcd; + itemno : integer; + i : integer; + SOld : string; + SNew : string; + +begin + itemno := ItemNoScroll.Position; + SOld := BankPath + 'EssayFile' + ExtractFileName(BankName); + AssignFile(FOld,SOld); + ReSet(FOld); + SNew := BankPath + 'TempEssayFile'; + AssignFile(FNew,SNew); + Rewrite(FNew); + // copy up to itemno from old file to new file + for i := 1 to itemno-1 do + begin + if not EOF(FOld) then + begin + read(FOld,ARcd); + write(FNew,ARcd); + end; + end; + // read past itemno to delete + if not EOF(FOld) then read(FOld,ARcd); + // write remaining records, if any, from old to new + if not EOF(FOld) then + begin + while not EOF(FOld) do + begin + read(FOld,ARcd); + write(FNew,ARcd); + end; + end; + CloseFile(FOld); + CloseFile(FNew); + // delete old file and rename temp file to old file name + DeleteFile(SOld); { *Converted from DeleteFile* } + RenameFile(SNew, Sold); { *Converted from RenameFile* } + maxitems := maxitems - 1; + if maxitems > 0 then ItemNoScroll.Max := maxitems else + ItemNoScroll.Max := 1; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.BrowseBtnClick(Sender: TObject); +begin + if OpenPictureDialog1.Execute then + begin + BMPFileEdit.Text := OpenPictureDialog1.FileName; + BMPImage.Picture.LoadFromFile(BMPFileEdit.Text); + BMPImage.Visible := true; + end; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.ItemNoScrollScroll(Sender: TObject; + ScrollCode: TScrollCode; var ScrollPos: Integer); +var + itemno : integer; +begin + itemno := ScrollPos; + if (itemno > maxitems) or (itemno < 1) then exit; + ItemNoEdit.Text := IntToStr(itemno); + ShowEssayItem(self,itemno); +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.ClearBtnClick(Sender: TObject); +begin + BMPFileEdit.Text := ''; + BMPImage.Visible := false; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.SymbolBoxClick(Sender: TObject); +var + index : integer; + S : string; +begin + if EditBox = 1 then + begin + index := SymbolBox.ItemIndex; + S := SymbolBox.Items.Strings[index]; + symbol := S[1]; + index := StemMemo.Lines.Count; + if index > 0 then + begin + S := StemMemo.Lines.Strings[index-1]; + StemMemo.Lines.Delete(index-1); + S := S + symbol; + StemMemo.Lines.Insert(index-1,S); + end + else begin + S := StemMemo.Lines.Strings[0]; + StemMemo.Lines.Delete(0); + S := S + symbol; + StemMemo.Lines.Add(S); + end; + end + else begin + index := SymbolBox.ItemIndex; + S := SymbolBox.Items.Strings[index]; + symbol := S[1]; + index := AnswerMemo.Lines.Count; + if index > 0 then + begin + S := AnswerMemo.Lines.Strings[index-1]; + AnswerMemo.Lines.Delete(index-1); + S := S + symbol; + AnswerMemo.Lines.Insert(index-1,S); + end + else begin + S := AnswerMemo.Lines.Strings[0]; + AnswerMemo.Lines.Delete(0); + S := S + symbol; + AnswerMemo.Lines.Add(S); + end; + end; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.StemMemoEnter(Sender: TObject); +begin + EditBox := 1; +end; +//------------------------------------------------------------------- + +procedure TEssayFrm.AnswerMemoEnter(Sender: TObject); +begin + EditBox := 2; +end; +//------------------------------------------------------------------- + +end. diff --git a/applications/lazstats/source_orig/ESSAYUNIT.lfm b/applications/lazstats/source_orig/ESSAYUNIT.lfm new file mode 100644 index 000000000..b33034cd7 --- /dev/null +++ b/applications/lazstats/source_orig/ESSAYUNIT.lfm @@ -0,0 +1,329 @@ +object EssayFrm: TEssayFrm + Left = 23 + Top = 10 + HelpContext = 1855 + BorderStyle = bsDialog + Caption = 'Essay Item Specification' + ClientHeight = 479 + ClientWidth = 658 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + HelpFile = 'ITEMBANKHELP.HLP' + OnShow = FormShow + PixelsPerInch = 96 + object Label2: TLabel + Left = 16 + Top = 8 + Width = 63 + Height = 13 + Caption = 'Item Number:' + end + object Label1: TLabel + Left = 160 + Top = 8 + Width = 281 + Height = 13 + Caption = 'Click on the Item Classification Code listed in the box below.' + end + object Label14: TLabel + Left = 16 + Top = 64 + Width = 89 + Height = 13 + Caption = 'Bit Map File Name:' + end + object Label15: TLabel + Left = 16 + Top = 88 + Width = 72 + Height = 13 + Caption = 'Image (if used):' + end + object Label16: TLabel + Left = 120 + Top = 80 + Width = 97 + Height = 13 + Caption = '(Thumb Nail Sketch)' + end + object BMPImage: TImage + Left = 112 + Top = 96 + Width = 121 + Height = 97 + Center = True + Stretch = True + end + object Label18: TLabel + Left = 248 + Top = 96 + Width = 60 + Height = 13 + Caption = 'Item Weight:' + end + object Label3: TLabel + Left = 16 + Top = 208 + Width = 47 + Height = 13 + Caption = 'Item Stem' + end + object Label4: TLabel + Left = 16 + Top = 328 + Width = 92 + Height = 13 + Caption = 'Suggested Answer:' + end + object Label5: TLabel + Left = 600 + Top = 8 + Width = 39 + Height = 13 + Caption = 'Symbols' + end + object Label6: TLabel + Left = 584 + Top = 24 + Width = 68 + Height = 13 + Caption = 'Click to Select' + end + object ItemNoEdit: TEdit + Left = 104 + Top = 0 + Width = 41 + Height = 21 + TabOrder = 0 + end + object ItemNoScroll: TScrollBar + Left = 16 + Top = 28 + Width = 129 + Height = 16 + Max = 1000 + PageSize = 0 + TabOrder = 1 + OnScroll = ItemNoScrollScroll + end + object CodeCombo: TComboBox + Left = 160 + Top = 24 + Width = 417 + Height = 21 + ItemHeight = 13 + TabOrder = 2 + Text = 'Classification Code' + end + object BMPFileEdit: TEdit + Left = 112 + Top = 56 + Width = 465 + Height = 21 + TabOrder = 3 + Text = 'BMPFileEdit' + end + object BrowseBtn: TButton + Left = 24 + Top = 112 + Width = 57 + Height = 25 + Caption = 'Browse' + TabOrder = 4 + OnClick = BrowseBtnClick + end + object ClearBtn: TButton + Left = 24 + Top = 144 + Width = 57 + Height = 25 + Caption = 'Clear' + TabOrder = 5 + OnClick = ClearBtnClick + end + object ItemWeightEdit: TEdit + Left = 312 + Top = 96 + Width = 33 + Height = 21 + TabOrder = 6 + Text = 'ItemWeightEdit' + end + object Panel1: TPanel + Left = 408 + Top = 80 + Width = 169 + Height = 137 + TabOrder = 7 + object Label9: TLabel + Left = 6 + Top = 14 + Width = 78 + Height = 13 + Caption = 'Percent Passed:' + end + object Label10: TLabel + Left = 6 + Top = 38 + Width = 97 + Height = 13 + Caption = 'Log Difficulty (IRT1):' + end + object Label11: TLabel + Left = 6 + Top = 62 + Width = 86 + Height = 13 + Caption = 'Item Slope (IRT2):' + end + object Label12: TLabel + Left = 6 + Top = 86 + Width = 96 + Height = 13 + Caption = 'Item Chance (IRT3):' + end + object Label13: TLabel + Left = 6 + Top = 110 + Width = 76 + Height = 13 + Caption = 'Times Selected:' + end + object PcntEdit: TEdit + Left = 110 + Top = 6 + Width = 41 + Height = 21 + TabOrder = 0 + end + object IRT1Edit: TEdit + Left = 110 + Top = 30 + Width = 41 + Height = 21 + TabOrder = 1 + end + object IRT2Edit: TEdit + Left = 110 + Top = 54 + Width = 41 + Height = 21 + TabOrder = 2 + end + object IRT3Edit: TEdit + Left = 110 + Top = 78 + Width = 41 + Height = 21 + TabOrder = 3 + end + object NoSelEdit: TEdit + Left = 110 + Top = 102 + Width = 41 + Height = 21 + TabOrder = 4 + end + end + object StemMemo: TMemo + Left = 16 + Top = 224 + Width = 561 + Height = 97 + Font.Charset = GREEK_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Times New Roman' + Font.Style = [] + MaxLength = 1000 + ParentFont = False + ScrollBars = ssVertical + TabOrder = 8 + WantTabs = True + WordWrap = False + OnEnter = StemMemoEnter + end + object NewBtn: TButton + Left = 16 + Top = 443 + Width = 73 + Height = 25 + Caption = 'New Item' + TabOrder = 9 + OnClick = NewBtnClick + end + object SaveBtn: TButton + Left = 104 + Top = 443 + Width = 73 + Height = 25 + Caption = 'Save Item' + TabOrder = 10 + OnClick = SaveBtnClick + end + object DeleteBtn: TButton + Left = 192 + Top = 443 + Width = 73 + Height = 25 + Caption = 'Delete' + TabOrder = 11 + OnClick = DeleteBtnClick + end + object ReturnBtn: TButton + Left = 496 + Top = 443 + Width = 73 + Height = 25 + Caption = 'Return' + ModalResult = 1 + TabOrder = 12 + OnClick = ReturnBtnClick + end + object AnswerMemo: TMemo + Left = 16 + Top = 344 + Width = 553 + Height = 89 + Font.Charset = GREEK_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Times New Roman' + Font.Style = [] + Lines.Strings = ( + '') + MaxLength = 1000 + ParentFont = False + TabOrder = 13 + WantTabs = True + OnEnter = AnswerMemoEnter + end + object SymbolBox: TListBox + Left = 592 + Top = 40 + Width = 49 + Height = 425 + Font.Charset = GREEK_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Times New Roman' + Font.Style = [] + ItemHeight = 19 + ParentFont = False + TabOrder = 14 + OnClick = SymbolBoxClick + end + object OpenPictureDialog1: TOpenPictureDialog + Left = 304 + Top = 440 + end + object OpenDialog1: TOpenDialog + Left = 344 + Top = 440 + end +end diff --git a/applications/lazstats/source_orig/EXACTUNIT.PAS b/applications/lazstats/source_orig/EXACTUNIT.PAS new file mode 100644 index 000000000..7b119f5d8 --- /dev/null +++ b/applications/lazstats/source_orig/EXACTUNIT.PAS @@ -0,0 +1,456 @@ +unit ExactUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + ExtCtrls, StdCtrls, Buttons, MainUnit, OutPutUnit, FunctionsLib, + Globals, DataProcs, Math; + +type + + { TFisherFrm } + + TFisherFrm = class(TForm) + ResetBtn: TButton; + CancelBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + RC11Edit: TEdit; + RC12Edit: TEdit; + RC21Edit: TEdit; + RC22Edit: TEdit; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + NCasesEdit: TEdit; + NCasesLabel: TLabel; + Panel2: TPanel; + RowIn: TBitBtn; + RowOut: TBitBtn; + ColIn: TBitBtn; + ColOut: TBitBtn; + DepIn: TBitBtn; + DepOut: TBitBtn; + ColEdit: TEdit; + DepEdit: TEdit; + RowEdit: TEdit; + InputGrp: TRadioGroup; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + VarList: TListBox; + Panel1: TPanel; + procedure ColInClick(Sender: TObject); + procedure ColOutClick(Sender: TObject); + procedure ComputeBtnClick(Sender: TObject); + procedure DepInClick(Sender: TObject); + procedure DepOutClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure InputGrpClick(Sender: TObject); + procedure RC11EditKeyPress(Sender: TObject; var Key: char); + procedure RC12EditKeyPress(Sender: TObject; var Key: char); + procedure RC21EditKeyPress(Sender: TObject; var Key: char); + procedure RC22EditKeyPress(Sender: TObject; var Key: char); + procedure ResetBtnClick(Sender: TObject); + procedure RowInClick(Sender: TObject); + procedure RowOutClick(Sender: TObject); + private + { private declarations } + procedure FisherTable(A, b, C, d : integer; p, SumP : double); + public + { public declarations } + end; + +var + FisherFrm: TFisherFrm; + +implementation + +{ TFisherFrm } + +procedure TFisherFrm.ResetBtnClick(Sender: TObject); +VAR i : integer; +begin + VarList.Clear; + RowEdit.Text := ''; + ColEdit.Text := ''; + DepEdit.Text := ''; + DepEdit.Visible := false; + RowIn.Visible := true; + RowOut.Visible := false; + ColIn.Visible := false; + ColOut.Visible := false; + DepIn.Visible := false; + DepOut.Visible := false; + NCasesLabel.Visible := false; + Label4.Visible := false; + NCasesEdit.Text := ''; + NCasesEdit.Visible := false; + for i := 1 to NoVariables do + VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + Panel1.Visible := false; + Panel2.Visible := false; + RC11Edit.Text := ''; + RC12Edit.Text := ''; + RC21Edit.Text := ''; + RC22Edit.Text := ''; +end; + +procedure TFisherFrm.RowInClick(Sender: TObject); +VAR index : integer; +begin + index := VarList.ItemIndex; + RowEdit.Text := VarList.Items.Strings[index]; + VarList.Items.Delete(index); + RowIn.Visible := false; + RowOut.Visible := true; +end; + +procedure TFisherFrm.RowOutClick(Sender: TObject); +begin + VarList.Items.Add(RowEdit.Text); + RowEdit.Text := ''; + RowIn.Visible := true; + RowOut.Visible := false; +end; + +procedure TFisherFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; + +procedure TFisherFrm.ColInClick(Sender: TObject); +VAR index : integer; +begin + index := VarList.ItemIndex; + ColEdit.Text := VarList.Items.Strings[index]; + VarList.Items.Delete(index); + ColIn.Visible := false; + ColOut.Visible := true; +end; + +procedure TFisherFrm.ColOutClick(Sender: TObject); +begin + VarList.Items.Add(ColEdit.Text); + ColEdit.Text := ''; + ColIn.Visible := true; + ColOut.Visible := false; +end; + +procedure TFisherFrm.ComputeBtnClick(Sender: TObject); +var + i, j, row, col, caserow, casecol, A, b, C, d, Largest : integer; + N, APlusB, APlusC, BPlusD, CPlusD, NoSelected, dep : integer; + FirstP, p, SumProb, Tocher, Alpha, X : double; + obs : array[1..2,1..2] of integer; + ColNoSelected : IntDyneVec; + done : boolean; + cellstring, outline, response : string; +begin + Randomize; // initialize random number generator + row := 0; + col := 0; + dep := 0; + + // get column no.s of row and col variables + if InputGrp.ItemIndex <> 3 then + begin + for i := 1 to NoVariables do + begin + cellstring := RowEdit.Text; + if cellstring = OS3MainFrm.DataGrid.Cells[i,0] then row := i; + cellstring := ColEdit.Text; + if cellstring = OS3MainFrm.DataGrid.Cells[i,0] then col := i; + if InputGrp.ItemIndex = 2 then + begin + cellstring := DepEdit.Text; + if cellstring = OS3MainFrm.DataGrid.Cells[i,0] then dep := i; + end; + end; + end; + SetLength(ColNoSelected,3); + ColNoSelected[0] := row; + ColNoSelected[1] := col; + if InputGrp.ItemIndex = 2 then + begin + ColNoSelected[2] := dep; + NoSelected := 3; + end + else NoSelected := 2; + + //initialize observed matrix + for i := 1 to 2 do + for j := 1 to 2 do obs[i,j] := 0; + + if InputGrp.ItemIndex = 3 then // get freq. from form + begin + obs[1,1] := StrToInt(RC11Edit.Text); + obs[1,2] := StrToInt(RC12Edit.Text); + obs[2,1] := StrToInt(RC21Edit.Text); + obs[2,2] := StrToInt(RC22Edit.Text); + end; + + if InputGrp.ItemIndex = 0 then // count no. in row/col combinations + begin + for j := 1 to NoCases do + begin + if (not GoodRecord(j,NoSelected,ColNoSelected)) then continue; + caserow := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[row,j]))); + casecol := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,j]))); + if (caserow > 2) or (caserow < 1) then + begin + ShowMessage('ERROR! Row < 1 or > 2 found. Case ignored.'); + continue; + end; + if (casecol > 2) or (casecol < 1) then + begin + ShowMessage('ERROR! Column < 1 or > 2 found. Case ignored.'); + continue; + end; + obs[caserow,casecol] := obs[caserow,casecol] + 1; + end; + end; + + if (InputGrp.ItemIndex = 1) or (InputGrp.ItemIndex = 2) then // Grid has frequencies for row/col + begin + for j := 1 to NoCases do + begin + if (not GoodRecord(j,NoSelected,ColNoSelected)) then continue; + caserow := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[row,j]))); + casecol := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,j]))); + if (caserow > 2) or (caserow < 1) then + begin + ShowMessage('ERROR! Row < 1 or > 2 found. Case ignored.'); + continue; + end; + if (casecol > 2) or (casecol < 1) then + begin + ShowMessage('ERROR! Column < 1 or > 2 found. Case ignored.'); + continue; + end; + obs[caserow,casecol] := round(StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[dep,j]))); + if InputGrp.ItemIndex = 2 then + obs[caserow,casecol] := obs[caserow,casecol] * + StrToInt(NCasesEdit.Text); + end; + end; + + //Find smallest value + A := obs[1,1]; + b := obs[1,2]; + C := obs[2,1]; + d := obs[2,2]; + APlusB := A + b; + CPlusD := C + d; + BPlusD := b + d; + APlusC := A + C; + N := A + b + C + d; + Largest := 1; + if (b > A) then largest := 2; + if ((b > A) and (b > C) and (b > d)) then Largest := 2; + if ((C > A) and (C > b) and (C > d)) then Largest := 3; + if ((d > A) and (d > b) and (d > C)) then Largest := 4; + + //Ready output + OutPutFrm.RichEdit.Clear; + SumProb := 0.0; + OutPutFrm.RichEdit.Lines.Add('Fisher Exact Probability Test'); + OutPutFrm.RichEdit.Lines.Add(''); + + //Get first probability + FirstP := combos(A, APlusC) * combos(b, BPlusD) / combos(APlusB, N); + SumProb := SumProb + FirstP; + FisherTable(A, b, C, d, FirstP, SumProb); + + //Get more extreme probabilities + done := false; + while (not done) do + begin + case Largest of + 1: begin// top row, first col + if (A = APlusB) then done := true + else begin + A := A + 1; + b := b - 1; + C := C - 1; + d := d + 1; + end; + end; + 2: begin// top row, second column + if (b = APlusB) then done := true + else begin + A := A - 1; + b := b + 1; + C := C + 1; + d := d - 1; + end; + end; + 3: begin // second row, first column + if (C = CPlusD) then done := true + else begin + A := A - 1; + b := b + 1; + C := C + 1; + d := d - 1; + end; + end; + 4: begin // second row, second column + if (d = CPlusD) then done := true + else begin + A := A + 1; + b := b - 1; + C := C - 1; + d := d + 1; + end; + end; + end; // end case + if (not done) then + begin + p := combos(A, APlusC) * combos(b, BPlusD) / combos(APlusB, N); + SumProb := SumProb + p; + FisherTable(A, b, C, d, p, SumProb); + end; + end; + + //Tocher's modification + response := + InputBox( 'ALPHA','Enter your Alpha (Type I Error rate) : ', '0.05'); + Alpha := StrToFloat(response); + if ((SumProb - FirstP) > Alpha) then //Extreme values > alpha - accept null hypothesis + OutPutFrm.RichEdit.Lines.Add('Null hypothesis accepted.') + else begin//Extreme values significant - is total probability significant? + if (SumProb >= Alpha) then//No, so apply Tocher's rule + begin + Tocher := ( Alpha - (SumProb - FirstP)) / FirstP; + X := random(1000) / 1000.0; //Select a random value between 0 and num - 1 + outline := format('Tocher ratio computed: %5.3f',[Tocher]); + OutPutFrm.RichEdit.Lines.Add(outline); + if (X < Tocher) then //Call it significant + begin + outline := format('A random value of %5.3f selected was less than the Tocher value.',[X]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add('Conclusion: Reject the null Hypothesis'); + end + else begin //Call it non-significant + outline := format('A random value of %5.3f selected was greater than the Tocher value.',[X]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add('Conclusion: Accept the null Hypothesis'); + end; + end + else begin //Total probability < alpha - reject null + OutPutFrm.RichEdit.Lines.Add('Probability less than alpha - reject null hypothesis.'); + end; // end if-else + end; // end if-else + OutPutFrm.ShowModal; +end; + +procedure TFisherFrm.DepInClick(Sender: TObject); +VAR index : integer; +begin + index := VarList.ItemIndex; + DepEdit.Text := VarList.Items.Strings[index]; + VarList.Items.Delete(index); + DepIn.Visible := false; + DepOut.Visible := true; +end; + +procedure TFisherFrm.DepOutClick(Sender: TObject); +begin + VarList.Items.Add(DepEdit.Text); + DepEdit.Text := ''; + DepIn.Visible := true; + DepOut.Visible := false; +end; + +procedure TFisherFrm.InputGrpClick(Sender: TObject); +begin + if InputGrp.ItemIndex = 3 then + begin + Panel2.Visible := true; + Panel1.Visible := false; + RC11Edit.SetFocus; + Label4.Visible := false; + ColIn.Visible := false; + DepIn.Visible := false; + DepOut.Visible := false; + end + else + begin + Panel1.Visible := true; + Panel2.Visible := false; + ColIn.Visible := true; + ColOut.Visible := false; + if InputGrp.ItemIndex = 2 then + begin + NCasesLabel.Visible := true; + NCasesEdit.Visible := true; + end + else begin + NCasesLabel.Visible := false; + NCasesEdit.Visible := false; + end; + if InputGrp.ItemIndex = 0 then + begin + Label4.Visible := false; + DepEdit.Visible := false; + DepIn.Visible := false; + DepOut.Visible := false; + end + else begin // InputGrp = 1 + Label4.Visible := true; + DepEdit.Visible := true; + DepIn.Visible := true; + DepOut.Visible := true; + end; + end; +end; + +procedure TFisherFrm.RC11EditKeyPress(Sender: TObject; var Key: char); +begin + if Ord(Key) = 13 then RC12Edit.SetFocus; +end; + +procedure TFisherFrm.RC12EditKeyPress(Sender: TObject; var Key: char); +begin + if Ord(Key) = 13 then RC21Edit.SetFocus; +end; + +procedure TFisherFrm.RC21EditKeyPress(Sender: TObject; var Key: char); +begin + if Ord(Key) = 13 then RC22Edit.SetFocus; +end; + +procedure TFisherFrm.RC22EditKeyPress(Sender: TObject; var Key: char); +begin + if Ord(Key) = 13 then ComputeBtn.SetFocus; +end; + +procedure TFisherFrm.FisherTable(A, b, C, d : integer; p, SumP : double); +var + outline : string; +begin + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.RichEdit.Lines.Add('Contingency Table for Fisher Exact Test'); + OutPutFrm.RichEdit.Lines.Add(' Column'); + OutPutFrm.RichEdit.Lines.Add('Row 1 2'); + outline := format(' 1 %10d %10d',[A, b]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format(' 2 %10d %10d',[C, d]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Probability := %6.4f',[p]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + outline := format('Cumulative Probability := %6.4f',[SumP]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); +end; +initialization + {$I exactunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/EXACTUNIT.lfm b/applications/lazstats/source_orig/EXACTUNIT.lfm new file mode 100644 index 000000000..aee597e38 --- /dev/null +++ b/applications/lazstats/source_orig/EXACTUNIT.lfm @@ -0,0 +1,508 @@ +object FisherFrm: TFisherFrm + Left = 171 + Height = 407 + Top = 104 + Width = 553 + Caption = 'Fisher''s Exact Test for a 2 by 2 Table' + ClientHeight = 407 + ClientWidth = 553 + OnShow = FormShow + LCLVersion = '0.9.26.2' + object InputGrp: TRadioGroup + Left = 6 + Height = 95 + Top = 1 + Width = 366 + AutoFill = True + Caption = 'Input Options' + 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 = 77 + ClientWidth = 362 + Items.Strings = ( + 'Count cases classified by row and column vectors in the data grid.' + 'Use frequencies recorded in the data grid for row and column variables.' + 'Use proportions recorded in the data grid for row and column variables.' + 'Enter frequencies on this form.' + ) + OnClick = InputGrpClick + TabOrder = 0 + end + object Panel1: TPanel + Left = 6 + Height = 293 + Top = 103 + Width = 368 + ClientHeight = 293 + ClientWidth = 368 + TabOrder = 1 + object Label1: TLabel + Left = 8 + Height = 14 + Top = 7 + Width = 90 + Caption = 'Variables Available' + ParentColor = False + end + object Label2: TLabel + Left = 208 + Height = 14 + Top = 23 + Width = 63 + Caption = 'Row Variable' + ParentColor = False + end + object Label3: TLabel + Left = 207 + Height = 14 + Top = 103 + Width = 77 + Caption = 'Column Variable' + ParentColor = False + end + object Label4: TLabel + Left = 207 + Height = 14 + Top = 183 + Width = 93 + Caption = 'Variable to Analyze' + ParentColor = False + end + object NCasesLabel: TLabel + Left = 8 + Height = 14 + Top = 265 + Width = 94 + Caption = 'Total No. of Cases:' + ParentColor = False + end + object VarList: TListBox + Left = 6 + Height = 226 + Top = 24 + Width = 153 + TabOrder = 0 + end + object RowIn: TBitBtn + Left = 170 + Height = 26 + Top = 25 + Width = 29 + 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 = RowInClick + TabOrder = 1 + end + object RowEdit: TEdit + Left = 208 + Height = 16 + Top = 40 + Width = 136 + TabOrder = 2 + Text = 'RowEdit' + end + object ColEdit: TEdit + Left = 207 + Height = 17 + Top = 120 + Width = 138 + TabOrder = 3 + Text = 'ColEdit' + end + object DepEdit: TEdit + Left = 207 + Height = 17 + Top = 199 + Width = 138 + TabOrder = 4 + Text = 'DepEdit' + end + object NCasesEdit: TEdit + Left = 111 + Height = 18 + Top = 261 + Width = 49 + TabOrder = 5 + Text = 'NCasesEdit' + end + end + object RowOut: TBitBtn + Left = 176 + Height = 26 + Top = 160 + Width = 29 + 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 = RowOutClick + TabOrder = 2 + end + object ColIn: TBitBtn + Left = 176 + Height = 26 + Top = 208 + Width = 29 + 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 = ColInClick + TabOrder = 3 + end + object ColOut: TBitBtn + Left = 176 + Height = 26 + Top = 240 + Width = 29 + 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 = ColOutClick + TabOrder = 4 + end + object DepIn: TBitBtn + Left = 176 + Height = 26 + Top = 288 + Width = 29 + 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 = 5 + end + object DepOut: TBitBtn + Left = 176 + Height = 26 + Top = 320 + Width = 29 + 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 = 6 + end + object Panel2: TPanel + Left = 384 + Height = 88 + Top = 8 + Width = 158 + ClientHeight = 88 + ClientWidth = 158 + TabOrder = 7 + object Label6: TLabel + Left = 7 + Height = 14 + Top = 27 + Width = 31 + Caption = 'Row 1' + ParentColor = False + end + object Label7: TLabel + Left = 7 + Height = 14 + Top = 59 + Width = 31 + Caption = 'Row 2' + ParentColor = False + end + object Label8: TLabel + Left = 40 + Height = 14 + Top = 9 + Width = 29 + Caption = 'Col. 1' + ParentColor = False + end + object Label9: TLabel + Left = 88 + Height = 14 + Top = 9 + Width = 29 + Caption = 'Col. 2' + ParentColor = False + end + object RC11Edit: TEdit + Left = 40 + Height = 21 + Top = 24 + Width = 38 + OnKeyPress = RC11EditKeyPress + TabOrder = 0 + Text = 'RC11Edit' + end + object RC12Edit: TEdit + Left = 87 + Height = 20 + Top = 24 + Width = 43 + OnKeyPress = RC12EditKeyPress + TabOrder = 1 + Text = 'RC12Edit' + end + object RC21Edit: TEdit + Left = 40 + Height = 18 + Top = 55 + Width = 36 + OnKeyPress = RC21EditKeyPress + TabOrder = 2 + Text = 'RC21Edit' + end + object RC22Edit: TEdit + Left = 88 + Height = 16 + Top = 54 + Width = 42 + OnKeyPress = RC22EditKeyPress + TabOrder = 3 + Text = 'RC22Edit' + end + end + object ResetBtn: TButton + Left = 424 + Height = 29 + Top = 112 + Width = 83 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 8 + end + object CancelBtn: TButton + Left = 424 + Height = 29 + Top = 176 + Width = 83 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 9 + end + object ComputeBtn: TButton + Left = 424 + Height = 29 + Top = 240 + Width = 83 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 10 + end + object ReturnBtn: TButton + Left = 424 + Height = 29 + Top = 296 + Width = 83 + Caption = 'Return' + ModalResult = 1 + TabOrder = 11 + end +end diff --git a/applications/lazstats/source_orig/EXACTUNIT.lrs b/applications/lazstats/source_orig/EXACTUNIT.lrs new file mode 100644 index 000000000..ebe82da05 --- /dev/null +++ b/applications/lazstats/source_orig/EXACTUNIT.lrs @@ -0,0 +1,372 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TFisherFrm','FORMDATA',[ + 'TPF0'#10'TFisherFrm'#9'FisherFrm'#4'Left'#3#171#0#6'Height'#3#151#1#3'Top'#2 + +'h'#5'Width'#3')'#2#7'Caption'#6'&Fisher''s Exact Test for a 2 by 2 Table'#12 + +'ClientHeight'#3#151#1#11'ClientWidth'#3')'#2#6'OnShow'#7#8'FormShow'#10'LCL' + +'Version'#6#8'0.9.26.2'#0#11'TRadioGroup'#8'InputGrp'#4'Left'#2#6#6'Height'#2 + +'_'#3'Top'#2#1#5'Width'#3'n'#1#8'AutoFill'#9#7'Caption'#6#13'Input Options' + +#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29 + +'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizin' + +'g.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHori' + +'zontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleCh' + +'ilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSi' + +'zing.ControlsPerLine'#2#1#12'ClientHeight'#2'M'#11'ClientWidth'#3'j'#1#13'I' + +'tems.Strings'#1#6'BCount cases classified by row and column vectors in the ' + +'data grid.'#6'GUse frequencies recorded in the data grid for row and column' + +' variables.'#6'GUse proportions recorded in the data grid for row and colum' + +'n variables.'#6#31'Enter frequencies on this form.'#0#7'OnClick'#7#13'Input' + +'GrpClick'#8'TabOrder'#2#0#0#0#6'TPanel'#6'Panel1'#4'Left'#2#6#6'Height'#3'%' + +#1#3'Top'#2'g'#5'Width'#3'p'#1#12'ClientHeight'#3'%'#1#11'ClientWidth'#3'p'#1 + +#8'TabOrder'#2#1#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#14#3'Top'#2#7 + +#5'Width'#2'Z'#7'Caption'#6#19'Variables Available'#11'ParentColor'#8#0#0#6 + +'TLabel'#6'Label2'#4'Left'#3#208#0#6'Height'#2#14#3'Top'#2#23#5'Width'#2'?'#7 + +'Caption'#6#12'Row Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Lef' + +'t'#3#207#0#6'Height'#2#14#3'Top'#2'g'#5'Width'#2'M'#7'Caption'#6#15'Column ' + +'Variable'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#207#0#6'Heigh' + +'t'#2#14#3'Top'#3#183#0#5'Width'#2']'#7'Caption'#6#19'Variable to Analyze'#11 + +'ParentColor'#8#0#0#6'TLabel'#11'NCasesLabel'#4'Left'#2#8#6'Height'#2#14#3'T' + +'op'#3#9#1#5'Width'#2'^'#7'Caption'#6#19'Total No. of Cases:'#11'ParentColor' + +#8#0#0#8'TListBox'#7'VarList'#4'Left'#2#6#6'Height'#3#226#0#3'Top'#2#24#5'Wi' + +'dth'#3#153#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#5'RowIn'#4'Left'#3#170#0#6'Heig' + +'ht'#2#26#3'Top'#2#25#5'Width'#2#29#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'RowInClick'#8'TabOrder'#2#1#0#0#5'TEdit'#7 + +'RowEdit'#4'Left'#3#208#0#6'Height'#2#16#3'Top'#2'('#5'Width'#3#136#0#8'TabO' + +'rder'#2#2#4'Text'#6#7'RowEdit'#0#0#5'TEdit'#7'ColEdit'#4'Left'#3#207#0#6'He' + +'ight'#2#17#3'Top'#2'x'#5'Width'#3#138#0#8'TabOrder'#2#3#4'Text'#6#7'ColEdit' + +#0#0#5'TEdit'#7'DepEdit'#4'Left'#3#207#0#6'Height'#2#17#3'Top'#3#199#0#5'Wid' + +'th'#3#138#0#8'TabOrder'#2#4#4'Text'#6#7'DepEdit'#0#0#5'TEdit'#10'NCasesEdit' + +#4'Left'#2'o'#6'Height'#2#18#3'Top'#3#5#1#5'Width'#2'1'#8'TabOrder'#2#5#4'Te' + +'xt'#6#10'NCasesEdit'#0#0#0#7'TBitBtn'#6'RowOut'#4'Left'#3#176#0#6'Height'#2 + +#26#3'Top'#3#160#0#5'Width'#2#29#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''#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'RowOutClick'#8'TabOrder'#2#2#0#0 + +#7'TBitBtn'#5'ColIn'#4'Left'#3#176#0#6'Height'#2#26#3'Top'#3#208#0#5'Width'#2 + +#29#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 + +'ColInClick'#8'TabOrder'#2#3#0#0#7'TBitBtn'#6'ColOut'#4'Left'#3#176#0#6'Heig' + +'ht'#2#26#3'Top'#3#240#0#5'Width'#2#29#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'B' + +'M6'#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''#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'ColOutClick'#8'TabOrder'#2#4#0#0 + +#7'TBitBtn'#5'DepIn'#4'Left'#3#176#0#6'Height'#2#26#3'Top'#3' '#1#5'Width'#2 + +#29#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#5#0#0#7'TBitBtn'#6'DepOut'#4'Left'#3#176#0#6'Heig' + +'ht'#2#26#3'Top'#3'@'#1#5'Width'#2#29#10'Glyph.Data'#10':'#4#0#0'6'#4#0#0'BM' + +'6'#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''#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'DepOutClick'#8'TabOrder'#2#6#0#0 + +#6'TPanel'#6'Panel2'#4'Left'#3#128#1#6'Height'#2'X'#3'Top'#2#8#5'Width'#3#158 + +#0#12'ClientHeight'#2'X'#11'ClientWidth'#3#158#0#8'TabOrder'#2#7#0#6'TLabel' + +#6'Label6'#4'Left'#2#7#6'Height'#2#14#3'Top'#2#27#5'Width'#2#31#7'Caption'#6 + +#5'Row 1'#11'ParentColor'#8#0#0#6'TLabel'#6'Label7'#4'Left'#2#7#6'Height'#2 + +#14#3'Top'#2';'#5'Width'#2#31#7'Caption'#6#5'Row 2'#11'ParentColor'#8#0#0#6 + +'TLabel'#6'Label8'#4'Left'#2'('#6'Height'#2#14#3'Top'#2#9#5'Width'#2#29#7'Ca' + +'ption'#6#6'Col. 1'#11'ParentColor'#8#0#0#6'TLabel'#6'Label9'#4'Left'#2'X'#6 + +'Height'#2#14#3'Top'#2#9#5'Width'#2#29#7'Caption'#6#6'Col. 2'#11'ParentColor' + +#8#0#0#5'TEdit'#8'RC11Edit'#4'Left'#2'('#6'Height'#2#21#3'Top'#2#24#5'Width' + +#2'&'#10'OnKeyPress'#7#16'RC11EditKeyPress'#8'TabOrder'#2#0#4'Text'#6#8'RC11' + +'Edit'#0#0#5'TEdit'#8'RC12Edit'#4'Left'#2'W'#6'Height'#2#20#3'Top'#2#24#5'Wi' + +'dth'#2'+'#10'OnKeyPress'#7#16'RC12EditKeyPress'#8'TabOrder'#2#1#4'Text'#6#8 + +'RC12Edit'#0#0#5'TEdit'#8'RC21Edit'#4'Left'#2'('#6'Height'#2#18#3'Top'#2'7'#5 + +'Width'#2'$'#10'OnKeyPress'#7#16'RC21EditKeyPress'#8'TabOrder'#2#2#4'Text'#6 + +#8'RC21Edit'#0#0#5'TEdit'#8'RC22Edit'#4'Left'#2'X'#6'Height'#2#16#3'Top'#2'6' + +#5'Width'#2'*'#10'OnKeyPress'#7#16'RC22EditKeyPress'#8'TabOrder'#2#3#4'Text' + +#6#8'RC22Edit'#0#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#168#1#6'Height'#2#29#3 + +'Top'#2'p'#5'Width'#2'S'#7'Caption'#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick' + +#8'TabOrder'#2#8#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#168#1#6'Height'#2#29#3 + +'Top'#3#176#0#5'Width'#2'S'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'Tab' + +'Order'#2#9#0#0#7'TButton'#10'ComputeBtn'#4'Left'#3#168#1#6'Height'#2#29#3'T' + +'op'#3#240#0#5'Width'#2'S'#7'Caption'#6#7'Compute'#7'OnClick'#7#15'ComputeBt' + +'nClick'#8'TabOrder'#2#10#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#168#1#6'Heig' + +'ht'#2#29#3'Top'#3'('#1#5'Width'#2'S'#7'Caption'#6#6'Return'#11'ModalResult' + +#2#1#8'TabOrder'#2#11#0#0#0 +]); diff --git a/applications/lazstats/source_orig/EXPSMOOTHUNIT.PAS b/applications/lazstats/source_orig/EXPSMOOTHUNIT.PAS new file mode 100644 index 000000000..7e7839cf5 --- /dev/null +++ b/applications/lazstats/source_orig/EXPSMOOTHUNIT.PAS @@ -0,0 +1,56 @@ +unit ExpSmoothUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls; + +type + + { TExpSmoothFrm } + + TExpSmoothFrm = class(TForm) + AlphaEdit: TEdit; + CancelBtn: TButton; + OKBtn: TButton; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + AlphaScroll: TScrollBar; + procedure AlphaScrollChange(Sender: TObject); + procedure FormShow(Sender: TObject); + private + { private declarations } + public + { public declarations } + alpha : double; + end; + +var + ExpSmoothFrm: TExpSmoothFrm; + +implementation + +{ TExpSmoothFrm } + +procedure TExpSmoothFrm.FormShow(Sender: TObject); +begin + AlphaEdit.Text := '0.99'; + AlphaScroll.Position := 99; + alpha := 0.99; +end; + +procedure TExpSmoothFrm.AlphaScrollChange(Sender: TObject); +begin + AlphaEdit.Text := FloatToStr(AlphaScroll.Position / 100.0); + alpha := AlphaScroll.Position / 100.0; +end; + +initialization + {$I expsmoothunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/EXPSMOOTHUNIT.lfm b/applications/lazstats/source_orig/EXPSMOOTHUNIT.lfm new file mode 100644 index 000000000..3cf7e979e --- /dev/null +++ b/applications/lazstats/source_orig/EXPSMOOTHUNIT.lfm @@ -0,0 +1,72 @@ +object ExpSmoothFrm: TExpSmoothFrm + Left = 208 + Height = 166 + Top = 135 + Width = 273 + Caption = 'Exponential Smoothing Form' + ClientHeight = 166 + ClientWidth = 273 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 8 + Height = 14 + Top = 24 + Width = 42 + Caption = 'Alpha = ' + ParentColor = False + end + object Label2: TLabel + Left = 8 + Height = 14 + Top = 80 + Width = 17 + Caption = '0.0' + ParentColor = False + end + object Label3: TLabel + Left = 240 + Height = 14 + Top = 80 + Width = 17 + Caption = '1.0' + ParentColor = False + end + object AlphaEdit: TEdit + Left = 64 + Height = 21 + Top = 17 + Width = 44 + TabOrder = 0 + Text = '0.99' + end + object AlphaScroll: TScrollBar + Left = 8 + Height = 23 + Top = 48 + Width = 253 + Max = 1 + PageSize = 0 + Position = 1 + TabOrder = 1 + OnChange = AlphaScrollChange + end + object CancelBtn: TButton + Left = 8 + Height = 28 + Top = 112 + Width = 75 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 2 + end + object OKBtn: TButton + Left = 184 + Height = 28 + Top = 112 + Width = 75 + Caption = 'OK' + ModalResult = 1 + TabOrder = 3 + end +end diff --git a/applications/lazstats/source_orig/EXPSMOOTHUNIT.lrs b/applications/lazstats/source_orig/EXPSMOOTHUNIT.lrs new file mode 100644 index 000000000..1a2530fcd --- /dev/null +++ b/applications/lazstats/source_orig/EXPSMOOTHUNIT.lrs @@ -0,0 +1,20 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TExpSmoothFrm','FORMDATA',[ + 'TPF0'#13'TExpSmoothFrm'#12'ExpSmoothFrm'#4'Left'#3#208#0#6'Height'#3#166#0#3 + +'Top'#3#135#0#5'Width'#3#17#1#7'Caption'#6#26'Exponential Smoothing Form'#12 + +'ClientHeight'#3#166#0#11'ClientWidth'#3#17#1#6'OnShow'#7#8'FormShow'#10'LCL' + +'Version'#6#8'0.9.28.2'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#14#3'T' + +'op'#2#24#5'Width'#2'*'#7'Caption'#6#8'Alpha = '#11'ParentColor'#8#0#0#6'TLa' + +'bel'#6'Label2'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'P'#5'Width'#2#17#7'Capti' + +'on'#6#3'0.0'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#3#240#0#6'He' + +'ight'#2#14#3'Top'#2'P'#5'Width'#2#17#7'Caption'#6#3'1.0'#11'ParentColor'#8#0 + +#0#5'TEdit'#9'AlphaEdit'#4'Left'#2'@'#6'Height'#2#21#3'Top'#2#17#5'Width'#2 + +','#8'TabOrder'#2#0#4'Text'#6#4'0.99'#0#0#10'TScrollBar'#11'AlphaScroll'#4'L' + +'eft'#2#8#6'Height'#2#23#3'Top'#2'0'#5'Width'#3#253#0#3'Max'#2#1#8'PageSize' + +#2#0#8'Position'#2#1#8'TabOrder'#2#1#8'OnChange'#7#17'AlphaScrollChange'#0#0 + +#7'TButton'#9'CancelBtn'#4'Left'#2#8#6'Height'#2#28#3'Top'#2'p'#5'Width'#2'K' + +#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#2#0#0#7'TButton'#5 + +'OKBtn'#4'Left'#3#184#0#6'Height'#2#28#3'Top'#2'p'#5'Width'#2'K'#7'Caption'#6 + +#2'OK'#11'ModalResult'#2#1#8'TabOrder'#2#3#0#0#0 +]); diff --git a/applications/lazstats/source_orig/FACTORUNIT.PAS b/applications/lazstats/source_orig/FACTORUNIT.PAS new file mode 100644 index 000000000..7b5a34865 --- /dev/null +++ b/applications/lazstats/source_orig/FACTORUNIT.PAS @@ -0,0 +1,1536 @@ +unit FactorUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, Buttons, ExtCtrls, MainUnit, OutPutUnit, FunctionsLib, + GraphLib, Globals, MatrixLib, DataProcs, Math, DictionaryUnit; + +type + + { TFactorFrm } + + TFactorFrm = class(TForm) + OpenDialog1: TOpenDialog; + ResetBtn: TButton; + CancelBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + MinRootEdit: TEdit; + MaxItersEdit: TEdit; + MaxFactorsEdit: TEdit; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + SaveCorsBtn: TCheckBox; + SaveDialog1: TSaveDialog; + SaveFactBtn: TCheckBox; + SortBtn: TCheckBox; + ScreeBtn: TCheckBox; + ComUnBtn: TCheckBox; + PlotBtn: TCheckBox; + ScoresBtn: TCheckBox; + DescBtn: TCheckBox; + RMatBtn: TCheckBox; + UnrotBtn: TCheckBox; + PcntTrBtn: TCheckBox; + GroupBox1: TGroupBox; + InBtn: TBitBtn; + OutBtn: TBitBtn; + Label1: TLabel; + Label2: TLabel; + FactorList: TListBox; + RotateGroup: TRadioGroup; + TypeGroup: TRadioGroup; + VarList: TListBox; + procedure ComputeBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure InBtnClick(Sender: TObject); + procedure OutBtnClick(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + private + { private declarations } + procedure FACTORS(VAR eigenvalues : DblDyneVec; + VAR d2 : DblDyneVec; + VAR A : DblDyneMat; + N : integer; + factorchoice : integer); + + procedure factREORDER(VAR d : DblDyneVec; + VAR A : DblDyneMat; + VAR var_label : StrDyneVec; + N : integer); + + procedure SORT_LOADINGS(VAR v : DblDyneMat; + n1, n2 : integer; + VAR High_Factor : IntDyneVec; + VAR A : DblDyneVec; + VAR b : DblDyneVec; + VAR var_label : StrDyneVec; + order : IntDyneVec); + + procedure VARIMAX(VAR v : DblDyneMat; + n1, n2 : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec; + VAR order : IntDyneVec); + + procedure PROCRUST(VAR b : DblDyneMat; + nv, nb : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec); + + procedure LSFactScores(VAR F : DblDyneMat; + NoVars, NoFacts, NCases : integer; + VAR ColNoSelected : IntDyneVec; + VAR RowLabels : StrDyneVec); + + procedure QUARTIMAX(VAR v : DblDyneMat; + n1, n2 : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec; + VAR order : IntDyneVec); + + procedure ManualRotate(VAR v : DblDyneMat; + n1, n2 : integer; + VAR RowLabels : StrDyneVec; + VAR ColLabels : StrDyneVec; + VAR order : IntDyneVec; + Sender : TObject); + + public + { public declarations } + end; + +var + FactorFrm: TFactorFrm; + +implementation +uses RotateUnit; + +{ TFactorFrm } + +procedure TFactorFrm.ResetBtnClick(Sender: TObject); +VAR i : integer; +begin + VarList.Clear; + FactorList.Clear; + OutBtn.Visible := false; + InBtn.Visible := true; + TypeGroup.ItemIndex := 0; + RotateGroup.ItemIndex := 0; + DescBtn.Checked := false; + RMatBtn.Checked := false; + UnrotBtn.Checked := false; + PcntTrBtn.Checked := false; + ScreeBtn.Checked := false; + ComUnBtn.Checked := false; + PlotBtn.Checked := false; + ScoresBtn.Checked := false; + SaveCorsBtn.Checked := false; + SaveFactBtn.Checked := false; + SortBtn.Checked := false; + MinRootEdit.Text := '1'; + MaxItersEdit.Text := '25'; + MaxFactorsEdit.Text := ''; + for i := 1 to NoVariables do + VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); +end; + +procedure TFactorFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; + +procedure TFactorFrm.ComputeBtnClick(Sender: TObject); +label again; +var + i, j, k, L, cols, rows, Nroots, noiterations, NoSelected, factorchoice : integer; + maxiters, IER, N, prtopts, maxnoroots, count : integer; + TempMat, V, corrmat, ainverse, A, Loadings : DblDyneMat; + Eigenvector, pcnttrace, b, communality, xvector, yvector, d2 : DblDyneVec; + means, variances, stddevs, W : DblDyneVec; + MaxRoot, criterion, Difference, minroot, maxk, trace : double; + cellstring, outline, xtitle, ytitle : string; + ColNoSelected : IntDyneVec; + RowLabels, ColLabels : StrDyneVec; + MatInput : boolean; + Title : string; + filename : string; + Save_Cursor : TCursor; + errorcode : boolean; +begin + MaxRoot := 0.0; + noiterations := 0; + maxnoroots := 0; + prtopts := 0; + + criterion := 0.0001; //Convergence of communality estimates + factorchoice := 1; // assume principal component + if (TypeGroup.ItemIndex = 1) then factorchoice := 2; + if (TypeGroup.ItemIndex = 2) then factorchoice := 3; + if (TypeGroup.ItemIndex = 3) then factorchoice := 4; + if (TypeGroup.ItemIndex = 4) then factorchoice := 5; + if (TypeGroup.ItemIndex = 5) then factorchoice := 6; + if (TypeGroup.ItemIndex = 6) then factorchoice := 7; + if (RMatBtn.Checked) then prtopts := 3; + if (RMatBtn.Checked) then prtopts := 2; + if ((RMatBtn.Checked) and (DescBtn.Checked)) then prtopts := 1; + maxiters := StrToInt(MaxItersEdit.Text); + if (MaxFactorsEdit.Text <> '') then + maxnoroots := StrToInt(MaxFactorsEdit.Text); + + // Setup the output + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add('Factor Analysis'); + OutPutFrm.RichEdit.Lines.Add('See Rummel, R.J., Applied Factor Analysis'); + OutPutFrm.RichEdit.Lines.Add('Northwestern University Press, 1970'); + OutPutFrm.RichEdit.Lines.Add(''); + + if FactorList.Items.Count = 0 then MatInput := true + else begin + NoSelected := FactorList.Items.Count; + MatInput := false; + end; + + // Allocate space on heap + SetLength(corrmat,NoVariables+1,NoVariables+1); + SetLength(TempMat,NoVariables,NoVariables); + SetLength(ainverse,NoVariables,NoVariables); + SetLength(V,NoVariables,NoVariables); + SetLength(W,NoVariables); + SetLength(Loadings,NoVariables,NoVariables); + SetLength(Eigenvector,NoVariables); + SetLength(communality,NoVariables); + SetLength(pcnttrace,NoVariables); + SetLength(b,NoVariables); + SetLength(d2,NoVariables); + SetLength(xvector,NoVariables); + SetLength(yvector,NoVariables); + SetLength(means,NoVariables); + SetLength(variances,NoVariables); + SetLength(stddevs,NoVariables); + SetLength(RowLabels,NoVariables); + SetLength(ColLabels,NoVariables); + SetLength(ColNoSelected,NoVariables); + + if MatInput then // matrix input + begin + OpenDialog1.Filter := 'Matrix files (*.MAT)|*.MAT|All files (*.*)|*.*'; + OpenDialog1.FilterIndex := 1; + OpenDialog1.Title := 'INPUT MATRIX:'; + OpenDialog1.Execute; + filename := OpenDialog1.FileName; + MATREAD(corrmat,NoSelected,NoSelected,means,stddevs,count,RowLabels, + ColLabels,filename); + for i := 1 to NoSelected do + begin + variances[i-1] := sqr(stddevs[i-1]); + FactorList.Items.Add(RowLabels[i-1]); + ColNoSelected[i-1] := i; + end; + NoCases := count; + end + + else + begin + for i := 1 to NoSelected do + begin + cellstring := FactorList.Items.Strings[i-1]; + for j := 1 to NoVariables do + begin + if (cellstring = OS3MainFrm.DataGrid.Cells[j,0]) then + begin + ColNoSelected[i-1] := j; + ColLabels[i-1] := cellstring; + RowLabels[i-1] := cellstring; + end; + end; + end; + end; + + count := NoCases; + //Obtain correlation matrix and, if required simultaneous Multiple Correlations + if (MatInput = false) then +// Correlate(NoSelected,NoCases,ColNoSelected,means,variances, +// stddevs,corrmat,3,IER,count); + Correlations(NoSelected,ColNoSelected,corrmat,means,variances, + stddevs,errorcode,count); + if RmatBtn.Checked then // print correlation matrix + begin + Title := 'Total Correlation Matrix'; + MAT_PRINT(corrmat,NoSelected,NoSelected,Title,RowLabels, + ColLabels,count); + end; + if DescBtn.Checked then // print descriptives + begin + // print mean, variance and std. dev.s for variables + outline := 'MEANS'; + DynVectorPrint(Means,NoSelected,outline,RowLabels,count); + outline := 'VARIANCES'; + DynVectorPrint(Variances,NoSelected,outline,RowLabels,count); + outline := 'STANDARD DEVIATIONS'; + DynVectorPrint(StdDevs,NoSelected,outline,RowLabels,count); + end; + k := NoSelected; + + // Save correlation matrix if checked + if (SaveCorsBtn.Checked) then + begin + SaveDialog1.Filter := 'Matrix files (*.MAT)|(*.MAT)|All files (*.*)|(*.*)'; + SaveDialog1.FilterIndex := 1; + SaveDialog1.Title := 'SAVE MATRIX:'; + SaveDialog1.Execute; + filename := SaveDialog1.FileName; + MATSAVE(corrmat,NoSelected,NoSelected,means,stddevs,count,RowLabels, + ColLabels,filename); + end; + maxk := k; + Nroots := k; + + if ( factorchoice <> 1) then //not a principal component analysis + begin + //get matrix inverse, squared Multiple Correlations + //Uniqueness (1-squared multiple Correlations, and + //variance of residuals (D squared) + for i := 1 to NoSelected do + for j := 1 to NoSelected do + ainverse[i-1,j-1] := corrmat[i-1,j-1]; + SVDinverse(ainverse,k); + for i := 1 to k do + begin + d2[i-1] := 1.0 / ainverse[i-1,i-1]; + communality[i-1] := 1.0 - d2[i-1]; + end; + + case factorchoice of + 2: begin + outline := 'Partial Image Analysis'; + OutPutFrm.RichEdit.Lines.Add(outline); + // Save corrmat in TempMat for temporary use + for i := 1 to k do + for j := 1 to k do TempMat[i-1,j-1] := corrmat[i-1,j-1]; + for i := 1 to k do corrmat[i-1,i-1] := communality[i-1]; + if RmatBtn.Checked then + begin + OutPutFrm.RichEdit.Lines.Add('Communality Estimates are Squared Multiple Correlations.'); + Title := 'Partial Image Matrix'; + MAT_PRINT(corrmat,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + end; + 3: begin + outline := 'Guttman Image Analysis'; + OutPutFrm.RichEdit.Lines.Add(outline); + //pre and post multiply inverse of R by D2 to obtain anti-image matrix + for i := 1 to k do + for j := 1 to k do + ainverse[i-1,j-1] := d2[i-1] * ainverse[i-1,j-1] * d2[j-1]; + if RmatBtn.Checked then + begin + Title := 'Anti-image covariance matrix'; + MAT_PRINT(ainverse,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + for i := 1 to k do + for j := 1 to k do + corrmat[i-1,j-1] := corrmat[i-1,j-1] + ainverse[i-1,j-1]; + for i := 1 to k do + corrmat[i-1,i-1] := corrmat[i-1,i-1] - (2.0 * d2[i-1]); + if RmatBtn.Checked then + begin + Title := 'Image Covariance Matrix Analyzed'; + MAT_PRINT(corrmat,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + end; + 4: begin + //pre and post multiply inverse of R by D2 to obtain anti-image matrix + for i := 1 to k do + for j := 1 to k do + ainverse[i-1,j-1] := d2[i-1] * ainverse[i-1,j-1] * d2[j-1]; + for i := 1 to k do + for j := 1 to k do + corrmat[i-1,j-1] := corrmat[i-1,j-1] + ainverse[i-1,j-1]; + for i := 1 to k do + corrmat[i-1,i-1] := corrmat[i-1,i-1] - (2.0 * d2[i-1]); + outline := 'Harris Scaled Image Analysis'; + for i := 1 to k do + for j := 1 to k do + corrmat[i-1,j-1] := (1.0 / sqrt(d2[i-1]) * + corrmat[i-1,j-1] * (1.0 / sqrt(d2[j-1]))); + if RmatBtn.Checked then + begin + Title := 'Harris Scaled Image Covariance Matrix'; + MAT_PRINT(corrmat,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + end; + 5: begin + outline := 'Canonical Factor Analysis'; + OutPutFrm.RichEdit.Lines.Add(outline); + for i := 1 to k do corrmat[i-1,i-1] := communality[i-1]; + for i := 1 to k do + for j := 1 to k do + corrmat[i-1,j-1] := (1.0 / sqrt(d2[i-1])) * + corrmat[i-1,j-1] * (1.0 / sqrt(d2[j-1])); + if RmatBtn.Checked then + begin + Title := 'Canonical Covariance Matrix'; + MAT_PRINT(corrmat,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + end; + 6: begin + outline := 'Alpha Factor Analysis'; + OutPutFrm.RichEdit.Lines.Add(outline); + // Save corrmat in TempMat for temporary use + for i := 1 to k do + for j := 1 to k do TempMat[i-1,j-1] := corrmat[i-1,j-1]; + for i := 1 to k do corrmat[i-1,i-1] := communality[i-1]; + for i := 1 to k do + for j := 1 to k do + corrmat[i-1,j-1] := (1.0 / sqrt(communality[i-1])) * + corrmat[i-1,j-1] * (1.0 / sqrt(communality[j-1])); + if RmatBtn.Checked then + begin + Title := 'Initial Alpha Factor Matrix'; + MAT_PRINT(corrmat,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + end; + 7: begin // Principal Axis Factor Analysis + // Save corrmat in TempMat for temporary use + for i := 1 to k do + for j := 1 to k do TempMat[i-1,j-1] := corrmat[i-1,j-1]; + for i := 1 to k do corrmat[i-1,i-1] := communality[i-1]; + if RmatBtn.Checked then + begin + OutPutFrm.RichEdit.Lines.Add('Initial Communality Estimates are Squared Multiple Correlations.'); + Title := 'Principals Axis Factor Analysis Matrix'; + MAT_PRINT(corrmat,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + end; + end; // end case + end // end if factor choice not equal to 1 (Principals Components) + + else + begin + outline := 'Principal Components Analysis'; + OutPutFrm.RichEdit.Lines.Add(outline); + if RmatBtn.Checked then + begin + Title := 'Correlation Matrix Factor Analyzed'; + MAT_PRINT(corrmat,k,k,Title,RowLabels,ColLabels,count); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + end; + + //Calculate trace of the matrix to be analyzed + trace := 0.0; + for i := 1 to k do trace := trace + corrmat[i-1,i-1]; + outline := format('Original matrix trace = %6.2f',[trace]); + OutPutFrm.RichEdit.Lines.Add(outline); + +again: + for i := 1 to k do + for j := 1 to k do ainverse[i-1,j-1] := corrmat[i-1,j-1]; + eigens(ainverse,Eigenvector,k); + if ((factorchoice = 6)or (factorchoice = 7))then //iteratively solve for communalities + begin + //denormalize eigenvectors + for i := 1 to k do + begin + for j := 1 to k do + begin + if ( Eigenvector[j-1] > 0.0) then + ainverse[i-1,j-1] := ainverse[i-1,j-1] * sqrt(Eigenvector[j-1]) + else + begin + ainverse[i-1,j-1] := 0.0; + Eigenvector[j-1] := 0.0; + end; + end; + b[i-1] := 0.0; + end; + + //get communality estimate from sum of squared loadings in TempMat + for j := 1 to k do + for i := 1 to k do + b[i-1] := b[i-1] + (ainverse[i-1,j-1] * ainverse[i-1,j-1]); + for i := 1 to k do + begin + if (b[i-1] > 1.0) then + begin + b[i-1] := 1.0; + outline := 'WARNING! A communality estimate greater than 1.0 found.'; + OutPutFrm.RichEdit.Lines.Add(outline); + outline := 'Value replaced by 1.0. View results with skepticism.'; + OutPutFrm.RichEdit.Lines.Add(outline); + end; + end; + Difference := 0.0; + for i := 1 to k do Difference := Difference + abs(b[i-1] - communality[i-1]); + if ((Difference > criterion) and (noiterations < maxiters)) then + begin + for i := 1 to k do // restore original r matrix + for j := 1 to k do corrmat[i-1,j-1] := TempMat[i-1,j-1]; + // Place new communalities in the diagonal + for i := 1 to k do corrmat[i-1,i-1] := b[i-1]; + // scale for alpha analysis + if (factorchoice = 6) then + begin + for i := 1 to k do + for j := 1 to k do + corrmat[i-1,j-1] := (1.0 / sqrt(b[i-1])) * + corrmat[i-1,j-1] * (1.0 / sqrt(b[j-1])); + end; + // Save new communality estimates + for i := 1 to k do communality[i-1] := b[i-1]; + noiterations := noiterations + 1; + goto again; + end + + else + begin + if (noiterations >= maxiters) then + begin + outline := format('Factor Analysis failed to converge in %d iterations.',[maxiters]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + factREORDER(Eigenvector,ainverse,RowLabels,k); + end; + end + + else //principal components + begin + FACTORS(Eigenvector, d2, ainverse, k, factorchoice); + factREORDER(Eigenvector, ainverse, RowLabels, k); + end; + Screen.Cursor := Save_Cursor; // restore regular cursor + + for i := 1 to k do + for j := 1 to k do + Loadings[i-1,j-1] := ainverse[i-1,j-1]; + + if (ScreeBtn.Checked) then + begin + SetLength(GraphFrm.Ypoints,1,k); + SetLength(GraphFrm.Xpoints,1,k); + for i := 1 to k do + begin + xvector[i-1] := i; + GraphFrm.Xpoints[0,i-1] := i; + GraphFrm.Ypoints[0,i-1] := Eigenvector[i-1]; + end; + GraphFrm.nosets := 1; + GraphFrm.nbars := k; + GraphFrm.Heading := 'PLOT OF EIGENVALUES EXTRACTED'; + GraphFrm.XTitle := 'ROOT NUMBER'; + GraphFrm.YTitle := 'EIGENVALUE'; +// GraphFrm.Ypoints[1] := Eigenvector; +// GraphFrm.Xpoints[1] := xvector; + GraphFrm.AutoScale := true; + GraphFrm.PtLabels := false; + GraphFrm.GraphType := 7; // 2d points + GraphFrm.BackColor := clYellow; + GraphFrm.ShowBackWall := true; + GraphFrm.ShowModal; + end; + + // Setup labels for factors + for i := 1 to k do + begin + outline := format('Factor %d',[i]); + ColLabels[i-1] := outline; + end; + + //print results if requested + if (UnrotBtn.Checked) then + begin + OutPutFrm.RichEdit.Lines.Add('Roots (Eigenvalues) Extracted:'); + for i := 1 to Nroots do + begin + outline := format('%4d %6.3f',[i, Eigenvector[i-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + outline := 'Unrotated Factor Loadings'; + OutPutFrm.RichEdit.Lines.Add(outline); + Title := 'FACTORS'; + MAT_PRINT(Loadings,k,Nroots,Title,RowLabels,ColLabels,count); + OutPutFrm.RichEdit.Lines.Add('Percent of Trace In Each Root:'); + for i := 1 to Nroots do + begin + outline := format('%4d Root := %6.3f Trace := %6.3f Percent := %7.3f', + [i, Eigenvector[i-1], trace, (Eigenvector[i-1]/ trace) * 100.0]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + + // final communality estimates + trace := 0.0; + for i := 1 to k do + begin + b[i-1] := 0.0; + for j := 1 to Nroots do b[i-1] := b[i-1] + (Loadings[i-1,j-1] * Loadings[i-1,j-1]); + trace := trace + b[i-1]; + end; + + if (ComUnBtn.Checked) then + begin + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.RichEdit.Lines.Add('COMMUNALITY ESTIMATES'); + for i := 1 to k do + begin + outline := format('%3d %-10s %6.3f',[i,RowLabels[i-1],b[i-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + end; + + if ( Nroots > 1) then + begin + minroot := StrToFloat(MinRootEdit.Text); + Nroots := 0; + for i := 1 to k do + if ( Eigenvector[i-1] > minroot) then Nroots := Nroots + 1; + if (maxnoroots = 0) then maxnoroots := Nroots; + if (Nroots > maxnoroots) then Nroots := maxnoroots; + if (RotateGroup.ItemIndex = 0) then + VARIMAX(Loadings, k, Nroots, RowLabels, ColLabels, ColNoSelected); + if (RotateGroup.ItemIndex = 1) then + ShowMessage('Oblimax not available - sorry!'); + if (RotateGroup.ItemIndex = 2) then + QUARTIMAX(Loadings, k, Nroots, RowLabels, ColLabels, ColNoSelected); + if (RotateGroup.ItemIndex = 3) then // graphical (manual) rotation + ManualRotate(Loadings, k, Nroots, RowLabels, ColLabels, ColNoSelected,self); + if (RotateGroup.ItemIndex = 4) then // Procrustean rotation to target + begin // procrustean rotation + PROCRUST(Loadings,k,Nroots,RowLabels,ColLabels); + end; + end; + if (( factorchoice = 6) or (factorchoice = 7)) then + begin + outline := format('No. of iterations := %d',[noiterations]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + + if (( Nroots > 1) and (PlotBtn.Checked)) then + begin + for i := 1 to Nroots - 1 do + begin + for j := i + 1 to Nroots do + begin + for L := 1 to k do + begin + xvector[L-1] := Loadings[L-1,i-1]; + yvector[L-1] := Loadings[L-1,j-1]; + end; + xtitle := format('Factor %d',[i]); + ytitle := format('Factor %d',[j]); + scatplot(xvector, yvector, k, 'FACTOR PLOT', xtitle, + ytitle, -1.0, 1.0, -1.0, 1.0, RowLabels); + end; //Next j + end; //Next i + end; + + // Compute factor scores if checked + if (ScoresBtn.Checked) then + begin + if (MatInput = true) then + ShowMessage('Original subject scores unavailable (matrix input.)') + else LSFactScores(Loadings,k,Nroots,NoCases,ColNoSelected,RowLabels); + end; + + // Save loadings if checked + if (SaveFactBtn.Checked) then + begin + SaveDialog1.Filter := 'Matrix File (*.MAT)|*.MAT|Any File (*.*)|*.*'; + SaveDialog1.FilterIndex := 1; + SaveDialog1.Title := 'Save Factor Loadings'; + SaveDialog1.Execute; + filename := SaveDialog1.FileName; + MATSAVE(Loadings,k,Nroots,means,stddevs,count,RowLabels,ColLabels,filename); + end; + + // Clean up the heap + ColNoSelected := nil; + ColLabels := nil; + RowLabels := nil; + stddevs := nil; + variances := nil; + means := nil; + yvector := nil; + xvector := nil; + d2 := nil; + b := nil; + pcnttrace := nil; + communality := nil; + Eigenvector := nil; + Loadings := nil; + W := nil; + V := nil; + ainverse := nil; + TempMat := nil; + corrmat := nil; + GraphFrm.Ypoints := nil; + GraphFrm.Xpoints := nil; +end; + +procedure TFactorFrm.InBtnClick(Sender: TObject); +VAR i, index : integer; +begin + index := VarList.Items.Count; + i := 0; + while i < index do + begin + if (VarList.Selected[i]) then + begin + FactorList.Items.Add(VarList.Items.Strings[i]); + VarList.Items.Delete(i); + index := index - 1; + i := 0; + end + else i := i + 1; + end; + OutBtn.Visible := true; +end; + +procedure TFactorFrm.OutBtnClick(Sender: TObject); +VAR index : integer; +begin + index := FactorList.ItemIndex; + if index < 0 then + begin + OutBtn.Visible := false; + exit; + end; + VarList.Items.Add(FactorList.Items.Strings[index]); + FactorList.Items.Delete(index); +end; + +procedure TFactorFrm.FACTORS(var eigenvalues: DblDyneVec; var d2: DblDyneVec; + var A: DblDyneMat; N: integer; factorchoice: integer); +var i, j : integer; + +begin + //eigenvalues is the vector of N roots, a is the matrix of column eigenvectors, n is the order of the vector + //and matrix, factorchoice is an integer indicating the type of factor analysis, and d2 is + //a scaling weight for scaled factor analysis types + //The results are the normalized factor loadings returned in a. + + for i := 1 to N do + begin + for j := 1 to N do + begin + if ( eigenvalues[j-1] > 0) then A[i-1,j-1] := A[i-1,j-1] * sqrt(eigenvalues[j-1]) + else A[i-1,j-1] := 0.0; + end; + end; + if ((factorchoice = 4) or (factorchoice = 5)) then + begin + for i := 1 to N do + begin + for j := 1 to N do + begin + if (d2[i-1] > 0) then A[i-1,j-1] := A[i-1,j-1] * sqrt(d2[i-1]) + else A[i-1,j-1] := 0.0; + end; + end; + end; + if ( factorchoice = 6) then //alpha factor analysis + begin + for i := 1 to N do + begin + for j := 1 to N do + begin + if ( eigenvalues[j-1] > 0 ) then A[i-1,j-1] := A[i-1,j-1] * sqrt(1.0 - d2[i-1]) + else A[i-1,j-1] := 0.0; + end; + end; + end; +end; + +procedure TFactorFrm.factREORDER(var d: DblDyneVec; var A: DblDyneMat; + var var_label: StrDyneVec; N: integer); +var + i, j, k : integer; + Temp : double; +begin + // d is the vector of eigenvalues, A is the eigenvalues matrix, + // var_label is the array of variable labels and + // n is the vector and matrix order. + + for i := 1 to N - 1 do + begin + for j := i + 1 to N do + begin + if ( d[i-1] < d[j-1]) then + begin + Temp := d[i-1]; // swap eigenvectors + d[i-1] := d[j-1]; + d[j-1] := Temp; + for k := 1 to N do // swap columns in iegenvector matrix + begin + Temp := A[k-1,i-1]; + A[k-1,i-1] := A[k-1,j-1]; + A[k-1,j-1] := Temp; + end; + end; + end; + end; +end; + +procedure TFactorFrm.SORT_LOADINGS(var v: DblDyneMat; n1, n2: integer; + var High_Factor: IntDyneVec; var A: DblDyneVec; var b: DblDyneVec; + var var_label: StrDyneVec; order: IntDyneVec); +var + i, j, k, itemp : integer; + NoInFact : IntDyneVec; + maxval, Temp : double; + tempstr : string; + +begin + SetLength(NoInFact,NoVariables); + + // Reorder factors in descending sequence ( left to right ) + for j := 1 to n2 - 1 do + begin // factor j + for k := j + 1 to n2 do + begin // factor k + if ( A[j-1] < A[k-1]) then + begin // variance and factors need swapping + for i := 1 to n1 do + begin // swap factors + Temp := v[i-1,j-1]; + v[i-1,j-1] := v[i-1,k-1]; + v[i-1,k-1] := Temp; + end; + Temp := A[j-1]; // variance swap + A[j-1] := A[k-1]; + A[k-1] := Temp; + end; + end; + end; + // Now select largest loading in each variable + for j := 1 to n2 do NoInFact[j-1] := 0; + for i := 1 to n1 do + begin + High_Factor[i-1] := 0; + maxval := 0.0; + for j := 1 to n2 do + begin + if ( abs(v[i-1,j-1]) > abs(maxval)) then + begin + maxval := abs(v[i-1,j-1]); + High_Factor[i-1] := j; + end; + end; + end; + // Now sort matrix loadings + for i := 1 to n1 - 1 do + begin + for j := i + 1 to n1 do + begin + if ( High_Factor[i-1] > High_Factor[j-1]) then + begin + itemp := High_Factor[i-1]; + High_Factor[i-1] := High_Factor[j-1]; + High_Factor[j-1] := itemp; + for k := 1 to n2 do + begin // loading swap + Temp := v[i-1,k-1]; + v[i-1,k-1] := v[j-1,k-1]; + v[j-1,k-1] := Temp; + end; + tempstr := var_label[i-1]; // label swap + var_label[i-1] := var_label[j-1]; + var_label[j-1] := tempstr; + Temp := b[i-1]; // communality swap + b[i-1] := b[j-1]; + b[j-1] := Temp; + itemp := order[i-1]; + order[i-1] := order[j-1]; + order[j-1] := itemp; + end; + end; + end; + NoInFact := nil; +end; + +procedure TFactorFrm.VARIMAX(var v: DblDyneMat; n1, n2: integer; + var RowLabels: StrDyneVec; var ColLabels: StrDyneVec; var order: IntDyneVec); +label nextone; +var + pi : double; + A, b, C : DblDyneVec; + i, j, k, M, N, minuscount : integer; + High_Factor : IntDyneVec; + a1, b1, c1, c2, c3, c4, d1, x1, x2, Y, s1, Q, TotalPercent, t : double; + outline : string; + Title : string; +begin + pi := 3.14159265358979; + t := n1; + SetLength(A,NoVariables); + SetLength(b,NoVariables); + SetLength(C,NoVariables); + SetLength(High_Factor,NoVariables); + // calculate proportion of variance accounted for by each factor + //before rotation + for j := 1 to n2 do + begin + A[j-1] := 0.0; + for i := 1 to n1 do A[j-1] := A[j-1] + (v[i-1,j-1] * v[i-1,j-1]); + A[j-1] := A[j-1] / t * 100.0; + end; + if (FactorFrm.PcntTrBtn.Checked) then + begin + OutPutFrm.RichEdit.Lines.Add('Proportion of variance in unrotated factors'); + OutPutFrm.RichEdit.Lines.Add(''); + for j := 1 to n2 do + begin + outline := format('%3d %6.3f',[j, A[j-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + end; + for i := 1 to n1 do + begin + b[i-1] := 0.0; + High_Factor[i-1] := 0; + end; + // Reflect factors 180 degrees if more negative than positive loadings + for j := 1 to n2 do + begin + minuscount := 0; + for i := 1 to n1 do + begin + if ( v[i-1,j-1] < 0) then minuscount := minuscount + 1; + end; + if ( minuscount > (n1 / 2)) then + begin + for i := 1 to n1 do v[i-1,j-1] := v[i-1,j-1] * -1.0; + end; + end; + + // normalize rows of v + for i := 1 to n1 do + begin + for j := 1 to n2 do + begin + b[i-1] := b[i-1] + (v[i-1,j-1] * v[i-1,j-1]); + end; + b[i-1] := sqrt(b[i-1]); + for j := 1 to n2 do v[i-1,j-1] := v[i-1,j-1] / b[i-1]; + end; + +nextone: + k := 0; + for M := 1 to n2 do + begin + for N := M to n2 do + begin + if ( M <> N) then // compute angle of rotation + begin + for i := 1 to n1 do + begin + A[i-1] := (v[i-1,M-1] * v[i-1,M-1]) - (v[i-1,N-1] * v[i-1,N-1]); + C[i-1] := 2.0 * v[i-1,M-1] * v[i-1,N-1]; + end; + a1 := 0.0; + for i := 1 to n1 do a1 := a1 + A[i-1]; + b1 := 0.0; + for i := 1 to n1 do b1 := b1 + C[i-1]; + c1 := 0.0; + for i := 1 to n1 do c1 := c1 + (A[i-1] * A[i-1]); + c2 := 0.0; + for i := 1 to n1 do c2 := c2 + (C[i-1] * C[i-1]); + c3 := c1 - c2; + d1 := 0.0; + for i := 1 to n1 do d1 := d1 + A[i-1] * C[i-1]; + d1 := 2 * d1; + x1 := d1 - 2.0 * a1 * b1 / t; + x2 := c3 - ((a1 * a1) - (b1 * b1)) / t; + Y := ArcTan(x1 / x2); + if ( x2 < 0) then + begin + if ( x1 >= 0.0) then Y := Y + 2.0 * pi; + Y := Y - pi; + end; + Y := Y / 4.0; + //if (fabs(Y) >= 0.0175) // rotate pair of axes + if ( abs(Y) >= 0.000001) then + begin + c4 := cos(Y); + s1 := sin(Y); + k := 1; + for i := 1 to n1 do + begin + Q := v[i-1,M-1] * c4 + v[i-1,N-1] * s1; + v[i-1,N-1] := v[i-1,N-1] * c4 - v[i-1,M-1] * s1; + v[i-1,M-1] := Q; + end; + end; // if y + end; // if m <> n + end; // next n + end; // next m + if ( k > 0) then goto nextone; + // denormalize rows of v + for j := 1 to n2 do + begin + for i := 1 to n1 do v[i-1,j-1] := v[i-1,j-1] * b[i-1]; + A[j-1] := 0.0; + for i := 1 to n1 do A[j-1] := A[j-1] + (v[i-1,j-1] * v[i-1,j-1]); + A[j-1] := A[j-1] / t * 100.0; + end; + for i := 1 to n1 do b[i-1] := (b[i-1] * b[i-1]) * 100.0; + if (FactorFrm.ComUnBtn.Checked) then + begin + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.RichEdit.Lines.Add('Communality Estimates as percentages:'); + for i := 1 to n1 do + begin + outline := format('%3d %6.3f',[i,b[i-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + end; + if (FactorFrm.SortBtn.Checked)then + SORT_LOADINGS(v, n1, n2, High_Factor, A, b, RowLabels, order); + // Reflect factors 180 degrees if more negative than positive loadings + for j := 1 to n2 do + begin + minuscount := 0; + for i := 1 to n1 do + begin + if ( v[i-1,j-1] < 0) then minuscount := minuscount + 1; + end; + if ( minuscount > (n1 / 2)) then + begin + for i := 1 to n1 do v[i-1,j-1] := v[i-1,j-1] * -1.0; + end; + end; + // recalculate proportion of variance accounted for by each factor + for j := 1 to n2 do + begin + A[j-1] := 0.0; + for i := 1 to n1 do A[j-1] := A[j-1] + (v[i-1,j-1] * v[i-1,j-1]); + A[j-1] := A[j-1] / t * 100.0; + end; + // print results + Title := 'Varimax Rotated Loadings'; + MAT_PRINT(v,n1,n2,Title,RowLabels,ColLabels,NoCases); + TotalPercent := 0.0; + OutPutFrm.RichEdit.Lines.Add('Percent of Variation in Rotated Factors'); + for j := 1 to n2 do + begin + outline := format('Factor %3d %6.3f', [j,A[j-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + TotalPercent := TotalPercent + A[j-1]; + end; + OutPutFrm.RichEdit.Lines.Add(''); + outline := format('Total Percent of Variance in Factors : %6.3f',[TotalPercent]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add('Communalities as Percentages'); + for i := 1 to n1 do + begin + outline := format('%3d for %15s %6.3f',[i, RowLabels[i-1], b[i-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + + // clean up heap + High_Factor := nil; + C := nil; + b := nil; + A := nil; +end; + +procedure TFactorFrm.PROCRUST(var b: DblDyneMat; nv, nb: integer; + var RowLabels: StrDyneVec; var ColLabels: StrDyneVec); +label cleanup; +var + i, j, k, na, nf, nd, nv2, count : integer; + ee, p, sum : double; + A, C, d, v, trans : DblDyneMat; + e, f, g, means, stddevs : DblDyneVec; + outline : string; + Title : string; + ColALabels : StrDyneVec ; + filename : string; + errorcode : boolean; +begin + // nv is the no. of variables, nb the number of factors in the loadings + // matrix. + // na is the number of factors in target matrix + // nf is the no. of roots and vectors extracted from routine sevs + // b is the obtained factor matrix + // A is the target factor matrix + // ColLabels is the set of labels for the obtained factors + // ColALabels is the set of labels for the target factor matrix + Title := 'Source Factor Loadings'; + MAT_PRINT(b,nv,nb,title,RowLabels,ColLabels,NoCases); + nd := nv; + SetLength(A,NoVariables,NoVariables); + SetLength(C,NoVariables,NoVariables); + SetLength(d,NoVariables,NoVariables); + SetLength(v,NoVariables,NoVariables); + SetLength(trans,NoVariables,NoVariables); + SetLength(e,NoVariables); + SetLength(f,NoVariables); + SetLength(g,NoVariables); + SetLength(means,NoVariables); + SetLength(stddevs,NoVariables); + SetLength(ColALabels,NoVariables); + + // read target matrix into A + FactorFrm.OpenDialog1.Filter := 'Matrix File (*.MAT)|*.MAT|Any File (*.*)|*.*'; + FactorFrm.OpenDialog1.FilterIndex := 1; + FactorFrm.OpenDialog1.Title := 'Target Matrix'; + FactorFrm.OpenDialog1.DefaultExt := 'MAT'; + FactorFrm.OpenDialog1.Execute; + filename := FactorFrm.OpenDialog1.FileName; + MATREAD(A,nv2,na,means,stddevs,count,RowLabels,ColALabels,filename); + Title := 'Target Factor Loadings'; + MAT_PRINT(A,nv2,na,Title,RowLabels,ColALabels,count); + if nv2 <> nv then + begin + ShowMessage('ERROR! No. of variables do not match.'); + goto cleanup; + end; + + // normalize matrix A by rows. + for i := 1 to nv do + begin + sum := 0.0; + for j := 1 to na do sum := sum + (A[i-1,j-1] * A[i-1,j-1]); + p := 1.0 / sqrt(sum); + for j := 1 to na do A[i-1,j-1] := A[i-1,j-1] * p; + end; + for i := 1 to nv do // normalize matrix b by rows. Save lengths in g. + begin + sum := 0.0; + for j := 1 to nb do sum := sum + (b[i-1,j-1] * b[i-1,j-1]); + g[i-1] := sqrt(sum); + for j := 1 to nb do b[i-1,j-1] := b[i-1,j-1] / g[i-1]; + end; + // compute cosines between factor axes and print results + // get A transpose x B into C + MATTRN(trans,A,nv,na); + MatAxB(C,trans,b,na,nv,nv,nb,errorcode); + // get D := C x C transpose + MATTRN(trans,C,na,nb); + MatAxB(d,C,trans,na,nb,nb,na,errorcode); + // get roots and vectors of D. + nf := SEVS(na, na, 0.0, d, v, e, f, nd); //nf is new no. of factors returned in na + nb := nf; + // get d := C transpose x V end; + MATTRN(trans,C,na,nb); + MatAxB(d,trans,v,nb,na,na,nb,errorcode); + for j := 1 to nb do + begin + ee := Power(e[j-1],-1.5); + for i := 1 to nb do d[i-1,j-1] := d[i-1,j-1] * ee; + end; + // get D x V' end; + MATTRN(trans,v,na,nb); + MatAxB(C,d,trans,nb,nb,nb,na,errorcode); + OutPutFrm.RichEdit.Lines.Add('Factor Pattern Comparison:'); + Title := 'Cosines Among Factor Axis'; + MAT_PRINT(C,na,nb,Title,ColALabels,ColLabels,NoCases); + // get B x C + for i := 1 to nv do + begin + for j := 1 to na do + begin + d[i-1,j-1] := 0.0; + for k := 1 to nb do d[i-1,j-1] := d[i-1,j-1] + (b[i-1,k-1] * C[j-1,k-1]); + end; + end; + for i := 1 to nv do + for j := 1 to na do + v[i-1,j-1] := d[i-1,j-1] * g[i-1]; + Title := 'Factors Rotated to Conguence With Target'; + MAT_PRINT(v,nv,na,Title,RowLabels,ColALabels,NoCases); + for i := 1 to nv do + begin + sum := 0.0; // Get column products of the two matrices + for j := 1 to na do sum := sum + (A[i-1,j-1] * d[i-1,j-1]); + g[i-1] := sum; + end; + OutPutFrm.RichEdit.Lines.Add('Cosines (Correlations) Between Corresponding Variables'); + OutPutFrm.RichEdit.Lines.Add(''); + for i := 1 to nv do + begin + outline := format('%-10s %8.6f',[RowLabels[i-1],g[i-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + + // cleanup +cleanup: + ColALabels := nil; + stddevs := nil; + means := nil; + g := nil; + f := nil; + e := nil; + trans := nil; + v := nil; + d := nil; + C := nil; + A := nil; +end; + +procedure TFactorFrm.LSFactScores(var F: DblDyneMat; NoVars, NoFacts, + NCases: integer; var ColNoSelected: IntDyneVec; var RowLabels: StrDyneVec); +var + R, Rinv, Beta : DblDyneMat; + Means, Variances, StdDevs : DblDyneVec; + Score, Sigma, x, z : double; + i, j, k, m, col, colno, errorcode, oldnovars : integer; + ColLabels : StrDyneVec; + outline : string; + Title : string; + errcode : boolean; + +begin + SetLength(R,NoVariables+1,NoVariables+1); + SetLength(Rinv,NoVariables+1,NoVariables+1); + SetLength(Beta,NoVariables,NoVariables); + SetLength(Means,NoVariables); + SetLength(Variances,NoVariables); + SetLength(StdDevs,NoVariables); + SetLength(ColLabels,NoVariables); + + // setup labels and print routine + for i := 1 to NoFacts do + begin + outline := format('Factor %d',[i]); + ColLabels[i-1] := outline; + end; + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.RichEdit.Lines.Add('SUBJECT FACTOR SCORE RESULTS:'); + + // Obtain correlations +// Correlate(NoVars,NoCases,ColNoSelected,Means,Variances,StdDevs,R,3,errorcode,NCases); + Correlations(NoVars,ColNoSelected,R,Means,Variances,StdDevs,errcode,NCases); + for i := 1 to NoVars do + for j := 1 to NoVars do + Rinv[i-1,j-1] := R[i-1,j-1]; + + // Get inverse of the correlation matrix + // Note - offset by one for inverse routine + SVDinverse(Rinv, NoVars); + + // Multiply the inverse matrix times the factor loadings matrix + MatAxB(Beta,Rinv,F,NoVars,NoVars,NoVars,NoFacts,errcode); + Title := 'Regression Coefficients'; + MAT_PRINT(Beta,NoVars,NoFacts,Title,RowLabels,ColLabels,NCases); + + // Calculate standard errors of factor scores + OutPutFrm.RichEdit.Lines.Add(''); + OutPutFrm.RichEdit.Lines.Add('Standard Error of Factor Scores:'); + for i := 1 to NoFacts do + begin + Sigma := 0.0; + for j := 1 to NoVars do + begin + Sigma := Sigma + (Beta[j-1,i-1] * F[j-1,i-1]); + end; + Sigma := sqrt(Sigma); + outline := format('%-10s %6.3f',[ColLabels[i-1],Sigma]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + + //Calculate subject factor scores and place in the data grid + // place labels in new grid columns and define + oldnovars := NoVariables; + for i := 1 to NoFacts do + begin + col := NoVariables + 1; + outline := format('Fact.%d Scr.',[i]); +// MakeVar(col,outline); + DictionaryFrm.NewVar(col); + DictionaryFrm.DictGrid.Cells[1,col] := outline; + OS3MainFrm.DataGrid.Cells[col,0] := outline; +// NoVariables := NoVariables + 1; + end; + for i := 1 to NoCases do // subject + begin + if (not GoodRecord(i,NoVars,ColNoSelected)) then continue; + for j := 1 to NoFacts do // variables + begin + Score := 0.0; + for k := 1 to NoVars do + begin + m := ColNoSelected[k-1]; + x := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[m,i])); + z := (x - Means[k-1]) / StdDevs[k-1]; + Score := Score + (z * Beta[k-1,j-1]); + end; + colno := oldnovars + j; + outline := format('%6.4f',[Score]); + OS3MainFrm.DataGrid.Cells[colno,i] := outline; + end; + end; + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + + // clean up the heap + ColLabels := nil; + StdDevs := nil; + Variances := nil; + Means := nil; + Beta := nil; + Rinv := nil; + R := nil; +end; + +procedure TFactorFrm.QUARTIMAX(var v: DblDyneMat; n1, n2: integer; + var RowLabels: StrDyneVec; var ColLabels: StrDyneVec; var order: IntDyneVec); +var + i, j, M, N, minuscount, NoIters : integer; + A, b, C : DblDyneVec; + High_Factor : IntDyneVec; + c4, s1, Q, NewQ, TotalPercent, t : double; + theta, tan4theta, ssqrp, ssqrj, prodjp, numerator, denominator : double; + outline : string; + done : boolean; + Title : string; +begin + SetLength(A,NoVariables); + SetLength(b,NoVariables); + SetLength(C,NoVariables); + SetLength(High_Factor,NoVariables); + NoIters := 0; + + // calculate proportion of variance accounted for by each factor + //before rotation + t := n1; + for j := 1 to n2 do + begin + A[j-1] := 0.0; + for i := 1 to n1 do A[j-1] := A[j-1] + (v[i-1,j-1] * v[i-1,j-1]); + A[j-1] := A[j-1] / t * 100.0; + end; + if FactorFrm.PcntTrBtn.Checked then + begin + OutPutFrm.RichEdit.Lines.Add('Proportion of variance in unrotated factors'); + OutPutFrm.RichEdit.Lines.Add(''); + for j := 1 to n2 do + begin + outline := format('%3d %6.3f',[j, A[j-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + end; + for i := 0 to n1-1 do + begin + b[i] := 0.0; + High_Factor[i] := 0; + end; + + // Reflect factors 180 degrees if more negative than positive loadings + for j := 0 to n2-1 do + begin + minuscount := 0; + for i := 0 to n1-1 do + begin + if v[i,j] < 0 then minuscount := minuscount + 1; + end; + if minuscount > (n1 / 2) then + begin + for i := 0 to n1-1 do v[i,j] := v[i,j] * -1.0; + end; + end; + + t := n1; + // normalize rows of v + for i := 0 to n1-1 do + begin + for j := 0 to n2-1 do + begin + b[i] := b[i] + (v[i,j] * v[i,j]); + end; + b[i] := sqrt(b[i]); + end; + + done := false; + Q := 0.0; + for i := 1 to n1 do + for j := 1 to n2 do + Q := Q + Power(v[i-1,j-1],4.0); + while (not done) do + begin + for M := 1 to n2-1 do + begin + for N := M + 1 to n2 do + begin + // compute angle of rotation for this pair of factors + numerator := 0.0; + denominator := 0.0; + for i := 1 to n1 do + begin + ssqrp := v[i-1,M-1] * v[i-1,M-1]; + ssqrj := v[i-1,N-1] * v[i-1,N-1]; + prodjp := 2.0 * v[i-1,M-1] * v[i-1,N-1]; + numerator := numerator + prodjp * (ssqrp - ssqrj); + denominator := denominator + (Power(ssqrp - ssqrj,2.0) - Power(prodjp,2)); + end; + tan4theta := (2.0 * numerator) / denominator; + theta := ArcTan(tan4theta) / 4.0; + c4 := cos(theta); + s1 := sin(theta); + // transform factor loadings + for i := 1 to n1 do + begin + v[i-1,M-1] := v[i-1,M-1] * c4 + v[i-1,N-1] * s1; + v[i-1,N-1] := v[i-1,N-1] * c4 - v[i-1,M-1] * s1; + end; + end; // next n + end; // next m + NewQ := 0.0; + for i := 1 to n1 do + for j := 1 to n2 do + NewQ := NewQ + Power(v[i-1,j-1],4.0); + if (abs(Q - NewQ) < 0.00001) then done := true; + if (n2 < 3) then done := true; + if (not done) then + begin + NoIters := NoIters + 1; + if (NoIters > 25) then + begin + outline := 'Quartimax failed to converge in 25 iterations.'; + OutPutFrm.RichEdit.Lines.Add(outline); + done := true; + end; + Q := NewQ; + end; + end; // while not done +{ + // denormalize rows of v + for ( j := 0; j < n2; j++) + begin + for ( i := 0; i < n1; i++) v[i,j] *= b[i]; + A[j] := 0.0; + for ( i := 0; i < n1; i++) A[j] += (v[i,j] * v[i,j]); + A[j] := A[j] / t * 100.0; + end; +} + for i := 1 to n1 do b[i-1] := (b[i-1] * b[i-1]) * 100.0; + if (FactorFrm.SortBtn.Checked) then + SORT_LOADINGS(v, n1, n2, High_Factor, A, b, RowLabels, order); + // Reflect factors 180 degrees if more negative than positive loadings + for j := 1 to n2 do + begin + minuscount := 0; + for i := 1 to n1 do + begin + if ( v[i-1,j-1] < 0) then minuscount := minuscount + 1; + end; + if ( minuscount > (n1 / 2)) then + begin + for i := 1 to n1 do v[i-1,j-1] := v[i-1,j-1] * -1.0; + end; + end; + // recalculate proportion of variance accounted for by each factor + for j := 0 to n2-1 do + begin + A[j] := 0.0; + for i := 0 to n1-1 do A[j] := A[j] + (v[i,j] * v[i,j]); + A[j] := A[j] / t * 100.0; + end; + // print results + TotalPercent := 0.0; + Title := 'Quartimax Rotated Loadings'; + MAT_PRINT(v,n1,n2,Title,RowLabels,ColLabels,NoCases); + OutPutFrm.RichEdit.Lines.Add('Percent of Variation in Rotated Factors'); + for j := 0 to n2-1 do + begin + outline := format('Factor %3d %6.3f',[j+1,A[j]]); + OutPutFrm.RichEdit.Lines.Add(outline); + TotalPercent := TotalPercent + A[j]; + end; + if (FactorFrm.ComUnBtn.Checked) then + begin + OutPutFrm.RichEdit.Lines.Add(''); + outline := format('Total Percent of Variance in Factors : %6.3f',[TotalPercent]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add('Communalities as Percentages'); + for i := 1 to n1 do + begin + outline := format('%3d for %s %6.3f',[i, RowLabels[i-1], b[i-1]]); + OutPutFrm.RichEdit.Lines.Add(outline); + end; + OutPutFrm.RichEdit.Lines.Add(''); + end; + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; + + // clean up heap + High_Factor := nil; + C := nil; + b := nil; + A := nil; +end; + +procedure TFactorFrm.ManualRotate(var v: DblDyneMat; n1, n2: integer; + var RowLabels: StrDyneVec; var ColLabels: StrDyneVec; var order: IntDyneVec; + Sender: TObject); +var + cols, rows : integer; + outline : string; + Title : string; + i, j : integer; +begin +// Passed: Loadings, k, Nroots, RowLabels, ColLabels, ColNoSelected,self + SetLength(RotateFrm.Loadings,NoVariables,NoVariables); + RotateFrm.Loadings := v; + RotateFrm.NoVars := n1; + RotateFrm.NoRoots := n2; + RotateFrm.RowLabels := RowLabels; + RotateFrm.ColLabels := ColLabels; + RotateFrm.Order := order; + RotateFrm.ShowModal; + + for i := 1 to n1 do + for j := 1 to n2 do v[i-1,j-1] := RotateFrm.Loadings[i-1,j-1]; + RotateFrm.Loadings := nil; + cols := n2; // no. of roots + rows := n1; // no. of variables + outline := 'Rotated Factor Loadings'; + OutPutFrm.RichEdit.Lines.Add(outline); + Title := 'FACTORS'; + MAT_PRINT(v,rows,cols,Title,RowLabels,ColLabels,NoCases); + OutPutFrm.ShowModal; + OutPutFrm.RichEdit.Clear; +end; + +initialization + {$I factorunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/FACTORUNIT.lfm b/applications/lazstats/source_orig/FACTORUNIT.lfm new file mode 100644 index 000000000..a921132d9 --- /dev/null +++ b/applications/lazstats/source_orig/FACTORUNIT.lfm @@ -0,0 +1,379 @@ +object FactorFrm: TFactorFrm + Left = 181 + Height = 486 + Top = 99 + Width = 608 + Caption = 'Factor Analysis' + ClientHeight = 486 + ClientWidth = 608 + OnShow = FormShow + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 6 + Height = 14 + Top = 1 + Width = 90 + Caption = 'Available Variables' + ParentColor = False + end + object Label2: TLabel + Left = 227 + Height = 14 + Top = 1 + Width = 88 + Caption = 'Selected Variables' + ParentColor = False + end + object Label3: TLabel + Left = 415 + Height = 14 + Top = 328 + Width = 115 + Caption = 'Min. root size to rotate:' + ParentColor = False + end + object Label4: TLabel + Left = 415 + Height = 14 + Top = 358 + Width = 99 + Caption = 'Maximum Iterations:' + ParentColor = False + end + object Label5: TLabel + Left = 414 + Height = 14 + Top = 391 + Width = 108 + Caption = 'Maximum No. Factors:' + ParentColor = False + end + object VarList: TListBox + Left = 7 + Height = 295 + Top = 15 + Width = 169 + ItemHeight = 0 + MultiSelect = True + TabOrder = 0 + end + object InBtn: TBitBtn + Left = 183 + Height = 35 + Top = 16 + Width = 36 + 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 = 1 + end + object OutBtn: TBitBtn + Left = 184 + Height = 35 + Top = 56 + Width = 36 + 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 = 2 + end + object FactorList: TListBox + Left = 225 + Height = 292 + Top = 16 + Width = 173 + ItemHeight = 0 + TabOrder = 3 + end + object TypeGroup: TRadioGroup + Left = 416 + Height = 156 + Top = 4 + Width = 187 + AutoFill = True + Caption = 'Type of Analysis' + 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 = 138 + ClientWidth = 183 + Items.Strings = ( + 'Principal Components' + 'Partial Image (No Iterations)' + 'Guttman Image' + 'Harris Scaled Image' + 'Canonical (Max. Likelihood)' + 'Alpha' + 'Principal Factors' + ) + TabOrder = 4 + end + object RotateGroup: TRadioGroup + Left = 415 + Height = 133 + Top = 176 + Width = 187 + AutoFill = True + Caption = 'Rotation Option' + 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 = 115 + ClientWidth = 183 + Items.Strings = ( + 'Varimax' + 'Oblimax' + 'Quartimax' + 'Manual (Graphical)' + 'Procrustian' + 'NO rotation' + ) + TabOrder = 5 + end + object GroupBox1: TGroupBox + Left = 6 + Height = 110 + Top = 320 + Width = 393 + Caption = 'Output Options:' + ClientHeight = 92 + ClientWidth = 389 + TabOrder = 6 + object DescBtn: TCheckBox + Left = 6 + Height = 17 + Top = 2 + Width = 119 + Caption = 'Descriptive Statistics' + TabOrder = 0 + end + object RMatBtn: TCheckBox + Left = 6 + Height = 17 + Top = 24 + Width = 106 + Caption = 'Correlation Matrix' + TabOrder = 1 + end + object UnrotBtn: TCheckBox + Left = 5 + Height = 17 + Top = 46 + Width = 108 + Caption = 'Unrotated Factors' + TabOrder = 2 + end + object PcntTrBtn: TCheckBox + Left = 6 + Height = 17 + Top = 67 + Width = 87 + Caption = 'Percent Trace' + TabOrder = 3 + end + object ScreeBtn: TCheckBox + Left = 137 + Height = 17 + Top = 2 + Width = 68 + Caption = 'Scree Plot' + TabOrder = 4 + end + object ComUnBtn: TCheckBox + Left = 136 + Height = 17 + Top = 24 + Width = 88 + Caption = 'Communalities' + TabOrder = 5 + end + object PlotBtn: TCheckBox + Left = 137 + Height = 17 + Top = 46 + Width = 77 + Caption = 'Plot Factors' + TabOrder = 6 + end + object ScoresBtn: TCheckBox + Left = 137 + Height = 17 + Top = 67 + Width = 86 + Caption = 'Factor Scores' + TabOrder = 7 + end + object SaveCorsBtn: TCheckBox + Left = 248 + Height = 17 + Top = 2 + Width = 133 + Caption = 'Save Correlation Matrix' + TabOrder = 8 + end + object SaveFactBtn: TCheckBox + Left = 248 + Height = 17 + Top = 24 + Width = 111 + Caption = 'Save Factor Matrix' + TabOrder = 9 + end + object SortBtn: TCheckBox + Left = 248 + Height = 17 + Top = 46 + Width = 79 + Caption = 'Sort Factors' + TabOrder = 10 + end + end + object MinRootEdit: TEdit + Left = 568 + Height = 21 + Top = 323 + Width = 32 + TabOrder = 7 + Text = 'MinRootEdit' + end + object MaxItersEdit: TEdit + Left = 568 + Height = 21 + Top = 353 + Width = 32 + TabOrder = 8 + Text = 'Edit1' + end + object MaxFactorsEdit: TEdit + Left = 568 + Height = 21 + Top = 386 + Width = 32 + TabOrder = 9 + Text = 'Edit1' + end + object ResetBtn: TButton + Left = 7 + Height = 30 + Top = 440 + Width = 74 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 10 + end + object CancelBtn: TButton + Left = 102 + Height = 30 + Top = 440 + Width = 74 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 11 + end + object ComputeBtn: TButton + Left = 224 + Height = 30 + Top = 440 + Width = 74 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 12 + end + object ReturnBtn: TButton + Left = 320 + Height = 30 + Top = 440 + Width = 74 + Caption = 'Return' + ModalResult = 1 + TabOrder = 13 + end + object OpenDialog1: TOpenDialog + left = 425 + top = 431 + end + object SaveDialog1: TSaveDialog + left = 472 + top = 431 + end +end diff --git a/applications/lazstats/source_orig/FACTORUNIT.lrs b/applications/lazstats/source_orig/FACTORUNIT.lrs new file mode 100644 index 000000000..d3b14d5e2 --- /dev/null +++ b/applications/lazstats/source_orig/FACTORUNIT.lrs @@ -0,0 +1,180 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TFactorFrm','FORMDATA',[ + 'TPF0'#10'TFactorFrm'#9'FactorFrm'#4'Left'#3#181#0#6'Height'#3#230#1#3'Top'#2 + +'c'#5'Width'#3'`'#2#7'Caption'#6#15'Factor Analysis'#12'ClientHeight'#3#230#1 + +#11'ClientWidth'#3'`'#2#6'OnShow'#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#1#5'Width'#2'Z'#7 + +'Caption'#6#19'Available Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2' + +#4'Left'#3#227#0#6'Height'#2#14#3'Top'#2#1#5'Width'#2'X'#7'Caption'#6#18'Sel' + +'ected Variables'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#3#159#1#6 + +'Height'#2#14#3'Top'#3'H'#1#5'Width'#2's'#7'Caption'#6#25'Min. root size to ' + +'rotate:'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#159#1#6'Height' + +#2#14#3'Top'#3'f'#1#5'Width'#2'c'#7'Caption'#6#19'Maximum Iterations:'#11'Pa' + +'rentColor'#8#0#0#6'TLabel'#6'Label5'#4'Left'#3#158#1#6'Height'#2#14#3'Top'#3 + +#135#1#5'Width'#2'l'#7'Caption'#6#20'Maximum No. Factors:'#11'ParentColor'#8 + +#0#0#8'TListBox'#7'VarList'#4'Left'#2#7#6'Height'#3''''#1#3'Top'#2#15#5'Widt' + +'h'#3#169#0#10'ItemHeight'#2#0#11'MultiSelect'#9#8'TabOrder'#2#0#0#0#7'TBitB' + +'tn'#5'InBtn'#4'Left'#3#183#0#6'Height'#2'#'#3'Top'#2#16#5'Width'#2'$'#10'Gl' + +'yph.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#1#0#0#7'TBitBtn'#6'OutBtn'#4'Left'#3#184#0#6'Height'#2'#'#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'OutBtnClick'#8'TabOrder'#2#2#0#0#8'TListBox'#10'Fac' + +'torList'#4'Left'#3#225#0#6'Height'#3'$'#1#3'Top'#2#16#5'Width'#3#173#0#10'I' + +'temHeight'#2#0#8'TabOrder'#2#3#0#0#11'TRadioGroup'#9'TypeGroup'#4'Left'#3 + +#160#1#6'Height'#3#156#0#3'Top'#2#4#5'Width'#3#187#0#8'AutoFill'#9#7'Caption' + +#6#16'Type of Analysis'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.' + +'TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousC' + +'hildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize' + +#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.Shrink' + +'Vertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightTh' + +'enTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#3#138#0 + +#11'ClientWidth'#3#183#0#13'Items.Strings'#1#6#20'Principal Components'#6#29 + +'Partial Image (No Iterations)'#6#13'Guttman Image'#6#19'Harris Scaled Image' + ,#6#27'Canonical (Max. Likelihood)'#6#5'Alpha'#6#17'Principal Factors'#0#8'Ta' + +'bOrder'#2#4#0#0#11'TRadioGroup'#11'RotateGroup'#4'Left'#3#159#1#6'Height'#3 + +#133#0#3'Top'#3#176#0#5'Width'#3#187#0#8'AutoFill'#9#7'Caption'#6#15'Rotatio' + +'n Option'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpac' + +'ing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27 + +'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.' + +'ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14 + +'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom' + +#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#2's'#11'ClientWidth'#3 + +#183#0#13'Items.Strings'#1#6#7'Varimax'#6#7'Oblimax'#6#9'Quartimax'#6#18'Man' + +'ual (Graphical)'#6#11'Procrustian'#6#11'NO rotation'#0#8'TabOrder'#2#5#0#0#9 + +'TGroupBox'#9'GroupBox1'#4'Left'#2#6#6'Height'#2'n'#3'Top'#3'@'#1#5'Width'#3 + +#137#1#7'Caption'#6#15'Output Options:'#12'ClientHeight'#2'\'#11'ClientWidth' + +#3#133#1#8'TabOrder'#2#6#0#9'TCheckBox'#7'DescBtn'#4'Left'#2#6#6'Height'#2#17 + +#3'Top'#2#2#5'Width'#2'w'#7'Caption'#6#22'Descriptive Statistics'#8'TabOrder' + +#2#0#0#0#9'TCheckBox'#7'RMatBtn'#4'Left'#2#6#6'Height'#2#17#3'Top'#2#24#5'Wi' + +'dth'#2'j'#7'Caption'#6#18'Correlation Matrix'#8'TabOrder'#2#1#0#0#9'TCheckB' + +'ox'#8'UnrotBtn'#4'Left'#2#5#6'Height'#2#17#3'Top'#2'.'#5'Width'#2'l'#7'Capt' + +'ion'#6#17'Unrotated Factors'#8'TabOrder'#2#2#0#0#9'TCheckBox'#9'PcntTrBtn'#4 + +'Left'#2#6#6'Height'#2#17#3'Top'#2'C'#5'Width'#2'W'#7'Caption'#6#13'Percent ' + +'Trace'#8'TabOrder'#2#3#0#0#9'TCheckBox'#8'ScreeBtn'#4'Left'#3#137#0#6'Heigh' + +'t'#2#17#3'Top'#2#2#5'Width'#2'D'#7'Caption'#6#10'Scree Plot'#8'TabOrder'#2#4 + +#0#0#9'TCheckBox'#8'ComUnBtn'#4'Left'#3#136#0#6'Height'#2#17#3'Top'#2#24#5'W' + +'idth'#2'X'#7'Caption'#6#13'Communalities'#8'TabOrder'#2#5#0#0#9'TCheckBox'#7 + +'PlotBtn'#4'Left'#3#137#0#6'Height'#2#17#3'Top'#2'.'#5'Width'#2'M'#7'Caption' + +#6#12'Plot Factors'#8'TabOrder'#2#6#0#0#9'TCheckBox'#9'ScoresBtn'#4'Left'#3 + +#137#0#6'Height'#2#17#3'Top'#2'C'#5'Width'#2'V'#7'Caption'#6#13'Factor Score' + +'s'#8'TabOrder'#2#7#0#0#9'TCheckBox'#11'SaveCorsBtn'#4'Left'#3#248#0#6'Heigh' + +'t'#2#17#3'Top'#2#2#5'Width'#3#133#0#7'Caption'#6#23'Save Correlation Matrix' + +#8'TabOrder'#2#8#0#0#9'TCheckBox'#11'SaveFactBtn'#4'Left'#3#248#0#6'Height'#2 + +#17#3'Top'#2#24#5'Width'#2'o'#7'Caption'#6#18'Save Factor Matrix'#8'TabOrder' + +#2#9#0#0#9'TCheckBox'#7'SortBtn'#4'Left'#3#248#0#6'Height'#2#17#3'Top'#2'.'#5 + +'Width'#2'O'#7'Caption'#6#12'Sort Factors'#8'TabOrder'#2#10#0#0#0#5'TEdit'#11 + +'MinRootEdit'#4'Left'#3'8'#2#6'Height'#2#21#3'Top'#3'C'#1#5'Width'#2' '#8'Ta' + +'bOrder'#2#7#4'Text'#6#11'MinRootEdit'#0#0#5'TEdit'#12'MaxItersEdit'#4'Left' + +#3'8'#2#6'Height'#2#21#3'Top'#3'a'#1#5'Width'#2' '#8'TabOrder'#2#8#4'Text'#6 + +#5'Edit1'#0#0#5'TEdit'#14'MaxFactorsEdit'#4'Left'#3'8'#2#6'Height'#2#21#3'To' + +'p'#3#130#1#5'Width'#2' '#8'TabOrder'#2#9#4'Text'#6#5'Edit1'#0#0#7'TButton'#8 + +'ResetBtn'#4'Left'#2#7#6'Height'#2#30#3'Top'#3#184#1#5'Width'#2'J'#7'Caption' + +#6#5'Reset'#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#10#0#0#7'TButton'#9 + +'CancelBtn'#4'Left'#2'f'#6'Height'#2#30#3'Top'#3#184#1#5'Width'#2'J'#7'Capti' + +'on'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#11#0#0#7'TButton'#10'Comp' + +'uteBtn'#4'Left'#3#224#0#6'Height'#2#30#3'Top'#3#184#1#5'Width'#2'J'#7'Capti' + +'on'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#12#0#0#7'TB' + +'utton'#9'ReturnBtn'#4'Left'#3'@'#1#6'Height'#2#30#3'Top'#3#184#1#5'Width'#2 + +'J'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#13#0#0#11'TOpen' + +'Dialog'#11'OpenDialog1'#4'left'#3#169#1#3'top'#3#175#1#0#0#11'TSaveDialog' + +#11'SaveDialog1'#4'left'#3#216#1#3'top'#3#175#1#0#0#0 +]); diff --git a/applications/lazstats/source_orig/FFTUNIT.PAS b/applications/lazstats/source_orig/FFTUNIT.PAS new file mode 100644 index 000000000..076937908 --- /dev/null +++ b/applications/lazstats/source_orig/FFTUNIT.PAS @@ -0,0 +1,36 @@ +unit FFTUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls; + +type + + { TFFTFrm } + + TFFTFrm = class(TForm) + CancelBtn: TButton; + OKBtn: TButton; + NptsEdit: TEdit; + Label1: TLabel; + Memo1: TMemo; + private + { private declarations } + public + { public declarations } + end; + +var + FFTFrm: TFFTFrm; + +implementation + +initialization + {$I fftunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/FFTUNIT.lfm b/applications/lazstats/source_orig/FFTUNIT.lfm new file mode 100644 index 000000000..61d323839 --- /dev/null +++ b/applications/lazstats/source_orig/FFTUNIT.lfm @@ -0,0 +1,54 @@ +object FFTFrm: TFFTFrm + Left = 192 + Height = 138 + Top = 136 + Width = 232 + Caption = 'Fourier Transform Form' + ClientHeight = 138 + ClientWidth = 232 + LCLVersion = '0.9.28.2' + object Label1: TLabel + Left = 8 + Height = 14 + Top = 72 + Width = 90 + Caption = 'Number of points: ' + ParentColor = False + end + object Memo1: TMemo + Left = 7 + Height = 44 + Top = 8 + Width = 209 + Lines.Strings = ( + 'Enter the number of data points to ' + 'include in the Fourier smoothing.' + ) + TabOrder = 0 + end + object NptsEdit: TEdit + Left = 104 + Height = 21 + Top = 62 + Width = 45 + TabOrder = 1 + end + object CancelBtn: TButton + Left = 7 + Height = 29 + Top = 97 + Width = 70 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 2 + end + object OKBtn: TButton + Left = 112 + Height = 29 + Top = 97 + Width = 70 + Caption = 'OK' + ModalResult = 1 + TabOrder = 3 + end +end diff --git a/applications/lazstats/source_orig/FFTUNIT.lrs b/applications/lazstats/source_orig/FFTUNIT.lrs new file mode 100644 index 000000000..8b1f3caf7 --- /dev/null +++ b/applications/lazstats/source_orig/FFTUNIT.lrs @@ -0,0 +1,16 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TFFTFrm','FORMDATA',[ + 'TPF0'#7'TFFTFrm'#6'FFTFrm'#4'Left'#3#192#0#6'Height'#3#138#0#3'Top'#3#136#0#5 + +'Width'#3#232#0#7'Caption'#6#22'Fourier Transform Form'#12'ClientHeight'#3 + +#138#0#11'ClientWidth'#3#232#0#10'LCLVersion'#6#8'0.9.28.2'#0#6'TLabel'#6'La' + +'bel1'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'H'#5'Width'#2'Z'#7'Caption'#6#18 + +'Number of points: '#11'ParentColor'#8#0#0#5'TMemo'#5'Memo1'#4'Left'#2#7#6'H' + +'eight'#2','#3'Top'#2#8#5'Width'#3#209#0#13'Lines.Strings'#1#6'#Enter the nu' + +'mber of data points to '#6'!include in the Fourier smoothing.'#0#8'TabOrder' + +#2#0#0#0#5'TEdit'#8'NptsEdit'#4'Left'#2'h'#6'Height'#2#21#3'Top'#2'>'#5'Widt' + +'h'#2'-'#8'TabOrder'#2#1#0#0#7'TButton'#9'CancelBtn'#4'Left'#2#7#6'Height'#2 + +#29#3'Top'#2'a'#5'Width'#2'F'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'T' + +'abOrder'#2#2#0#0#7'TButton'#5'OKBtn'#4'Left'#2'p'#6'Height'#2#29#3'Top'#2'a' + +#5'Width'#2'F'#7'Caption'#6#2'OK'#11'ModalResult'#2#1#8'TabOrder'#2#3#0#0#0 +]); diff --git a/applications/lazstats/source_orig/FILEEXTRACTUNIT.PAS b/applications/lazstats/source_orig/FILEEXTRACTUNIT.PAS new file mode 100644 index 000000000..3cf2e935b --- /dev/null +++ b/applications/lazstats/source_orig/FILEEXTRACTUNIT.PAS @@ -0,0 +1,447 @@ +unit FileExtractUnit; + +{$MODE Delphi} + +interface + +uses + LCLIntf, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, + StdCtrls, Grids, ExtCtrls, GLOBALS, OS3MainUnit, DATAPROCS, DICTIONARYUNIT, + LResources, Buttons; + +type + TFileExtractFrm = class(TForm) + Memo1: TMemo; + Label2: TLabel; + NoLinesEdit: TEdit; + Label3: TLabel; + NoFieldsEdit: TEdit; + FormatGrp: TRadioGroup; + Label4: TLabel; + KeyVarNoEdit: TEdit; + Label5: TLabel; + ValueEdit: TEdit; + LabelsChk: TCheckBox; + FmtGrid: TStringGrid; + CancelBtn: TButton; + OKBtn: TButton; + ResetBtn: TButton; + ExtractBtn: TButton; + OpenDialog1: TOpenDialog; + FileSelBtn: TButton; + Label1: TLabel; + NoGotEdit: TEdit; + Label6: TLabel; + RecdReadEdit: TEdit; + TypeBox: TComboBox; + procedure ResetBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure CancelBtnClick(Sender: TObject); + procedure FormatGrpClick(Sender: TObject); + procedure OKBtnClick(Sender: TObject); + procedure ExtractBtnClick(Sender: TObject); + procedure FileSelBtnClick(Sender: TObject); + procedure TypeBoxChange(Sender: TObject); + private + { Private declarations } + FileName : string; + + public + { Public declarations } + function GetValues(VAR TheFile : TextFile; + NoLines : integer; + NoFlds : integer; + Token : integer; + VAR StrValues : StrDyneVec) : boolean; + procedure PutGrid(RecdNo : integer; + NoFlds : integer; + LabelsFirst : boolean; + VAR StrValues : StrDyneVec); + function GetFmtValues(VAR TheFile : TextFile; + NoLines : integer; + NoFlds : integer; + VAR StrValues : StrDyneVec) : boolean; + end; + +var + FileExtractFrm: TFileExtractFrm; + +implementation + + +procedure TFileExtractFrm.ResetBtnClick(Sender: TObject); +begin + NoLinesEdit.Text := '1'; + NoFieldsEdit.Text := ''; + KeyVarNoEdit.Text := ''; + ValueEdit.Text := ''; + NoGotEdit.Text := ''; + RecdReadEdit.Text := ''; + FormatGrp.ItemIndex := 0; + LabelsChk.Checked := false; + FmtGrid.Cells[0,0] := 'Field'; + FmtGrid.Cells[1,0] := 'Start'; + FmtGrid.Cells[2,0] := 'End'; + FmtGrid.Cells[3,0] := 'Data Type'; + FmtGrid.Cells[4,0] := 'Line No.'; + FmtGrid.Cells[5,0] := 'Label'; + FmtGrid.Visible := false; + TypeBox.Text := 'Types'; + TypeBox.Visible := false; +end; +//-------------------------------------------------------- + +procedure TFileExtractFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; +//--------------------------------------------------------- + +procedure TFileExtractFrm.CancelBtnClick(Sender: TObject); +begin + FileExtractFrm.Hide; +end; +//-------------------------------------------------------------- + +procedure TFileExtractFrm.FormatGrpClick(Sender: TObject); +begin + if FormatGrp.ItemIndex = 3 then + begin + FmtGrid.RowCount := StrToInt(NoFieldsEdit.Text) + 1; + FmtGrid.Visible := true; + TypeBox.Visible := true; + end + else begin + FmtGrid.Visible := false; + TypeBox.Visible := false; + end; +end; +//------------------------------------------------------------- + +procedure TFileExtractFrm.OKBtnClick(Sender: TObject); +begin + FileExtractFrm.Hide; +end; +//--------------------------------------------------------------------- + +function TFileExtractFrm.GetValues(VAR TheFile : TextFile; + NoLines : integer; + NoFlds : integer; + Token : integer; + VAR StrValues : StrDyneVec) : boolean; +var + done, endline : boolean; + i, valcount : integer; + cellstring : string; + achar : char; + +begin + done := false; + valcount := 0; + + if not done then + begin + for i := 1 to NoLines do + begin + endline := false; + while not endline do + begin + read(TheFile,achar); + if EOF(TheFile) then + begin + done := true; + GetValues := done; + exit; + end; + if ord(achar) = 10 then continue; // ignore line feed + if ord(achar) <> 13 then // not a new line + begin + if ord(achar) <> Token then // not a tab character + cellstring := cellstring + achar + else + begin // Token character found - save string and bump counter + StrValues[valcount] := cellstring; + cellstring := ''; + valcount := valcount + 1; + end; + end // not a new line - tab or character found + else begin + endline := true; + StrValues[valcount] := cellstring; + valcount := valcount + 1; + cellstring := ''; + end; + end; // next line + end; // next line + end // net yet at eof + else done := true; + if valcount <> NoFlds then + begin + ShowMessage('ERROR! Mismatched no. fields - see grid for first record'); + FmtGrid.ColCount := valcount + 1; + FmtGrid.Visible := true; + for i := 1 to NoFlds do + FmtGrid.Cells[i-1,0] := StrValues[i-1]; + done := true; + end; + GetValues := done; +end; +//--------------------------------------------------------------------- + +procedure TFileExtractFrm.PutGrid(RecdNo : integer; + NoFlds : integer; + LabelsFirst : boolean; + VAR StrValues : StrDyneVec); +var + i : integer; + cellstring : string; + +begin + if LabelsFirst = true then + begin + OS3MainFrm.DataGrid.RowCount := 2; + OS3MainFrm.DataGrid.Cells[0,0] := 'Case 0'; + for i := 1 to NoFlds do OS3MainFrm.DataGrid.Cells[i,0] := StrValues[i-1]; + end + else + begin + OS3MainFrm.DataGrid.RowCount := RecdNo + 1; + cellstring := 'Case ' + IntToStr(RecdNo); + OS3MainFrm.DataGrid.Cells[0,RecdNo] := cellstring; + for i := 1 to NoFlds do OS3MainFrm.DataGrid.Cells[i,RecdNo] := StrValues[i-1]; + end; +end; +//--------------------------------------------------------------------- + +procedure TFileExtractFrm.ExtractBtnClick(Sender: TObject); +var + LabelsFirst : boolean; // first record contains variable labels + NoFlds : integer; // number of variables + NoLines : integer; // number of lines per record + FormatType : integer; // 1 = tab, 2 = comma, 3 = space, 4 = user spec. + KeyNo : integer; // sequence number of field containing the key + KeyValue : string; // value of the key field + TheFile : TextFile; // file handle + StrValues : StrDyneVec; // pointer to array of strings for record values + done : boolean; + NoRecords : integer; + Token : integer; // tab, comma or space charcter ordinal value + i, fldno : integer; + OldCursor : Tcursor; + NoRead : integer; // no. of records read from big file + fldtype : string; + cellstring : string; // for labels provided in the fmtgrid + +begin + // get entered values from the form + if LabelsChk.Checked then LabelsFirst := true else LabelsFirst := false; + NoFlds := StrToInt(NoFieldsEdit.Text); + NoLines := StrToInt(NoLinesEdit.Text); + FormatType := FormatGrp.ItemIndex + 1; + KeyNo := StrToInt(KeyVarNoEdit.Text); + KeyValue := ValueEdit.Text; + SetLength(StrValues,NoFlds + 1); + done := false; + NoRecords := 0; + Token := ord(' '); // default of a space + OldCursor := FileExtractFrm.Cursor; + NoRead := 0; + OS3MainFrm.DataGrid.ColCount := NoFlds + 1; + for i := 1 to NoFlds do + begin + DictionaryFrm.DictGrid.RowCount := i; + DictionaryFrm.Defaults(Self,i); + VarDefined[i] := true; + end; + + // open file for processing + AssignFile(TheFile,FileName); + Reset(TheFile); + + // process first (or second) record according to format type + case FormatType of + 1, 2, 3 : begin // tab seperated fields + FileExtractFrm.Cursor := crHourGlass; + if not LabelsFirst then + begin + // store labels (if not blank) into grid row 0 and type in defs. + for i := 1 to NoFlds do + begin + cellstring := format('VAR%2d',[i]); + OS3MainFrm.DataGrid.Cells[i,0] := cellstring; + end; + end; + while Not done do + begin + if FormatType = 1 then Token := 9; // tab character + if FormatType = 2 then Token := ord(','); // comma + if FormatType = 3 then Token := ord(' '); // space + done := GetValues(TheFile,NoLines,NoFlds,Token,StrValues); + if not done then + begin + NoRead := NoRead + 1; + if LabelsFirst then + begin + PutGrid(0,NoFlds,LabelsFirst,StrValues); + LabelsFirst := false; + end; + RecdReadEdit.Text := IntToStr(NoRead); + FileExtractFrm.Repaint; + StrValues[KeyNo-1] := Trim(StrValues[KeyNo-1]); + if StrValues[KeyNo-1] = KeyValue then // found group record + begin + NoRecords := NoRecords + 1; + PutGrid(NoRecords,NoFlds,LabelsFirst,StrValues); + NoGotEdit.Text := IntToStr(NoRecords); + end; + end; + end; + FileExtractFrm.Cursor := OldCursor; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoRecords); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoFlds); + OS3MainFrm.RowEdit.Text := '1'; + OS3MainFrm.ColEdit.Text := '1'; + OS3MainFrm.DataGrid.Row := 1; + OS3MainFrm.DataGrid.Col := 1; + NoVariables := NoFlds; + NoCases := NoRecords; + end; + 4 : begin // user specified format + FileExtractFrm.Cursor := crHourGlass; + if not LabelsFirst then + begin + // store labels (if not blank) into grid row 0 and type in defs. + for i := 1 to NoFlds do + begin + fldno := StrToInt(FmtGrid.Cells[0,i]); + fldtype := FmtGrid.Cells[3,fldno]; + DictionaryFrm.DictGrid.Cells[4,fldno] := fldtype[2]; + cellstring := FmtGrid.Cells[5,fldno]; + DictionaryFrm.DictGrid.Cells[1,fldno] := cellstring; + DictionaryFrm.DictGrid.Cells[2,fldno] := cellstring; + if cellstring <> '' then OS3MainFrm.DataGrid.Cells[i,0] := cellstring; + end; + end; + while NOT done do + begin + done := GetFmtValues(TheFile,NoLines,NoFlds,StrValues); + if not done then + begin + NoRead := NoRead + 1; + if LabelsFirst then + begin + PutGrid(0,NoFlds,LabelsFirst,StrValues); + LabelsFirst := false; + end; + RecdReadEdit.Text := IntToStr(NoRead); + FileExtractFrm.Repaint; + StrValues[KeyNo-1] := Trim(StrValues[KeyNo-1]); + if StrValues[KeyNo-1] = KeyValue then // found group record + begin + NoRecords := NoRecords + 1; + PutGrid(NoRecords,NoFlds,LabelsFirst,StrValues); + NoGotEdit.Text := IntToStr(NoRecords); + end; + end; // if not done + end; // while not done + FileExtractFrm.Cursor := OldCursor; + OS3MainFrm.NoCasesEdit.Text := IntToStr(NoRecords); + OS3MainFrm.NoVarsEdit.Text := IntToStr(NoFlds); + OS3MainFrm.RowEdit.Text := '1'; + OS3MainFrm.ColEdit.Text := '1'; + OS3MainFrm.DataGrid.Row := 1; + OS3MainFrm.DataGrid.Col := 1; + NoVariables := NoFlds; + NoCases := NoRecords; + end; // end case 4 (formatted input) + end; // end case switch + StrValues := nil; + CloseFile(TheFile); +end; +//------------------------------------------------------------------------ + +procedure TFileExtractFrm.FileSelBtnClick(Sender: TObject); +begin + OpenDialog1.Filter := 'Tab field files (*.tab)|*.TAB|Text files (*.txt)|*.TXT|All files (*.*)|*.*'; + OpenDialog1.FilterIndex := 1; + OpenDialog1.DefaultExt := 'TAB'; + if OpenDialog1.Execute then FileName := OpenDialog1.FileName + else ShowMessage('Error in opening File!'); +end; +//------------------------------------------------------------------------- + +function TFileExtractFrm.GetFmtValues(VAR TheFile : TextFile; + NoLines : integer; + NoFlds : integer; + VAR StrValues : StrDyneVec) : boolean; +var + done, endline : boolean; + i, j, endat, startat, stlong, valcount, fldno : integer; + LineStr : string; + achar : char; + +begin + done := false; + valcount := 0; + + if not done then + begin + for i := 1 to NoLines do + begin + endline := false; + while not endline do + begin + read(TheFile,achar); + if EOF(TheFile) then + begin + done := true; + GetFmtValues := done; + exit; + end; + if ord(achar) = 10 then continue; // ignore line feed + if ord(achar) <> 13 then LineStr := LineStr + achar + else endline := true; + end; + // now, parse values in this line + for j := 1 to NoFlds do + begin + if StrToInt(FmtGrid.Cells[4,j]) <> i then continue; // in line i? + startat := StrToInt(FmtGrid.Cells[1,j]); + endat := StrToInt(FmtGrid.Cells[2,j]); + stlong := endat - startat + 1; + fldno := StrToInt(FmtGrid.Cells[0,j]); + StrValues[fldno-1] := Copy(LineStr,startat,stlong); + valcount := valcount + 1; + end; // next j + LineStr := ''; + end; // next line + end // not yet at eof + else done := true; + if valcount <> NoFlds then + begin + ShowMessage('ERROR! Mismatched no. fields and actual record data.'); + done := true; + end; + GetFmtValues := done; +end; +//----------------------------------------------------------------------- + +procedure TFileExtractFrm.TypeBoxChange(Sender: TObject); +var + index : integer; + row, col : integer; + +begin + index := TypeBox.ItemIndex; + row := FmtGrid.Row; + col := FmtGrid.Col; + FmtGrid.Cells[col,row] := IntToStr(index); +end; + +//------------------------------------------------------------------------- + +initialization + {$i FILEEXTRACTUNIT.lrs} + {$i FILEEXTRACTUNIT.lrs} + +end. diff --git a/applications/lazstats/source_orig/FILEEXTRACTUNIT.lfm b/applications/lazstats/source_orig/FILEEXTRACTUNIT.lfm new file mode 100644 index 000000000..3843101ca --- /dev/null +++ b/applications/lazstats/source_orig/FILEEXTRACTUNIT.lfm @@ -0,0 +1,255 @@ +object FileExtractFrm: TFileExtractFrm + Left = 160 + Height = 509 + Top = 713 + Width = 435 + HelpContext = 406 + HorzScrollBar.Page = 434 + VertScrollBar.Page = 508 + ActiveControl = NoFieldsEdit + Caption = 'File Extraction Procedure' + Font.Height = -11 + Font.Name = 'MS Sans Serif' + HelpFile = 'OS2Help.hlp' + OnShow = FormShow + object Label2: TLabel + Left = 8 + Height = 14 + Top = 152 + Width = 132 + Caption = 'Number of lines per record:' + Color = clNone + ParentColor = False + end + object Label3: TLabel + Left = 224 + Height = 14 + Top = 152 + Width = 170 + Caption = 'No. of fields (variables) per record:' + Color = clNone + ParentColor = False + end + object Label4: TLabel + Left = 8 + Height = 14 + Top = 176 + Width = 192 + Caption = 'Sequence number of key selection field:' + Color = clNone + ParentColor = False + end + object Label5: TLabel + Left = 8 + Height = 40 + Top = 200 + Width = 76 + Caption = 'Selection Value (Including Dec. Fraction):' + Color = clNone + ParentColor = False + WordWrap = True + end + object Label1: TLabel + Left = 272 + Height = 14 + Top = 424 + Width = 94 + Caption = 'Records Retrieved:' + Color = clNone + ParentColor = False + end + object Label6: TLabel + Left = 8 + Height = 14 + Top = 424 + Width = 96 + Caption = 'Records Processed:' + Color = clNone + ParentColor = False + end + object Memo1: TMemo + Left = 24 + Height = 113 + Width = 377 + Lines.Strings = ( + 'This procedure is used to extract records from files too large to read directly ' + 'into the data grid. The data grid can hold about 100,000 records. If your file' + 'is larger but you will not be processing all records, you may extract sub-groups' + 'of records using a "key" field, e.g. a group identification number. The records' + 'extracted will be placed into the data grid as if you had entered them via the' + 'keyboard. You may then save the sub-file, process it, etc. as any other file. If' + 'you have multiple groups to extract, repeat pressing the Extract button until all' + 'sub-files you need are placed into the data grid. Press return to continue.' + ) + TabOrder = 4 + end + object NoLinesEdit: TEdit + Left = 144 + Height = 21 + Top = 152 + Width = 25 + TabOrder = 5 + end + object NoFieldsEdit: TEdit + Left = 392 + Height = 21 + Top = 152 + Width = 25 + TabOrder = 0 + end + object FormatGrp: TRadioGroup + Left = 272 + Height = 81 + Top = 176 + Width = 145 + AutoFill = True + Caption = 'Record Format:' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + Items.Strings = ( + 'Tab seperated fields' + 'comma seperated fields' + 'space seperated fields' + 'User specified format' + ) + OnClick = FormatGrpClick + TabOrder = 3 + end + object KeyVarNoEdit: TEdit + Left = 200 + Height = 21 + Top = 176 + Width = 25 + TabOrder = 1 + end + object ValueEdit: TEdit + Left = 112 + Height = 21 + Top = 208 + Width = 113 + TabOrder = 2 + end + object LabelsChk: TCheckBox + Left = 8 + Height = 13 + Top = 248 + Width = 207 + Caption = 'The first record contains variable labels.' + TabOrder = 6 + end + object FmtGrid: TStringGrid + Left = 8 + Height = 121 + Top = 296 + Width = 409 + ColCount = 6 + FixedColor = clBtnFace + FixedCols = 0 + FixedRows = 0 + GridLineWidth = 0 + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColMoving, goEditing, goTabs] + RowCount = 5 + ScrollBars = ssAutoBoth + TabOrder = 7 + TabStop = True + end + object CancelBtn: TButton + Left = 160 + Height = 25 + Top = 448 + Width = 57 + BorderSpacing.InnerBorder = 4 + Caption = 'Cancel' + ModalResult = 2 + OnClick = CancelBtnClick + TabOrder = 8 + end + object OKBtn: TButton + Left = 360 + Height = 25 + Top = 448 + Width = 57 + BorderSpacing.InnerBorder = 4 + Caption = 'Return' + ModalResult = 1 + OnClick = OKBtnClick + TabOrder = 9 + end + object ResetBtn: TButton + Left = 224 + Height = 25 + Top = 448 + Width = 57 + BorderSpacing.InnerBorder = 4 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 10 + end + object ExtractBtn: TButton + Left = 288 + Height = 25 + Top = 448 + Width = 65 + BorderSpacing.InnerBorder = 4 + Caption = 'Extract' + OnClick = ExtractBtnClick + TabOrder = 11 + end + object FileSelBtn: TButton + Left = 8 + Height = 25 + Top = 120 + Width = 201 + BorderSpacing.InnerBorder = 4 + Caption = 'Press to Select a Huge File for Extraction' + OnClick = FileSelBtnClick + TabOrder = 12 + end + object NoGotEdit: TEdit + Left = 368 + Height = 21 + Top = 424 + Width = 49 + TabOrder = 13 + Text = 'NoGotEdit' + end + object RecdReadEdit: TEdit + Left = 104 + Height = 21 + Top = 424 + Width = 65 + TabOrder = 14 + Text = 'RecdReadEdit' + end + object TypeBox: TComboBox + Left = 208 + Height = 21 + Top = 272 + Width = 57 + AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending] + ItemHeight = 13 + Items.Strings = ( + '(I)nteger' + '(F)loating point' + '(S)tring' + '(M)oney' + '(D)ate' + ) + MaxLength = 0 + OnChange = TypeBoxChange + TabOrder = 15 + Text = 'Type' + end + object OpenDialog1: TOpenDialog + Title = 'Open existing file' + FilterIndex = 0 + left = 240 + top = 192 + end +end diff --git a/applications/lazstats/source_orig/FILEEXTRACTUNIT.lrs b/applications/lazstats/source_orig/FILEEXTRACTUNIT.lrs new file mode 100644 index 000000000..332bbb519 --- /dev/null +++ b/applications/lazstats/source_orig/FILEEXTRACTUNIT.lrs @@ -0,0 +1,80 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TFileExtractFrm','FORMDATA',[ + 'TPF0'#15'TFileExtractFrm'#14'FileExtractFrm'#4'Left'#3#160#0#6'Height'#3#253 + +#1#3'Top'#3#201#2#5'Width'#3#179#1#11'HelpContext'#3#150#1#18'HorzScrollBar.' + +'Page'#3#178#1#18'VertScrollBar.Page'#3#252#1#13'ActiveControl'#7#12'NoField' + +'sEdit'#7'Caption'#6#25'File Extraction Procedure'#11'Font.Height'#2#245#9'F' + +'ont.Name'#6#13'MS Sans Serif'#8'HelpFile'#6#11'OS2Help.hlp'#6'OnShow'#7#8'F' + +'ormShow'#0#6'TLabel'#6'Label2'#4'Left'#2#8#6'Height'#2#14#3'Top'#3#152#0#5 + +'Width'#3#132#0#7'Caption'#6#27'Number of lines per record:'#5'Color'#7#6'cl' + +'None'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#3#224#0#6'Height'#2 + +#14#3'Top'#3#152#0#5'Width'#3#170#0#7'Caption'#6'%No. of fields (variables) ' + +'per record:'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4' + +#4'Left'#2#8#6'Height'#2#14#3'Top'#3#176#0#5'Width'#3#192#0#7'Caption'#6'''S' + +'equence number of key selection field:'#5'Color'#7#6'clNone'#11'ParentColor' + +#8#0#0#6'TLabel'#6'Label5'#4'Left'#2#8#6'Height'#2'('#3'Top'#3#200#0#5'Width' + +#2'L'#7'Caption'#6'*Selection Value (Including Dec. Fraction):'#5'Color'#7#6 + +'clNone'#11'ParentColor'#8#8'WordWrap'#9#0#0#6'TLabel'#6'Label1'#4'Left'#3#16 + +#1#6'Height'#2#14#3'Top'#3#168#1#5'Width'#2'^'#7'Caption'#6#18'Records Retri' + +'eved:'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#6'Label6'#4'Lef' + +'t'#2#8#6'Height'#2#14#3'Top'#3#168#1#5'Width'#2'`'#7'Caption'#6#18'Records ' + +'Processed:'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#5'TMemo'#5'Memo1'#4 + +'Left'#2#24#6'Height'#2'q'#5'Width'#3'y'#1#13'Lines.Strings'#1#6'PThis proce' + +'dure is used to extract records from files too large to read directly '#6'P' + +'into the data grid. The data grid can hold about 100,000 records. If your' + +' file'#6'Pis larger but you will not be processing all records, you may ext' + +'ract sub-groups'#6'Pof records using a "key" field, e.g. a group identifica' + +'tion number. The records'#6'Nextracted will be placed into the data grid a' + +'s if you had entered them via the'#6'Rkeyboard. You may then save the sub-' + +'file, process it, etc. as any other file. If'#6'Qyou have multiple groups ' + +'to extract, repeat pressing the Extract button until all'#6'Lsub-files you ' + +'need are placed into the data grid. Press return to continue.'#0#8'TabOrde' + +'r'#2#4#0#0#5'TEdit'#11'NoLinesEdit'#4'Left'#3#144#0#6'Height'#2#21#3'Top'#3 + +#152#0#5'Width'#2#25#8'TabOrder'#2#5#0#0#5'TEdit'#12'NoFieldsEdit'#4'Left'#3 + +#136#1#6'Height'#2#21#3'Top'#3#152#0#5'Width'#2#25#8'TabOrder'#2#0#0#0#11'TR' + +'adioGroup'#9'FormatGrp'#4'Left'#3#16#1#6'Height'#2'Q'#3'Top'#3#176#0#5'Widt' + +'h'#3#145#0#8'AutoFill'#9#7'Caption'#6#14'Record Format:'#28'ChildSizing.Lef' + +'tRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.Enla' + +'rgeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertica' + +'l'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crs' + +'ScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSi' + +'zing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPer' + +'Line'#2#1#13'Items.Strings'#1#6#20'Tab seperated fields'#6#22'comma seperat' + +'ed fields'#6#22'space seperated fields'#6#21'User specified format'#0#7'OnC' + +'lick'#7#14'FormatGrpClick'#8'TabOrder'#2#3#0#0#5'TEdit'#12'KeyVarNoEdit'#4 + +'Left'#3#200#0#6'Height'#2#21#3'Top'#3#176#0#5'Width'#2#25#8'TabOrder'#2#1#0 + +#0#5'TEdit'#9'ValueEdit'#4'Left'#2'p'#6'Height'#2#21#3'Top'#3#208#0#5'Width' + +#2'q'#8'TabOrder'#2#2#0#0#9'TCheckBox'#9'LabelsChk'#4'Left'#2#8#6'Height'#2 + +#13#3'Top'#3#248#0#5'Width'#3#207#0#7'Caption'#6'*The first record contains ' + +'variable labels.'#8'TabOrder'#2#6#0#0#11'TStringGrid'#7'FmtGrid'#4'Left'#2#8 + +#6'Height'#2'y'#3'Top'#3'('#1#5'Width'#3#153#1#8'ColCount'#2#6#10'FixedColor' + +#7#9'clBtnFace'#9'FixedCols'#2#0#9'FixedRows'#2#0#13'GridLineWidth'#2#0#7'Op' + +'tions'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goHorzL' + +'ine'#11'goColMoving'#9'goEditing'#6'goTabs'#0#8'RowCount'#2#5#10'ScrollBars' + +#7#10'ssAutoBoth'#8'TabOrder'#2#7#7'TabStop'#9#0#0#7'TButton'#9'CancelBtn'#4 + +'Left'#3#160#0#6'Height'#2#25#3'Top'#3#192#1#5'Width'#2'9'#25'BorderSpacing.' + +'InnerBorder'#2#4#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#7'OnClick'#7#14 + +'CancelBtnClick'#8'TabOrder'#2#8#0#0#7'TButton'#5'OKBtn'#4'Left'#3'h'#1#6'He' + +'ight'#2#25#3'Top'#3#192#1#5'Width'#2'9'#25'BorderSpacing.InnerBorder'#2#4#7 + +'Caption'#6#6'Return'#11'ModalResult'#2#1#7'OnClick'#7#10'OKBtnClick'#8'TabO' + +'rder'#2#9#0#0#7'TButton'#8'ResetBtn'#4'Left'#3#224#0#6'Height'#2#25#3'Top'#3 + +#192#1#5'Width'#2'9'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#5'Reset' + +#7'OnClick'#7#13'ResetBtnClick'#8'TabOrder'#2#10#0#0#7'TButton'#10'ExtractBt' + +'n'#4'Left'#3' '#1#6'Height'#2#25#3'Top'#3#192#1#5'Width'#2'A'#25'BorderSpac' + +'ing.InnerBorder'#2#4#7'Caption'#6#7'Extract'#7'OnClick'#7#15'ExtractBtnClic' + +'k'#8'TabOrder'#2#11#0#0#7'TButton'#10'FileSelBtn'#4'Left'#2#8#6'Height'#2#25 + +#3'Top'#2'x'#5'Width'#3#201#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6 + ,'*Press to Select a Huge File for Extraction'#7'OnClick'#7#15'FileSelBtnClic' + +'k'#8'TabOrder'#2#12#0#0#5'TEdit'#9'NoGotEdit'#4'Left'#3'p'#1#6'Height'#2#21 + +#3'Top'#3#168#1#5'Width'#2'1'#8'TabOrder'#2#13#4'Text'#6#9'NoGotEdit'#0#0#5 + +'TEdit'#12'RecdReadEdit'#4'Left'#2'h'#6'Height'#2#21#3'Top'#3#168#1#5'Width' + +#2'A'#8'TabOrder'#2#14#4'Text'#6#12'RecdReadEdit'#0#0#9'TComboBox'#7'TypeBox' + +#4'Left'#3#208#0#6'Height'#2#21#3'Top'#3#16#1#5'Width'#2'9'#16'AutoCompleteT' + +'ext'#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#10'ItemHeight' + +#2#13#13'Items.Strings'#1#6#9'(I)nteger'#6#16'(F)loating point'#6#8'(S)tring' + +#6#7'(M)oney'#6#6'(D)ate'#0#9'MaxLength'#2#0#8'OnChange'#7#13'TypeBoxChange' + +#8'TabOrder'#2#15#4'Text'#6#4'Type'#0#0#11'TOpenDialog'#11'OpenDialog1'#5'Ti' + +'tle'#6#18'Open existing file'#11'FilterIndex'#2#0#4'left'#3#240#0#3'top'#3 + +#192#0#0#0#0 +]); diff --git a/applications/lazstats/source_orig/equationunit.lfm b/applications/lazstats/source_orig/equationunit.lfm new file mode 100644 index 000000000..4787f0e64 --- /dev/null +++ b/applications/lazstats/source_orig/equationunit.lfm @@ -0,0 +1,191 @@ +object EquationForm: TEquationForm + Left = 244 + Height = 396 + Top = 138 + Width = 592 + Caption = 'Equation Editor' + ClientHeight = 396 + ClientWidth = 592 + OnShow = ResetBtnClick + LCLVersion = '0.9.30' + object Memo1: TMemo + Left = 7 + Height = 184 + Top = 8 + Width = 569 + Lines.Strings = ( + 'You can create a new variable as a combination of other existing variables with this procedure.' + 'First, enter the name of the new variable in the area labeled "New Variable".' + 'Next, enter up to three values for each entry in your equation by selecting an operation, function or' + 'variable from the "drop-down" boxes. You can select:' + '(a) An operation code (+,-,* or /) except for the first one which should be a function or variable name.' + '(b) A function such as sin, cos, sqrt, etc. can be entered first followed by the variable to be acted upon.' + '(c) A variable name from the list of available variables in the drop-down list of variables.' + '(d) For each variable to be entered, click the "Next Entry" button. Following the first entry, an ' + ' operation code must be the first entry.' + 'When done, click the "Finished" button followed by a click of the "Compute button". An image of the' + 'completed function will be displayed before the new values are created.' + ) + TabOrder = 0 + end + object Label1: TLabel + Left = 8 + Height = 16 + Top = 250 + Width = 108 + Caption = 'New Variable Name:' + ParentColor = False + end + object NewVarEdit: TEdit + Left = 8 + Height = 23 + Top = 275 + Width = 127 + TabOrder = 1 + Text = 'NewVarEdit' + end + object Label2: TLabel + Left = 145 + Height = 16 + Top = 278 + Width = 9 + Caption = '=' + ParentColor = False + end + object OpEdit: TEdit + Left = 161 + Height = 23 + Top = 275 + Width = 96 + TabOrder = 2 + Text = 'OpEdit' + end + object FuncEdit: TEdit + Left = 265 + Height = 23 + Top = 275 + Width = 136 + TabOrder = 3 + Text = 'FuncEdit' + end + object VarEdit: TEdit + Left = 409 + Height = 23 + Top = 275 + Width = 168 + TabOrder = 4 + Text = 'VarEdit' + end + object OpsCombo: TComboBox + Left = 162 + Height = 23 + Top = 227 + Width = 94 + AutoDropDown = True + ItemHeight = 15 + Items.Strings = ( + '+' + '-' + '*' + '/' + '' + ) + OnClick = OpsComboClick + OnSelect = OpsComboSelect + TabOrder = 5 + end + object FunctionCombo: TComboBox + Left = 265 + Height = 23 + Top = 226 + Width = 134 + AutoDropDown = True + ItemHeight = 15 + Items.Strings = ( + 'sqr' + 'sqrt' + 'sin' + 'cos' + 'tan' + 'asin' + 'acos' + 'atan' + 'log10' + 'ln' + 'exp' + '1 / X' + '' + ) + OnClick = FunctionComboClick + OnSelect = FunctionComboSelect + TabOrder = 6 + end + object VarCombo: TComboBox + Left = 407 + Height = 23 + Top = 224 + Width = 169 + AutoDropDown = True + ItemHeight = 15 + OnClick = VarComboClick + OnSelect = VarComboSelect + TabOrder = 7 + Text = 'VarCombo' + end + object ResetBtn: TButton + Left = 10 + Height = 32 + Top = 354 + Width = 87 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 8 + end + object CancelBtn: TButton + Left = 161 + Height = 32 + Top = 354 + Width = 87 + Caption = 'Cancel' + ModalResult = 2 + OnClick = CancelBtnClick + TabOrder = 9 + end + object ComputeBtn: TButton + Left = 312 + Height = 32 + Top = 354 + Width = 87 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 10 + end + object ReturnBnt: TButton + Left = 489 + Height = 32 + Top = 354 + Width = 87 + Caption = 'Return' + ModalResult = 1 + OnClick = ReturnBntClick + TabOrder = 11 + end + object NextBtn: TButton + Left = 115 + Height = 29 + Top = 313 + Width = 140 + Caption = 'Continue for next entry' + OnClick = NextBtnClick + TabOrder = 12 + end + object FinishedBtn: TButton + Left = 297 + Height = 29 + Top = 312 + Width = 132 + Caption = 'Finished' + OnClick = FinishedBtnClick + TabOrder = 13 + end +end diff --git a/applications/lazstats/source_orig/equationunit.lrs b/applications/lazstats/source_orig/equationunit.lrs new file mode 100644 index 000000000..039c02002 --- /dev/null +++ b/applications/lazstats/source_orig/equationunit.lrs @@ -0,0 +1,57 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TEquationForm','FORMDATA',[ + 'TPF0'#13'TEquationForm'#12'EquationForm'#4'Left'#3#244#0#6'Height'#3#140#1#3 + +'Top'#3#138#0#5'Width'#3'P'#2#7'Caption'#6#15'Equation Editor'#12'ClientHeig' + +'ht'#3#140#1#11'ClientWidth'#3'P'#2#6'OnShow'#7#13'ResetBtnClick'#10'LCLVers' + +'ion'#6#6'0.9.30'#0#5'TMemo'#5'Memo1'#4'Left'#2#7#6'Height'#3#184#0#3'Top'#2 + +#8#5'Width'#3'9'#2#13'Lines.Strings'#1#6'_You can create a new variable as a' + +' combination of other existing variables with this procedure.'#6'MFirst, en' + +'ter the name of the new variable in the area labeled "New Variable".'#6'eNe' + +'xt, enter up to three values for each entry in your equation by selecting a' + +'n operation, function or'#6'6variable from the "drop-down" boxes. You can' + +' select:'#6'j(a) An operation code (+,-,* or /) except for the first one ' + +'which should be a function or variable name.'#6'm(b) A function such as s' + +'in, cos, sqrt, etc. can be entered first followed by the variable to be act' + +'ed upon.'#6'^(c) A variable name from the list of available variables in ' + +'the drop-down list of variables.'#6'e(d) For each variable to be entered,' + +' click the "Next Entry" button. Following the first entry, an '#6'/ ' + +' operation code must be the first entry.'#6'dWhen done, click the "Finished' + +'" button followed by a click of the "Compute button". An image of the'#6'G' + +'completed function will be displayed before the new values are created.'#0#8 + +'TabOrder'#2#0#0#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#16#3'Top'#3 + +#250#0#5'Width'#2'l'#7'Caption'#6#18'New Variable Name:'#11'ParentColor'#8#0 + +#0#5'TEdit'#10'NewVarEdit'#4'Left'#2#8#6'Height'#2#23#3'Top'#3#19#1#5'Width' + +#2#127#8'TabOrder'#2#1#4'Text'#6#10'NewVarEdit'#0#0#6'TLabel'#6'Label2'#4'Le' + +'ft'#3#145#0#6'Height'#2#16#3'Top'#3#22#1#5'Width'#2#9#7'Caption'#6#1'='#11 + +'ParentColor'#8#0#0#5'TEdit'#6'OpEdit'#4'Left'#3#161#0#6'Height'#2#23#3'Top' + +#3#19#1#5'Width'#2'`'#8'TabOrder'#2#2#4'Text'#6#6'OpEdit'#0#0#5'TEdit'#8'Fun' + +'cEdit'#4'Left'#3#9#1#6'Height'#2#23#3'Top'#3#19#1#5'Width'#3#136#0#8'TabOrd' + +'er'#2#3#4'Text'#6#8'FuncEdit'#0#0#5'TEdit'#7'VarEdit'#4'Left'#3#153#1#6'Hei' + +'ght'#2#23#3'Top'#3#19#1#5'Width'#3#168#0#8'TabOrder'#2#4#4'Text'#6#7'VarEdi' + +'t'#0#0#9'TComboBox'#8'OpsCombo'#4'Left'#3#162#0#6'Height'#2#23#3'Top'#3#227 + +#0#5'Width'#2'^'#12'AutoDropDown'#9#10'ItemHeight'#2#15#13'Items.Strings'#1#6 + +#1'+'#6#1'-'#6#1'*'#6#1'/'#6#0#0#7'OnClick'#7#13'OpsComboClick'#8'OnSelect'#7 + +#14'OpsComboSelect'#8'TabOrder'#2#5#0#0#9'TComboBox'#13'FunctionCombo'#4'Lef' + +'t'#3#9#1#6'Height'#2#23#3'Top'#3#226#0#5'Width'#3#134#0#12'AutoDropDown'#9 + +#10'ItemHeight'#2#15#13'Items.Strings'#1#6#3'sqr'#6#4'sqrt'#6#3'sin'#6#3'cos' + +#6#3'tan'#6#4'asin'#6#4'acos'#6#4'atan'#6#5'log10'#6#2'ln'#6#3'exp'#6#5'1 / ' + +'X'#6#0#0#7'OnClick'#7#18'FunctionComboClick'#8'OnSelect'#7#19'FunctionCombo' + +'Select'#8'TabOrder'#2#6#0#0#9'TComboBox'#8'VarCombo'#4'Left'#3#151#1#6'Heig' + +'ht'#2#23#3'Top'#3#224#0#5'Width'#3#169#0#12'AutoDropDown'#9#10'ItemHeight'#2 + +#15#7'OnClick'#7#13'VarComboClick'#8'OnSelect'#7#14'VarComboSelect'#8'TabOrd' + +'er'#2#7#4'Text'#6#8'VarCombo'#0#0#7'TButton'#8'ResetBtn'#4'Left'#2#10#6'Hei' + +'ght'#2' '#3'Top'#3'b'#1#5'Width'#2'W'#7'Caption'#6#5'Reset'#7'OnClick'#7#13 + +'ResetBtnClick'#8'TabOrder'#2#8#0#0#7'TButton'#9'CancelBtn'#4'Left'#3#161#0#6 + +'Height'#2' '#3'Top'#3'b'#1#5'Width'#2'W'#7'Caption'#6#6'Cancel'#11'ModalRes' + +'ult'#2#2#7'OnClick'#7#14'CancelBtnClick'#8'TabOrder'#2#9#0#0#7'TButton'#10 + +'ComputeBtn'#4'Left'#3'8'#1#6'Height'#2' '#3'Top'#3'b'#1#5'Width'#2'W'#7'Cap' + +'tion'#6#7'Compute'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#10#0#0#7 + +'TButton'#9'ReturnBnt'#4'Left'#3#233#1#6'Height'#2' '#3'Top'#3'b'#1#5'Width' + +#2'W'#7'Caption'#6#6'Return'#11'ModalResult'#2#1#7'OnClick'#7#14'ReturnBntCl' + +'ick'#8'TabOrder'#2#11#0#0#7'TButton'#7'NextBtn'#4'Left'#2's'#6'Height'#2#29 + +#3'Top'#3'9'#1#5'Width'#3#140#0#7'Caption'#6#23'Continue for next entry'#7'O' + +'nClick'#7#12'NextBtnClick'#8'TabOrder'#2#12#0#0#7'TButton'#11'FinishedBtn'#4 + +'Left'#3')'#1#6'Height'#2#29#3'Top'#3'8'#1#5'Width'#3#132#0#7'Caption'#6#8'F' + +'inished'#7'OnClick'#7#16'FinishedBtnClick'#8'TabOrder'#2#13#0#0#0 +]); diff --git a/applications/lazstats/source_orig/equationunit.pas b/applications/lazstats/source_orig/equationunit.pas new file mode 100644 index 000000000..dec64297a --- /dev/null +++ b/applications/lazstats/source_orig/equationunit.pas @@ -0,0 +1,289 @@ +unit EquationUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, MainUnit, Globals, OutPutUnit, DataProcs, + DictionaryUnit, contexthelpunit, MatrixLib, Math; + +type + + { TEquationForm } + + TEquationForm = class(TForm) + FinishedBtn: TButton; + NextBtn: TButton; + ResetBtn: TButton; + CancelBtn: TButton; + ComputeBtn: TButton; + ReturnBnt: TButton; + VarCombo: TComboBox; + FunctionCombo: TComboBox; + OpsCombo: TComboBox; + VarEdit: TEdit; + FuncEdit: TEdit; + OpEdit: TEdit; + Label2: TLabel; + NewVarEdit: TEdit; + Label1: TLabel; + Memo1: TMemo; + procedure CancelBtnClick(Sender: TObject); + procedure ComputeBtnClick(Sender: TObject); + procedure FinishedBtnClick(Sender: TObject); + procedure FunctionComboClick(Sender: TObject); + procedure FunctionComboSelect(Sender: TObject); + procedure NextBtnClick(Sender: TObject); + procedure OpsComboClick(Sender: TObject); + procedure OpsComboSelect(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + procedure ReturnBntClick(Sender: TObject); + procedure VarComboClick(Sender: TObject); + procedure VarComboSelect(Sender: TObject); + private + { private declarations } + operations, functions, variables : StrDyneVec; + NoEntries : integer; + selected : IntDyneVec; + public + { public declarations } + end; + +var + EquationForm: TEquationForm; + +implementation + +{ TEquationForm } + +procedure TEquationForm.ResetBtnClick(Sender: TObject); +VAR i : integer; +begin + NewVarEdit.Text := ''; + OpEdit.Text := ''; + FuncEdit.Text := ''; + VarEdit.Text := ''; + OpsCombo.Text := 'Operations'; + FunctionCombo.Text := 'Functions'; + VarCombo.Clear; + for i := 1 to NoVariables do + VarCombo.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); + VarCombo.Text := 'Variables'; + VarCombo.DropDownCount := NoVariables; + SetLength(operations,NoVariables); + SetLength(functions,NoVariables); + SetLength(variables,NoVariables); + NoEntries := 0; +end; + +procedure TEquationForm.ReturnBntClick(Sender: TObject); +begin + variables := nil; + functions := nil; + operations := nil; +end; + +procedure TEquationForm.VarComboClick(Sender: TObject); +VAR index : integer; +begin + index := VarCombo.ItemIndex; + if index < 0 then exit; + VarEdit.Text := VarCombo.Items.Strings[index]; + VarCombo.ItemIndex := -1; +end; + +procedure TEquationForm.VarComboSelect(Sender: TObject); +VAR index : integer; +begin + index := VarCombo.ItemIndex; + if index < 0 then exit; + VarEdit.Text := VarCombo.Items.Strings[index]; + VarCombo.ItemIndex := -1; +end; + +procedure TEquationForm.NextBtnClick(Sender: TObject); +begin + operations[NoEntries] := OpEdit.Text; + if ((NoEntries > 0) and (operations[NoEntries] = '') )then + begin + ShowMessage('ERROR-No operation selected - enter again!'); + exit; + end; + functions[NoEntries] := FuncEdit.Text; + variables[NoEntries] := VarEdit.Text; + if (variables[NoEntries] = '') then + begin + ShowMessage('ERROR-No variable entered - enter again!'); + exit; + end; + NoEntries := NoEntries + 1; + OpEdit.Text := ''; + FuncEdit.Text := ''; + VarEdit.Text := ''; + OpsCombo.Text := 'Operations'; + FunctionCombo.Text := 'Functions'; + VarCombo.Text := 'Variables'; +end; + +procedure TEquationForm.OpsComboClick(Sender: TObject); +VAR index : integer; +begin + index := OpsCombo.ItemIndex; + if index < 0 then exit; + OpEdit.Text := OpsCombo.Items.Strings[index]; + OpsCombo.ItemIndex := -1; +end; + +procedure TEquationForm.OpsComboSelect(Sender: TObject); +VAR index : integer; +begin + index := OpsCombo.ItemIndex; + if index < 0 then exit; + OpEdit.Text := OpsCombo.Items.Strings[index]; + OpsCombo.ItemIndex := -1; +end; + +procedure TEquationForm.FinishedBtnClick(Sender: TObject); +begin + operations[NoEntries] := OpEdit.Text; + if ((NoEntries > 0) and (operations[NoEntries] = '')) then + begin + ShowMessage('ERROR-No operation selected - enter again!'); + exit; + end; + functions[NoEntries] := FuncEdit.Text; + variables[NoEntries] := VarEdit.Text; + if (variables[NoEntries] = '') then + begin + ShowMessage('ERROR-No variable entered - enter again!'); + exit; + end; + NoEntries := NoEntries + 1; + OpsCombo.Text := 'Operations'; + FunctionCombo.Text := 'Functions'; + VarCombo.Text := 'Variables'; +end; + +procedure TEquationForm.FunctionComboClick(Sender: TObject); +VAR index : integer; +begin + index := FunctionCombo.ItemIndex; + if index < 0 then exit; + FuncEdit.Text := FunctionCombo.Items.Strings[index]; + FunctionCombo.ItemIndex := -1; +end; + +procedure TEquationForm.FunctionComboSelect(Sender: TObject); +VAR index : integer; +begin + index := FunctionCombo.ItemIndex; + if index < 0 then exit; + FuncEdit.Text := FunctionCombo.Items.Strings[index]; + FunctionCombo.ItemIndex := -1; +end; + +procedure TEquationForm.ComputeBtnClick(Sender: TObject); +VAR + cellstring, outline : string; + opsitem, funcsitem, col, newcol, i, j, k : integer; + newvalue, xvalue : double; +begin + // get position of selected variables from the main grid + SetLength(selected,NoEntries); + for i := 1 to NoVariables do + begin + cellstring := Trim(OS3MainFrm.DataGrid.Cells[i,0]); + for j := 0 to NoEntries - 1 do + if (cellstring = variables[j]) then selected[j] := i; + end; + + // create a new variable in the main grid + col := NoVariables + 1; + newcol := col; + DictionaryFrm.NewVar(col); + OS3MainFrm.DataGrid.Cells[col,0] := NewVarEdit.Text; + DictionaryFrm.DictGrid.Cells[1,col] := NewVarEdit.Text; + + // for each subject obtain selected variable values and add to newvalue + for i := 1 to NoCases do // subject loop + begin + newvalue := 0.0; + for j := 0 to NoEntries - 1 do // list loop + begin + col := selected[j]; + xvalue := StrToFloat(Trim(OS3MainFrm.DataGrid.Cells[col,i])); + if (functions[j] <> '') then // do the function + begin + for k := 0 to 11 do // get function number + begin + if (functions[j] = FunctionCombo.Items.Strings[k]) then funcsitem := k; + end; + case (funcsitem) of + 0: xvalue *= xvalue; + 1: xvalue := sqrt(xvalue); + 2: xvalue := sin(xvalue); + 3: xvalue := cos(xvalue); + 4: xvalue := tan(xvalue); + 5: xvalue := arcsin(xvalue); + 6: xvalue := arccos(xvalue); + 7: xvalue := arctan(xvalue); + 8: xvalue := log10(xvalue); + 9: xvalue := ln(xvalue); + 10: xvalue := exp(xvalue); + 11: xvalue := 1.0 / xvalue; + end; + end; // end if function + if (operations[j] = '') then newvalue := newvalue + xvalue + else // find operation + begin + for k := 0 to 3 do + begin + if (operations[j] = OpsCombo.Items.Strings[k]) then opsitem := k; + end; + case (opsitem) of + 0: newvalue += xvalue; + 1: newvalue -= xvalue; + 2: newvalue *= xvalue; + 3: newvalue /= xvalue; + end; + end; // end else + end; // end jth variable + OS3MainFrm.DataGrid.Cells[newcol,i] := floattostr(newvalue); + FormatCell(newcol,i); + end; // next subject + + OutPutFrm.RichEdit.Clear; + OutPutFrm.RichEdit.Lines.Add('Equation Used for the New Variable'); + OutPutFrm.RichEdit.Lines.Add(''); + outline := NewVarEdit.Text; + outline := outline +' = '; + for j := 0 to NoEntries - 1 do + begin + outline := outline + functions[j]; + outline := outline + ' '; + outline := outline + variables[j]; + outline := outline + ' '; + if (j < NoEntries-1) then + begin + outline := outline + operations[j+1]; + outline := outline + ' '; + end; + end; + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.ShowModal; +end; + +procedure TEquationForm.CancelBtnClick(Sender: TObject); +begin + variables := nil; + functions := nil; + operations := nil; +end; + +initialization + {$I equationunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/errorcurvesunit.pas b/applications/lazstats/source_orig/errorcurvesunit.pas new file mode 100644 index 000000000..1004c5cd9 --- /dev/null +++ b/applications/lazstats/source_orig/errorcurvesunit.pas @@ -0,0 +1,330 @@ +unit ERRORCURVESUNIT; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, ExtCtrls, BlankFrmUnit, OutPutUnit, FunctionsLib, Globals; + +type + TwoCol = array[1..2,1..100] of double; + +type + + { TErrorCurvesFrm } + + TErrorCurvesFrm = class(TForm) + NullType: TRadioGroup; + ResetBtn: TButton; + CancelBtn: TButton; + ComputeBtn: TButton; + ReturnBtn: TButton; + NullMeanEdit: TEdit; + AltMeanEdit: TEdit; + SDEdit: TEdit; + TypeIEdit: TEdit; + TypeIIEdit: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + procedure ComputeBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + private + { private declarations } + procedure PltPts(realpts : TwoCol; + Xmax, Xmin, Ymax, Ymin : double; + Npts, XaxisStart, YaxisStart, XaxisRange : integer; + YaxisRange : integer; + acolor : TColor; 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); + + public + { public declarations } + end; + +var + ErrorCurvesFrm: TErrorCurvesFrm; + +implementation + +{ TErrorCurvesFrm } + +procedure TErrorCurvesFrm.ResetBtnClick(Sender: TObject); +begin + NullMeanEdit.Text := ''; + AltMeanEdit.Text := ''; + SDEdit.Text := ''; + TypeIEdit.Text := '0.05'; + TypeIIEdit.Text := '0.05'; + NullMeanEdit.SetFocus; +end; + +procedure TErrorCurvesFrm.FormShow(Sender: TObject); +begin + ResetBtnClick(self); +end; + +procedure TErrorCurvesFrm.ComputeBtnClick(Sender: TObject); +var + // generate a null and alternate hypothesis for a specified effect + // size, Type I error rate and Type II error rate using the normal + // distribution z-test. Estimate the N needed. + // Uses the Plot.h header file and form FrmPlot. + Clwidth,Clheight,X,Y,XaxisStart,XaxisEnd,YaxisStart,YaxisEnd : integer; + Xrange, Yrange, t, range, Nsize: integer; + alpha, beta, nullmean, altmean, Diff, StdDev, CriticalX, zalpha : double; + zbeta, Xprop, stderrmean, xlow, xhigh : double; + valuestr, charLabel : string; + realpts : TwoCol; +begin + BlankFrm.Show; + 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); + alpha := StrToFloat(TypeIEdit.Text); + if NullType.ItemIndex = 1 then alpha := alpha / 2.0; + beta := StrToFloat(TypeIIEdit.Text); + nullmean := StrToFloat(NullMeanEdit.Text); + altmean := StrToFloat(AltMeanEdit.Text); + StdDev := StrToFloat(SDEdit.Text); + zalpha := inversez(1.0 - alpha); + zbeta := inversez(1.0 - beta); + Diff := abs(nullmean - altmean); + Nsize := round((StdDev / Diff) * abs(zbeta + zalpha)); + Nsize := Nsize * Nsize; + CriticalX := zalpha * (StdDev / sqrt(Nsize)) + nullmean; + stderrmean := StdDev / sqrt(Nsize); + Clwidth := BlankFrm.Image1.Width; + Clheight := BlankFrm.Image1.Height; + + // Determine X scale and print it + YaxisStart := (Clheight * 6) div 10; + YaxisEnd := Clheight div 10; + Yrange := YaxisStart - YaxisEnd; + xlow := nullmean - 4 * stderrmean; + xhigh := altmean + 4 * stderrmean; + XaxisStart := Clwidth div 8; + XaxisEnd := Clwidth - (Clwidth div 8); + Xrange := XaxisEnd - XaxisStart; + Hscale(xlow, xhigh, 9, clWhite, 8, XaxisStart, YaxisStart, Xrange,'X SCALE',BlankFrm); + + // Create values of the alternative distribution + Xprop := ( (nullmean + 4*stderrmean) - xlow) / (xhigh - xlow); + range := round(Xprop * Xrange); + NormPts(-4.0, 4.0, 100, realpts, self); + Xprop := ((altmean - 4 * stderrmean) - xlow) / (xhigh - xlow); + X := round((Xprop * Xrange) + XaxisStart); // where to start curve + PltPts(realpts, 4.0, -4.0, 0.5, 0.0, 100, X, YaxisStart, range, + Yrange, clBlack, self); + + //Draw vertical axis at the critical X value + Xprop := (CriticalX - xlow) / (xhigh - xlow); + X := round((Xprop * Xrange) + XaxisStart); + Y := YaxisStart; + BlankFrm.Image1.Canvas.MoveTo(X,Y); + BlankFrm.Image1.Canvas.LineTo(X,YaxisEnd); + charLabel := 'Critical X = '; + valuestr := format('%6.2f',[CriticalX]); + charLabel := charLabel + valuestr; + t := BlankFrm.Image1.Canvas.TextWidth(charLabel) div 2; + BlankFrm.Image1.Canvas.TextOut(X-t,YaxisEnd-15,charLabel); + + // floodfill Alternate distribution area with blue + Xprop := (CriticalX - xlow) / (xhigh - xlow); + X := round((Xprop * Xrange) + XaxisStart); + Y := YaxisStart - 3; + BlankFrm.Image1.Canvas.Brush.Color := clBlue; + BlankFrm.Image1.Canvas.FloodFill(X-2,Y,clBlack,fsBorder ); + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + + // Create values of normal curve for null distribution + NormPts(-4.0, 4.0, 100, realpts, self); + Xprop := ( (nullmean + 4*stderrmean) - xlow) / (xhigh - xlow); + range := round(Xprop * Xrange); + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + PltPts(realpts, 4.0, -4.0, 0.5, 0.0, 100, XaxisStart, YaxisStart, range, + Yrange, clBlack, self); + + //Draw vertical axis at null mean + Xprop := (nullmean - xlow) / (xhigh - xlow); + X := round((Xprop * Xrange) + XaxisStart); + Y := YaxisStart; + BlankFrm.Image1.Canvas.MoveTo(X,Y); + BlankFrm.Image1.Canvas.LineTo(X,YaxisEnd); + charLabel := 'Null Mean'; + t := BlankFrm.Image1.Canvas.TextWidth(charLabel) div 2; + BlankFrm.Image1.Canvas.TextOut(X-t,YaxisEnd,charLabel); + + // floodfill alpha area with red + Xprop := (CriticalX - xlow) / (xhigh - xlow); + X := round((Xprop * Xrange) + XaxisStart); + Y := YaxisStart - 3; + BlankFrm.Image1.Canvas.Brush.Color := clRed; + BlankFrm.Image1.Canvas.FloodFill(X+2,Y,clBlack,fsBorder ); + BlankFrm.Image1.Canvas.Brush.Color := clWhite; + + //Draw vertical axis at alternative mean + BlankFrm.Image1.Canvas.Pen.Color := clBlack; + Xprop := (altmean - xlow) / (xhigh - xlow); + X := round((Xprop * Xrange) + XaxisStart); + Y := YaxisStart; + BlankFrm.Image1.Canvas.MoveTo(X,Y); + BlankFrm.Image1.Canvas.LineTo(X,YaxisEnd); + charLabel := 'Alternative Mean'; + t := BlankFrm.Image1.Canvas.TextWidth(charLabel) div 2; + BlankFrm.Image1.Canvas.TextOut(X-t,YaxisEnd,charLabel); + + // draw the vertical density axis scale values + Vscale(0.0, 0.5, 11, clWhite, 10, XaxisStart, YaxisStart, Yrange, 'DENSITY', self); + + // Print Heading + charLabel := 'Type I and II Error Areas'; + BlankFrm.Caption := charLabel; + charLabel := 'Alpha := '; + charLabel := charLabel + TypeIEdit.Text; + charLabel := charLabel + ', Beta := '; + charLabel := charLabel + TypeIIEdit.Text; + charLabel := charLabel + ', N := '; + charLabel := charLabel + IntToStr(Nsize); + t := BlankFrm.Image1.Canvas.TextWidth(charLabel); + X := round((BlankFrm.Image1.Width / 2) - (t / 2)); + BlankFrm.Image1.Canvas.TextOut(X,0,charLabel); + + // print z scale for the null distribution + Xprop := ( (nullmean + 4*stderrmean) - xlow) / (xhigh - xlow); + range := round(Xprop * Xrange); + Hscale(-4.0, 4.0, 11, clWhite, 8, XaxisStart, YaxisStart+50, range,'NULL Z SCALE', self); + + end; + +procedure TErrorCurvesFrm.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 TErrorCurvesFrm.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 + 1 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 label below X axis + Ypos := Y + 30; + Xpos := round((BlankFrm.Image1.Width / 2) - (BlankFrm.Image1.Canvas.TextWidth(charLabel) / 2)); + BlankFrm.Image1.Canvas.TextOut(Xpos,Ypos,charLabel); +end; + +procedure TErrorCurvesFrm.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 + 1 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 label 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 TErrorCurvesFrm.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; + +initialization + {$I errorcurvesunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/essayitemunit.lfm b/applications/lazstats/source_orig/essayitemunit.lfm new file mode 100644 index 000000000..855ab9026 --- /dev/null +++ b/applications/lazstats/source_orig/essayitemunit.lfm @@ -0,0 +1,205 @@ +object EssayItemForm: TEssayItemForm + Left = 207 + Height = 499 + Top = 116 + Width = 641 + Caption = 'Essay Item Creation and Editing' + ClientHeight = 499 + ClientWidth = 641 + OnShow = FormShow + LCLVersion = '0.9.30' + object jpegBrowseBtn: TButton + Left = 7 + Height = 30 + Top = 337 + Width = 118 + Caption = 'Browse jpeg Images' + OnClick = jpegBrowseBtnClick + TabOrder = 0 + end + object SelectImageBtn: TButton + Left = 10 + Height = 26 + Top = 408 + Width = 112 + Caption = 'Select Shown Image' + OnClick = SelectImageBtnClick + TabOrder = 1 + end + object Image1: TImage + Left = 138 + Height = 151 + Top = 337 + Width = 211 + end + object ItemSaveBtn: TButton + Left = 368 + Height = 33 + Top = 336 + Width = 111 + Caption = 'Save this item' + OnClick = ItemSaveBtnClick + TabOrder = 2 + end + object PreviousBtn: TButton + Left = 498 + Height = 32 + Top = 337 + Width = 110 + Caption = 'Show Previous Item' + OnClick = PreviousBtnClick + TabOrder = 3 + end + object ShowNextBtn: TButton + Left = 369 + Height = 30 + Top = 392 + Width = 109 + Caption = 'Show Next Item' + OnClick = ShowNextBtnClick + TabOrder = 4 + end + object StartNewBtn: TButton + Left = 498 + Height = 30 + Top = 392 + Width = 111 + Caption = 'Start a new item' + OnClick = StartNewBtnClick + TabOrder = 5 + end + object ReturnBtn: TButton + Left = 432 + Height = 30 + Top = 456 + Width = 111 + Caption = 'Return' + OnClick = ReturnBtnClick + TabOrder = 6 + end + object jpeglabel: TLabel + Left = 10 + Height = 16 + Top = 299 + Width = 225 + Caption = 'jpeg photo to display prior to item (if any):' + ParentColor = False + end + object jpegnameEdit: TEdit + Left = 240 + Height = 23 + Top = 292 + Width = 372 + TabOrder = 7 + Text = 'jpegnameEdit' + end + object TFItemNoLabel: TLabel + Left = 7 + Height = 16 + Top = 179 + Width = 75 + Caption = 'Item Number:' + ParentColor = False + end + object ItemNoEdit: TEdit + Left = 96 + Height = 23 + Top = 172 + Width = 44 + TabOrder = 8 + Text = '1' + end + object ItemCodeLabel: TLabel + Left = 176 + Height = 16 + Top = 179 + Width = 93 + Caption = 'Item Major Code:' + ParentColor = False + end + object MajorCodeEdit: TEdit + Left = 280 + Height = 23 + Top = 172 + Width = 41 + TabOrder = 9 + Text = '1' + end + object MinorCodeLabel: TLabel + Left = 336 + Height = 16 + Top = 177 + Width = 94 + Caption = 'Item Minor Code:' + ParentColor = False + end + object MinorCodeEdit: TEdit + Left = 440 + Height = 23 + Top = 172 + Width = 45 + TabOrder = 10 + Text = '0' + end + object ItemStemLabel: TLabel + Left = 8 + Height = 16 + Top = 220 + Width = 58 + Caption = 'Item Stem:' + ParentColor = False + end + object ItemStemEdit: TEdit + Left = 73 + Height = 23 + Top = 213 + Width = 539 + TabOrder = 11 + Text = 'ItemStemEdit' + end + object AnswerLabel: TLabel + Left = 8 + Height = 16 + Top = 256 + Width = 74 + Caption = 'Short Answer:' + ParentColor = False + end + object AnswerEdit: TEdit + Left = 96 + Height = 23 + Top = 249 + Width = 516 + TabOrder = 12 + end + object Memo1: TMemo + Left = 20 + Height = 133 + Top = 11 + Width = 592 + Lines.Strings = ( + 'Directions: To create an Essay item, you will need to enter the number of an item code which contains' + 'both a major code and a minor code. It is suggested you print all item codes from the options menu on the' + 'main procedure page of the item banking program. You can however, browse the Essay items from this ' + 'form.' + 'After you have selected an item code number, enter the item stem in the space provided. Your item can also' + 'include a jpeg picture prior to the presentation of the item on a test. To find the image, click the jpeg browse' + 'button until you see the image you wish to include. When that item is shown, click the Select button to save' + 'the name of the image file.' + ) + TabOrder = 13 + end + object CodeBrowseBtn: TButton + Left = 502 + Height = 28 + Top = 165 + Width = 106 + Caption = 'Browse Items' + OnClick = CodeBrowseBtnClick + TabOrder = 14 + end + object OpenPictureDialog1: TOpenPictureDialog + left = 412 + top = 471 + end +end diff --git a/applications/lazstats/source_orig/essayitemunit.lrs b/applications/lazstats/source_orig/essayitemunit.lrs new file mode 100644 index 000000000..4d982ab24 --- /dev/null +++ b/applications/lazstats/source_orig/essayitemunit.lrs @@ -0,0 +1,60 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TEssayItemForm','FORMDATA',[ + 'TPF0'#14'TEssayItemForm'#13'EssayItemForm'#4'Left'#3#207#0#6'Height'#3#243#1 + +#3'Top'#2't'#5'Width'#3#129#2#7'Caption'#6#31'Essay Item Creation and Editin' + +'g'#12'ClientHeight'#3#243#1#11'ClientWidth'#3#129#2#6'OnShow'#7#8'FormShow' + +#10'LCLVersion'#6#6'0.9.30'#0#7'TButton'#13'jpegBrowseBtn'#4'Left'#2#7#6'Hei' + +'ght'#2#30#3'Top'#3'Q'#1#5'Width'#2'v'#7'Caption'#6#18'Browse jpeg Images'#7 + +'OnClick'#7#18'jpegBrowseBtnClick'#8'TabOrder'#2#0#0#0#7'TButton'#14'SelectI' + +'mageBtn'#4'Left'#2#10#6'Height'#2#26#3'Top'#3#152#1#5'Width'#2'p'#7'Caption' + +#6#18'Select Shown Image'#7'OnClick'#7#19'SelectImageBtnClick'#8'TabOrder'#2 + +#1#0#0#6'TImage'#6'Image1'#4'Left'#3#138#0#6'Height'#3#151#0#3'Top'#3'Q'#1#5 + +'Width'#3#211#0#0#0#7'TButton'#11'ItemSaveBtn'#4'Left'#3'p'#1#6'Height'#2'!' + +#3'Top'#3'P'#1#5'Width'#2'o'#7'Caption'#6#14'Save this item'#7'OnClick'#7#16 + +'ItemSaveBtnClick'#8'TabOrder'#2#2#0#0#7'TButton'#11'PreviousBtn'#4'Left'#3 + +#242#1#6'Height'#2' '#3'Top'#3'Q'#1#5'Width'#2'n'#7'Caption'#6#18'Show Previ' + +'ous Item'#7'OnClick'#7#16'PreviousBtnClick'#8'TabOrder'#2#3#0#0#7'TButton' + +#11'ShowNextBtn'#4'Left'#3'q'#1#6'Height'#2#30#3'Top'#3#136#1#5'Width'#2'm'#7 + +'Caption'#6#14'Show Next Item'#7'OnClick'#7#16'ShowNextBtnClick'#8'TabOrder' + +#2#4#0#0#7'TButton'#11'StartNewBtn'#4'Left'#3#242#1#6'Height'#2#30#3'Top'#3 + +#136#1#5'Width'#2'o'#7'Caption'#6#16'Start a new item'#7'OnClick'#7#16'Start' + +'NewBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#9'ReturnBtn'#4'Left'#3#176#1#6 + +'Height'#2#30#3'Top'#3#200#1#5'Width'#2'o'#7'Caption'#6#6'Return'#7'OnClick' + +#7#14'ReturnBtnClick'#8'TabOrder'#2#6#0#0#6'TLabel'#9'jpeglabel'#4'Left'#2#10 + +#6'Height'#2#16#3'Top'#3'+'#1#5'Width'#3#225#0#7'Caption'#6'-jpeg photo to d' + +'isplay prior to item (if any):'#11'ParentColor'#8#0#0#5'TEdit'#12'jpegnameE' + +'dit'#4'Left'#3#240#0#6'Height'#2#23#3'Top'#3'$'#1#5'Width'#3't'#1#8'TabOrde' + +'r'#2#7#4'Text'#6#12'jpegnameEdit'#0#0#6'TLabel'#13'TFItemNoLabel'#4'Left'#2 + +#7#6'Height'#2#16#3'Top'#3#179#0#5'Width'#2'K'#7'Caption'#6#12'Item Number:' + +#11'ParentColor'#8#0#0#5'TEdit'#10'ItemNoEdit'#4'Left'#2'`'#6'Height'#2#23#3 + +'Top'#3#172#0#5'Width'#2','#8'TabOrder'#2#8#4'Text'#6#1'1'#0#0#6'TLabel'#13 + +'ItemCodeLabel'#4'Left'#3#176#0#6'Height'#2#16#3'Top'#3#179#0#5'Width'#2']'#7 + +'Caption'#6#16'Item Major Code:'#11'ParentColor'#8#0#0#5'TEdit'#13'MajorCode' + +'Edit'#4'Left'#3#24#1#6'Height'#2#23#3'Top'#3#172#0#5'Width'#2')'#8'TabOrder' + +#2#9#4'Text'#6#1'1'#0#0#6'TLabel'#14'MinorCodeLabel'#4'Left'#3'P'#1#6'Height' + +#2#16#3'Top'#3#177#0#5'Width'#2'^'#7'Caption'#6#16'Item Minor Code:'#11'Pare' + +'ntColor'#8#0#0#5'TEdit'#13'MinorCodeEdit'#4'Left'#3#184#1#6'Height'#2#23#3 + +'Top'#3#172#0#5'Width'#2'-'#8'TabOrder'#2#10#4'Text'#6#1'0'#0#0#6'TLabel'#13 + +'ItemStemLabel'#4'Left'#2#8#6'Height'#2#16#3'Top'#3#220#0#5'Width'#2':'#7'Ca' + +'ption'#6#10'Item Stem:'#11'ParentColor'#8#0#0#5'TEdit'#12'ItemStemEdit'#4'L' + +'eft'#2'I'#6'Height'#2#23#3'Top'#3#213#0#5'Width'#3#27#2#8'TabOrder'#2#11#4 + +'Text'#6#12'ItemStemEdit'#0#0#6'TLabel'#11'AnswerLabel'#4'Left'#2#8#6'Height' + +#2#16#3'Top'#3#0#1#5'Width'#2'J'#7'Caption'#6#13'Short Answer:'#11'ParentCol' + +'or'#8#0#0#5'TEdit'#10'AnswerEdit'#4'Left'#2'`'#6'Height'#2#23#3'Top'#3#249#0 + +#5'Width'#3#4#2#8'TabOrder'#2#12#0#0#5'TMemo'#5'Memo1'#4'Left'#2#20#6'Height' + +#3#133#0#3'Top'#2#11#5'Width'#3'P'#2#13'Lines.Strings'#1#6'fDirections: To ' + +'create an Essay item, you will need to enter the number of an item code whi' + +'ch contains'#6'jboth a major code and a minor code. It is suggested you pr' + +'int all item codes from the options menu on the'#6'emain procedure page of ' + +'the item banking program. You can however, browse the Essay items from th' + +'is '#6#5'form.'#6'kAfter you have selected an item code number, enter the i' + +'tem stem in the space provided. Your item can also'#6'qinclude a jpeg pict' + +'ure prior to the presentation of the item on a test. To find the image, cl' + +'ick the jpeg browse'#6'mbutton until you see the image you wish to include.' + +' When that item is shown, click the Select button to save'#6#27'the name o' + +'f the image file.'#0#8'TabOrder'#2#13#0#0#7'TButton'#13'CodeBrowseBtn'#4'Le' + +'ft'#3#246#1#6'Height'#2#28#3'Top'#3#165#0#5'Width'#2'j'#7'Caption'#6#12'Bro' + +'wse Items'#7'OnClick'#7#18'CodeBrowseBtnClick'#8'TabOrder'#2#14#0#0#18'TOpe' + +'nPictureDialog'#18'OpenPictureDialog1'#4'left'#3#156#1#3'top'#3#215#1#0#0#0 +]); diff --git a/applications/lazstats/source_orig/essayitemunit.pas b/applications/lazstats/source_orig/essayitemunit.pas new file mode 100644 index 000000000..4f04b044b --- /dev/null +++ b/applications/lazstats/source_orig/essayitemunit.pas @@ -0,0 +1,260 @@ +unit EssayItemUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, ExtCtrls, ExtDlgs, outputunit; + +type + + { TEssayItemForm } + + TEssayItemForm = class(TForm) + AnswerEdit: TEdit; + AnswerLabel: TLabel; + CodeBrowseBtn: TButton; + Image1: TImage; + ItemCodeLabel: TLabel; + ItemSaveBtn: TButton; + ItemStemEdit: TEdit; + ItemStemLabel: TLabel; + jpegBrowseBtn: TButton; + jpeglabel: TLabel; + jpegnameEdit: TEdit; + MajorCodeEdit: TEdit; + Memo1: TMemo; + MinorCodeEdit: TEdit; + MinorCodeLabel: TLabel; + OpenPictureDialog1: TOpenPictureDialog; + PreviousBtn: TButton; + ReturnBtn: TButton; + SelectImageBtn: TButton; + ShowNextBtn: TButton; + StartNewBtn: TButton; + ItemNoEdit: TEdit; + TFItemNoLabel: TLabel; + procedure CodeBrowseBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ItemSaveBtnClick(Sender: TObject); + procedure jpegBrowseBtnClick(Sender: TObject); + procedure PreviousBtnClick(Sender: TObject); + procedure ReturnBtnClick(Sender: TObject); + procedure SelectImageBtnClick(Sender: TObject); + procedure ShowNextBtnClick(Sender: TObject); + procedure StartNewBtnClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + EssayItemForm: TEssayItemForm; + +implementation +uses ItemBankingUnit; + +{ TEssayItemForm } + +procedure TEssayItemForm.ReturnBtnClick(Sender: TObject); +begin + EssayItemForm.Hide; + Close; +end; + +procedure TEssayItemForm.SelectImageBtnClick(Sender: TObject); +begin + jpegnameEdit.Text := OpenPictureDialog1.FileName; +end; + +procedure TEssayItemForm.ShowNextBtnClick(Sender: TObject); +var + count : integer; + itemno : integer; + JPEG : TJPEGImage; +begin + itemno := StrToInt(ItemNoEdit.Text) + 1; + count := ItemBankFrm.BankInfo.NEssayItems; + if count <= itemno then + begin + ItemNoEdit.Text := IntToStr(ItemBankFrm.EssayInfo[itemno].ItemNumber); + MajorCodeEdit.Text := IntToStr(ItemBankFrm.EssayInfo[itemno].majorcode) ; + MinorCodeEdit.Text := IntToStr(ItemBankFrm.EssayInfo[itemno].minorcode); + ItemStemEdit.Text := ItemBankFrm.EssayInfo[itemno].ItemStem; + AnswerEdit.Text := ItemBankFrm.EssayInfo[itemno].Answer; + jpegnameEdit.Text := ItemBankFrm.EssayInfo[itemno].PicName; + if jpegnameEdit.Text <> 'none' then + begin + JPEG := TJPEGImage.Create; + try + JPEG.LoadFromFile(jpegnameEdit.Text); + Image1.Picture.Assign(JPEG); + finally + JPEG.Free; + Image1.Proportional := true; + end; + end; + end; +end; + +procedure TEssayItemForm.StartNewBtnClick(Sender: TObject); +var + currentno : integer; +begin + currentno := ItemBankFrm.BankInfo.NEssayItems + 1; + ItemNoEdit.Text := IntToStr(currentno); + currentno := StrToInt(MinorCodeEdit.Text); + MinorCodeEdit.Text := IntToStr(currentno + 1); + ItemStemEdit.Text := ''; + AnswerEdit.Text := ''; + jpegnameEdit.Text := 'none'; + Image1.Canvas.Clear; +end; + +procedure TEssayItemForm.ItemSaveBtnClick(Sender: TObject); +var + currentno : integer; + count : integer; +begin + count := ItemBankFrm.BankInfo.NEssayItems; + currentno := StrToInt(ItemNoEdit.Text); + if currentno > count then + begin + ItemBankFrm.BankInfo.NEssayItems := currentno; + ItemBankFrm.NEssayText.Text := IntToStr(currentno); + end; + ItemBankFrm.EssayInfo[currentno].ItemNumber := currentno; + ItemBankFrm.EssayInfo[currentno].majorcode := StrToInt(MajorCodeEdit.Text); + ItemBankFrm.EssayInfo[currentno].minorcode := StrToInt(MinorCodeEdit.Text); + ItemBankFrm.EssayInfo[currentno].ItemStem := ItemStemEdit.Text; + ItemBankFrm.EssayInfo[currentno].Answer := AnswerEdit.text; + ItemBankFrm.EssayInfo[currentno].PicName := jpegnameEdit.Text; +end; + +procedure TEssayItemForm.FormShow(Sender: TObject); +Var + nitems : integer; + JPEG : TJPEGImage; +begin + if ItemBankFrm.BankInfo.NEssayItems > 0 then + begin + nitems := ItemBankFrm.BankInfo.NEssayItems; + ItemNoEdit.Text := '1'; //IntToStr(ItemBankFrm.TFItemInfo[1].ItemNumber); + MajorCodeEdit.Text := IntToStr(ItemBankFrm.EssayInfo[1].majorcode) ; + MinorCodeEdit.Text := IntToStr(ItemBankFrm.EssayInfo[1].minorcode); + ItemStemEdit.Text := ItemBankFrm.EssayInfo[1].ItemStem; + AnswerEdit.Text := ItemBankFrm.EssayInfo[1].Answer; + jpegnameEdit.Text := ItemBankFrm.EssayInfo[1].PicName; + if jpegnameEdit.Text <> 'none' then + begin + JPEG := TJPEGImage.Create; + try + JPEG.LoadFromFile(jpegnameEdit.Text); + Image1.Picture.Assign(JPEG); + finally + JPEG.Free; + Image1.Proportional := true; + end; + end; + end else + begin + ItemNoEdit.Text := '1'; + MajorCodeEdit.Text := '1'; + MinorCodeEdit.Text := '0'; + ItemStemEdit.Text := ''; + AnswerEdit.Text := ''; + jpegnameEdit.Text := 'none'; + Image1.Canvas.Clear; + end; +end; + +procedure TEssayItemForm.CodeBrowseBtnClick(Sender: TObject); +var + count : integer; + i : integer; + outline : string; +begin + OutPutFrm.RichEdit.Clear; + count := ItemBankFrm.BankInfo.NTFItems; + OutPutFrm.RichEdit.Lines.Add('Current Items'); + OutPutFrm.RichEdit.Lines.Add(''); + + for i := 1 to count do + begin + outline := format('Item number %3d',[ItemBankFrm.EssayInfo[i].itemnumber]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Major Code %3d',[ItemBankFrm.EssayInfo[i].majorcode]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Minor Code %3d',[ItemBankFrm.EssayInfo[i].minorcode]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Item Stem %s',[ItemBankFrm.EssayInfo[i].ItemStem]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Breif Answer %s',[ItemBankFrm.EssayInfo[i].Answer]); + OutPutFrm.RichEdit.Lines.Add(outline); + outline := format('Graphic Image %s',[ItemBankFrm.EssayInfo[i].PicName]); + OutPutFrm.RichEdit.Lines.Add(outline); + OutPutFrm.RichEdit.Lines.Add(''); + end; + OutPutFrm.ShowModal; +end; + +procedure TEssayItemForm.jpegBrowseBtnClick(Sender: TObject); +VAR + JPEG : TJPEGImage; +begin + OpenPictureDialog1.Options := OpenPictureDialog1.Options+[ofFileMustExist]; + if not OpenPictureDialog1.Execute then exit; + try + JPEG := TJPEGImage.Create; + try + JPEG.LoadFromFile(OpenPictureDialog1.FileName); + Image1.Picture.Assign(JPEG); + finally + JPEG.Free; + end; + except + on E: Exception do begin + MessageDlg('Error','Error: '+E.Message,mtError,[mbOk],0); + end; + end; + Image1.Proportional := true; +end; + +procedure TEssayItemForm.PreviousBtnClick(Sender: TObject); +Var + response : string; + itemno : integer; + JPEG : TJPEGImage; +begin + response := InputBox('Code Number:','Number:','1'); + itemno := StrToInt(response); + if itemno <= ItemBankFrm.BankInfo.NEssayItems then + begin + ItemNoEdit.Text := IntToStr(ItemBankFrm.EssayInfo[itemno].ItemNumber); + MajorCodeEdit.Text := IntToStr(ItemBankFrm.EssayInfo[itemno].majorcode); + MinorCodeEdit.Text := IntToStr(ItemBankFrm.EssayInfo[itemno].minorcode); + ItemStemEdit.Text := ItemBankFrm.EssayInfo[itemno].ItemStem ; + AnswerEdit.Text := ItemBankFrm.EssayInfo[itemno].Answer; + jpegnameEdit.Text := ItemBankFrm.EssayInfo[itemno].PicName; + if jpegnameEdit.Text <> 'none' then + begin + JPEG := TJPEGImage.Create; + try + JPEG.LoadFromFile(jpegnameEdit.Text); + Image1.Picture.Assign(JPEG); + finally + JPEG.Free; + Image1.Proportional := true; + end; + end; + end; +end; + +initialization + {$I essayitemunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/fprobunit.lfm b/applications/lazstats/source_orig/fprobunit.lfm new file mode 100644 index 000000000..027b1c843 --- /dev/null +++ b/applications/lazstats/source_orig/fprobunit.lfm @@ -0,0 +1,112 @@ +object FForm: TFForm + Left = 288 + Height = 232 + Top = 161 + Width = 322 + Caption = 'Probability of a larger F value' + ClientHeight = 232 + ClientWidth = 322 + OnShow = ResetBtnClick + LCLVersion = '0.9.30' + object Label1: TLabel + Left = 8 + Height = 16 + Top = 16 + Width = 118 + Caption = 'Given: An F statistic = ' + ParentColor = False + end + object FEdit: TEdit + Left = 128 + Height = 23 + Top = 8 + Width = 70 + TabOrder = 0 + Text = 'FEdit' + end + object Label2: TLabel + Left = 8 + Height = 16 + Top = 50 + Width = 118 + Caption = 'with Deg. Freedom of ' + ParentColor = False + end + object DF1Edit: TEdit + Left = 129 + Height = 23 + Top = 41 + Width = 68 + TabOrder = 1 + Text = 'DF1Edit' + end + object Label3: TLabel + Left = 208 + Height = 16 + Top = 48 + Width = 24 + Caption = 'and ' + ParentColor = False + end + object DF2Edit: TEdit + Left = 240 + Height = 23 + Top = 39 + Width = 64 + TabOrder = 2 + Text = 'DF2Edit' + end + object Label4: TLabel + Left = 7 + Height = 16 + Top = 82 + Width = 206 + Caption = 'then the probability of a larger value = ' + ParentColor = False + end + object ProbEdit: TEdit + Left = 239 + Height = 23 + Top = 75 + Width = 64 + TabOrder = 3 + Text = 'ProbEdit' + end + object CancelBtn: TButton + Left = 7 + Height = 33 + Top = 120 + Width = 82 + Cancel = True + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 4 + end + object ResetBtn: TButton + Left = 112 + Height = 33 + Top = 120 + Width = 82 + Caption = 'Reset' + OnClick = ResetBtnClick + TabOrder = 5 + end + object ComputeBtn: TButton + Left = 221 + Height = 33 + Top = 120 + Width = 82 + Caption = 'Compute' + OnClick = ComputeBtnClick + TabOrder = 6 + end + object ReturnBtn: TButton + Left = 112 + Height = 33 + Top = 176 + Width = 77 + Caption = 'Return' + ModalResult = 1 + TabOrder = 7 + end +end diff --git a/applications/lazstats/source_orig/fprobunit.lrs b/applications/lazstats/source_orig/fprobunit.lrs new file mode 100644 index 000000000..8113a8a7d --- /dev/null +++ b/applications/lazstats/source_orig/fprobunit.lrs @@ -0,0 +1,29 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TFForm','FORMDATA',[ + 'TPF0'#6'TFForm'#5'FForm'#4'Left'#3' '#1#6'Height'#3#232#0#3'Top'#3#161#0#5'W' + +'idth'#3'B'#1#7'Caption'#6#31'Probability of a larger F value'#12'ClientHeig' + +'ht'#3#232#0#11'ClientWidth'#3'B'#1#6'OnShow'#7#13'ResetBtnClick'#10'LCLVers' + +'ion'#6#6'0.9.30'#0#6'TLabel'#6'Label1'#4'Left'#2#8#6'Height'#2#16#3'Top'#2 + +#16#5'Width'#2'v'#7'Caption'#6#24'Given: An F statistic = '#11'ParentColor'#8 + +#0#0#5'TEdit'#5'FEdit'#4'Left'#3#128#0#6'Height'#2#23#3'Top'#2#8#5'Width'#2 + +'F'#8'TabOrder'#2#0#4'Text'#6#5'FEdit'#0#0#6'TLabel'#6'Label2'#4'Left'#2#8#6 + +'Height'#2#16#3'Top'#2'2'#5'Width'#2'v'#7'Caption'#6#21'with Deg. Freedom of' + +' '#11'ParentColor'#8#0#0#5'TEdit'#7'DF1Edit'#4'Left'#3#129#0#6'Height'#2#23 + +#3'Top'#2')'#5'Width'#2'D'#8'TabOrder'#2#1#4'Text'#6#7'DF1Edit'#0#0#6'TLabel' + +#6'Label3'#4'Left'#3#208#0#6'Height'#2#16#3'Top'#2'0'#5'Width'#2#24#7'Captio' + +'n'#6#4'and '#11'ParentColor'#8#0#0#5'TEdit'#7'DF2Edit'#4'Left'#3#240#0#6'He' + +'ight'#2#23#3'Top'#2''''#5'Width'#2'@'#8'TabOrder'#2#2#4'Text'#6#7'DF2Edit'#0 + +#0#6'TLabel'#6'Label4'#4'Left'#2#7#6'Height'#2#16#3'Top'#2'R'#5'Width'#3#206 + +#0#7'Caption'#6')then the probability of a larger value = '#11'ParentColor'#8 + +#0#0#5'TEdit'#8'ProbEdit'#4'Left'#3#239#0#6'Height'#2#23#3'Top'#2'K'#5'Width' + +#2'@'#8'TabOrder'#2#3#4'Text'#6#8'ProbEdit'#0#0#7'TButton'#9'CancelBtn'#4'Le' + +'ft'#2#7#6'Height'#2'!'#3'Top'#2'x'#5'Width'#2'R'#6'Cancel'#9#7'Caption'#6#6 + +'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#4#0#0#7'TButton'#8'ResetBtn'#4'Le' + +'ft'#2'p'#6'Height'#2'!'#3'Top'#2'x'#5'Width'#2'R'#7'Caption'#6#5'Reset'#7'O' + +'nClick'#7#13'ResetBtnClick'#8'TabOrder'#2#5#0#0#7'TButton'#10'ComputeBtn'#4 + +'Left'#3#221#0#6'Height'#2'!'#3'Top'#2'x'#5'Width'#2'R'#7'Caption'#6#7'Compu' + +'te'#7'OnClick'#7#15'ComputeBtnClick'#8'TabOrder'#2#6#0#0#7'TButton'#9'Retur' + +'nBtn'#4'Left'#2'p'#6'Height'#2'!'#3'Top'#3#176#0#5'Width'#2'M'#7'Caption'#6 + +#6'Return'#11'ModalResult'#2#1#8'TabOrder'#2#7#0#0#0 +]); diff --git a/applications/lazstats/source_orig/fprobunit.pas b/applications/lazstats/source_orig/fprobunit.pas new file mode 100644 index 000000000..d93b80c54 --- /dev/null +++ b/applications/lazstats/source_orig/fprobunit.pas @@ -0,0 +1,68 @@ +unit FProbUnit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, functionslib; + +type + + { TFForm } + + TFForm = class(TForm) + CancelBtn: TButton; + ComputeBtn: TButton; + DF1Edit: TEdit; + DF2Edit: TEdit; + ProbEdit: TEdit; + FEdit: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + ResetBtn: TButton; + ReturnBtn: TButton; + procedure ComputeBtnClick(Sender: TObject); + procedure ResetBtnClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + FForm: TFForm; + +implementation + +{ TFForm } + +procedure TFForm.ResetBtnClick(Sender: TObject); +begin + FEdit.Text := ''; + DF1Edit.Text := ''; + DF2Edit.Text := ''; + ProbEdit.Text := ''; +end; + +procedure TFForm.ComputeBtnClick(Sender: TObject); +VAR + F, df1, df2, prob : extended; + outvalue : string; +begin + F := StrToFloat(FEdit.Text); + df1 := StrToFloat(DF1Edit.Text); + df2 := StrToFloat(DF2Edit.Text); + prob := probf(F,df1,df2); + outvalue := format('%6.4f',[prob]); + ProbEdit.Text := outvalue; +end; + +initialization + {$I fprobunit.lrs} + +end. + diff --git a/applications/lazstats/source_orig/freqspecsunit.lfm b/applications/lazstats/source_orig/freqspecsunit.lfm new file mode 100644 index 000000000..c54c9d667 --- /dev/null +++ b/applications/lazstats/source_orig/freqspecsunit.lfm @@ -0,0 +1,143 @@ +object FreqSpecsFrm: TFreqSpecsFrm + Left = 281 + Height = 358 + Top = 107 + Width = 300 + Caption = 'Frequency Specifications' + ClientHeight = 358 + ClientWidth = 300 + LCLVersion = '0.9.30' + object Label1: TLabel + Left = 11 + Height = 16 + Top = 119 + Width = 56 + Caption = 'VARIABLE:' + ParentColor = False + end + object Label2: TLabel + Left = 11 + Height = 16 + Top = 151 + Width = 46 + Caption = 'MINIUM' + ParentColor = False + end + object Label3: TLabel + Left = 11 + Height = 16 + Top = 183 + Width = 60 + Caption = 'MAXIMUM' + ParentColor = False + end + object Label4: TLabel + Left = 11 + Height = 16 + Top = 215 + Width = 39 + Caption = 'RANGE' + ParentColor = False + end + object Label5: TLabel + Left = 11 + Height = 16 + Top = 247 + Width = 79 + Caption = 'INTERVAL SIZE' + ParentColor = False + end + object Label6: TLabel + Left = 11 + Height = 16 + Top = 279 + Width = 84 + Caption = 'NO. INTERVALS' + ParentColor = False + end + object VarName: TEdit + Left = 112 + Height = 23 + Top = 112 + Width = 169 + TabOrder = 0 + end + object Minimum: TEdit + Left = 112 + Height = 23 + Top = 144 + Width = 169 + TabOrder = 1 + end + object Maximum: TEdit + Left = 112 + Height = 23 + Top = 176 + Width = 169 + TabOrder = 2 + end + object Range: TEdit + Left = 112 + Height = 23 + Top = 208 + Width = 169 + TabOrder = 3 + end + object IntSize: TEdit + Left = 112 + Height = 23 + Top = 240 + Width = 169 + OnKeyPress = IntSizeKeyPress + TabOrder = 4 + end + object NoInts: TEdit + Left = 112 + Height = 23 + Top = 272 + Width = 169 + TabOrder = 5 + end + object CancelBtn: TButton + Left = 104 + Height = 32 + Top = 311 + Width = 81 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 6 + end + object OKBtn: TButton + Left = 200 + Height = 31 + Top = 311 + Width = 81 + Caption = 'OK' + ModalResult = 1 + TabOrder = 7 + end + object HelpBtn: TButton + Tag = 123 + Left = 11 + Height = 32 + Top = 311 + Width = 82 + Caption = 'Help' + OnClick = HelpBtnClick + TabOrder = 8 + end + object Memo1: TMemo + Left = 7 + Height = 87 + Top = 1 + Width = 277 + Lines.Strings = ( + 'The number of intervals must be less than or ' + 'equal to the number of cases. To change the' + 'number of intervals, change the interval size' + 'to a larger value. Press the Enter key to make' + 'the number of intervals smaller.' + ) + TabOrder = 9 + end +end