LazStats: Inherit RIDITUnit from TBasicStatsReportForm.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7826 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-29 22:17:02 +00:00
parent 5475fff630
commit a08963c17f
7 changed files with 772 additions and 823 deletions

View File

@ -44,7 +44,7 @@ correlation, means, standard deviations and confidence interval for each correla
140=Directions: Cases should consist of k dichotomous item scores (0 and 1 scores.) You can use the Classical Test program to score your test and save the item scores to the grid if necessary.
141=Directions: First, click on the variable name that represents the sample lot number. Next, click on the variable that represents the measurement. Click on the sigma button to change the default and click on any of the optional check boxes and enter specifications desired. Click the Compute button to obtain the results. Up to 200 groups may be analyzed. Note! Equal group sizes of 2 to 25 required for ranges analysis. Control limits are plus and minus 3 sigma.
142=R = 1 - (s2 / S2) x (1 - r) where R is the estimated reliability of a test obtained on a new group with variance S2 when a reliability of r was obtained for the same test on a group with variance s2. It is assumed the difference in variance is due soley to the difference in true score variance of the two groups. See Theory of Mental Tests by H. Guliksen, 1950.
143=Directions: Your data grid should consist of a table of N rows and M+1 column variables. Each row should have a string type label variable and M columns of integer frequency data. 1. Enter the variable for the row labels (strings) 2. Enter the variables representing the columns of frequency integers 3. Select the Options desired 4. If only one variable is to be considered the reference variable, click the button labeled "Use Only the reference variable selected and click on one of the column variables just selected to represent the reference distribution. 5. If each column variable is to be considered as a reference variable, click on the other button labeled "Let each variable be a reference variable" 6. Change the alpha level for significance if desired. 7. Check the Bonferroni contrasts if desired. 8. Click the Compute button to obtain the results.
143=Directions: Your data grid should consist of a table of N rows and M+1 column variables. Each row should have a string type label variable and M columns of integer frequency data.\n1. Enter the variable for the row labels (strings)\n2. Enter the variables representing the columns of frequency integers.\n3. Select the Options desired.\n4. If only one variable is to be considered the reference variable, click the button labeled "Use Only the reference variable selected and click on one of the column variables just selected to represent the reference distribution.\n5. If each column variable is to be considered as a reference variable, click on the other button labeled "Let each variable be a reference variable".\n6. Change the alpha level for significance if desired.\n7. Check the Bonferroni contrasts if desired.\n8. Click the Compute button to obtain the results.
144=This procedure calculates the Pearson Product-Moment correlation coefficients for two or more variables. If one or more of the variables selected have been filtered out or contain a missing value, the case containing that variable will not be included in the analysis (list-wise deletion.) You may elect to obtain not only the correlations but also the raw cross-products, the variance-covariance matrix and the means, variances and standard deviations of the variables. Click on the variable in the list to the left and enter it for analysis by clicking the right arrow box. Repeat this for each variable to be included or click the ALL button to include all variables.
145=Directions: First click on the variable name that represents the sample lot number. Next, click on the variable that represents the measurement. Click the Compute Button to obtain the results. NOTE! Equal group (lot) sizes of 2 to 25 required for Sigma analysis. Control limits are plus and minus 3 sigma. Up to 200 lots may be analyzed.
146=Description: Straight Line Depreciation calculates the depreciation allowance for an asset over one period in it's life. The function divides the cost minus the salvage value by the number of years of useful life of the asset. Cost is the inital amount paid for the asset. Salvage is the value left at the end of the asset's life. EXAMPLE: What is the depreciation value on might expect for a computer purchased for $2,000.00 and expected to have a useful life of three years with no residual value? ANSWER: Approximately $666.67

View File

@ -897,7 +897,7 @@
<Unit99>
<Filename Value="forms\analysis\nonparametric\riditunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RIDITFrm"/>
<ComponentName Value="RIDITForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RIDITUnit"/>

View File

@ -1,463 +1,411 @@
object RIDITFrm: TRIDITFrm
Left = 1022
Height = 364
Top = 285
Width = 665
inherited RIDITForm: TRIDITForm
Left = 778
Height = 477
Top = 182
Width = 673
HelpType = htKeyword
HelpKeyword = 'html/RIDITAnalysis.htm'
AutoSize = True
Caption = 'Relative to an Identified Distribution Analysis'
ClientHeight = 364
ClientWidth = 665
OnActivate = FormActivate
OnCreate = FormCreate
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object Label5: TLabel
AnchorSideLeft.Control = BonChk
AnchorSideTop.Control = AlphaEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = AlphaEdit
Left = 412
Height = 15
Top = 291
Width = 187
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = '2-tailed Alpha for significance'
ParentColor = False
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = RefGrp
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 400
Height = 156
Top = 8
Width = 257
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 136
ClientWidth = 253
TabOrder = 1
object ObsChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 211
Caption = 'Show Observed Frequencies'
TabOrder = 0
ClientHeight = 477
ClientWidth = 673
inherited ParamsPanel: TPanel
Height = 461
Width = 416
ClientHeight = 461
ClientWidth = 416
inherited CloseBtn: TButton
Left = 361
Top = 436
end
object ExpChk: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 211
Caption = 'Show Expected Frequencies'
TabOrder = 1
inherited ComputeBtn: TButton
Left = 277
Top = 436
end
object PropChk: TCheckBox
Left = 12
Height = 19
Top = 48
Width = 211
Caption = 'Show Row and Column Proportions'
TabOrder = 2
inherited ResetBtn: TButton
Left = 215
Top = 436
end
object ChiChk: TCheckBox
Left = 12
Height = 19
Top = 69
Width = 211
Caption = 'Show Cell Chi-Square Values'
TabOrder = 3
inherited HelpBtn: TButton
Tag = 143
Left = 156
Top = 436
end
object YatesChk: TCheckBox
Left = 12
Height = 19
Top = 90
Width = 211
Caption = 'Use Yate''s Correction for a 2x2 Table'
inherited ButtonBevel: TBevel
Top = 420
Width = 416
end
object AlphaLabel: TLabel[5]
AnchorSideLeft.Control = RefGrp
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RefGrp
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = AlphaEdit
AnchorSideBottom.Control = RefGrp
AnchorSideBottom.Side = asrBottom
Left = 265
Height = 71
Top = 349
Width = 88
Alignment = taRightJustify
Anchors = [akTop, akLeft, akBottom]
AutoSize = False
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = '2-tailed Alpha for significance'
Layout = tlCenter
ParentColor = False
WordWrap = True
end
object GroupBox1: TGroupBox[6]
AnchorSideLeft.Control = RefGrp
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = RefGrp
Left = 0
Height = 114
Top = 222
Width = 422
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 12
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 94
ClientWidth = 418
TabOrder = 4
object ObsChk: TCheckBox
Left = 12
Height = 19
Top = 6
Width = 211
Caption = 'Show Observed Frequencies'
TabOrder = 0
end
object ExpChk: TCheckBox
Left = 235
Height = 19
Top = 6
Width = 171
Caption = 'Show Expected Frequencies'
TabOrder = 1
end
object PropChk: TCheckBox
Left = 12
Height = 19
Top = 27
Width = 211
Caption = 'Show Row and Column Proportions'
TabOrder = 2
end
object ChiChk: TCheckBox
Left = 235
Height = 19
Top = 27
Width = 171
Caption = 'Show Cell Chi-Square Values'
TabOrder = 3
end
object YatesChk: TCheckBox
Left = 12
Height = 19
Top = 48
Width = 211
Caption = 'Use Yate''s Correction for a 2x2 Table'
TabOrder = 4
end
object DetailsChk: TCheckBox
Left = 235
Height = 19
Top = 48
Width = 171
Caption = 'Show Computational Details'
TabOrder = 5
end
object BonChk: TCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 12
Height = 19
Top = 69
Width = 211
BorderSpacing.Left = 12
BorderSpacing.Right = 8
Caption = 'Use Bonferroni for contrasts'
TabOrder = 6
end
end
object DetailsChk: TCheckBox
Left = 12
Height = 19
Top = 111
Width = 211
Caption = 'Show Computational Details'
TabOrder = 5
end
end
object RefGrp: TRadioGroup
AnchorSideTop.Control = GroupBox1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 400
Height = 72
Top = 176
Width = 257
Anchors = [akTop, akRight]
AutoFill = True
AutoSize = True
BorderSpacing.Top = 12
BorderSpacing.Right = 8
Caption = 'Reference Variable'
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 52
ClientWidth = 253
Items.Strings = (
'Let each variable be a reference variable'
'Use only the reference variable selected'
)
OnClick = RefGrpClick
TabOrder = 2
end
object BonChk: TCheckBox
AnchorSideLeft.Control = RefGrp
AnchorSideTop.Control = RefGrp
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 412
Height = 19
Top = 260
Width = 167
BorderSpacing.Left = 12
BorderSpacing.Top = 12
BorderSpacing.Right = 8
Caption = 'Use Bonferroni for contrasts'
TabOrder = 3
end
object AlphaEdit: TEdit
AnchorSideTop.Control = BonChk
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 607
Height = 23
Top = 287
Width = 50
Alignment = taRightJustify
Anchors = [akTop, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
TabOrder = 4
Text = 'AlphaEdit'
end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 452
Height = 25
Top = 331
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 6
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 598
Height = 25
Top = 331
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
TabOrder = 7
end
object ComputeBtn: TButton
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 514
Height = 25
Top = 331
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 8
end
object HelpBtn: TButton
Tag = 143
AnchorSideRight.Control = ResetBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 393
Height = 25
Top = 331
Width = 51
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 5
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 6
Top = 317
Width = 665
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object Panel1: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = RefGrp
AnchorSideBottom.Control = Bevel1
Left = 0
Height = 309
Top = 0
Width = 400
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 309
ClientWidth = 400
TabOrder = 0
object Label1: TLabel
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
Left = 8
Height = 15
Top = 8
Width = 46
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Variables'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = RowEdit
AnchorSideBottom.Control = RowEdit
Left = 222
Height = 15
Top = 33
Width = 103
object RefGrp: TRadioGroup[7]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 72
Top = 348
Width = 257
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Row Labels Variable'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = ColList
AnchorSideTop.Control = ColIn
Left = 222
Height = 15
Top = 117
Width = 92
Caption = 'Column Variables'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = RefEdit
AnchorSideBottom.Control = RefEdit
Left = 222
Height = 15
Top = 269
Width = 96
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 8
BorderSpacing.Bottom = 2
AutoFill = True
AutoSize = True
BorderSpacing.Top = 12
BorderSpacing.Right = 8
Caption = 'Reference Variable'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = RowIn
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 284
Top = 25
Width = 170
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object RowIn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 186
Height = 28
Top = 25
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = RowInClick
Spacing = 0
TabOrder = 1
end
object RowOut: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = RowIn
AnchorSideTop.Side = asrBottom
Left = 186
Height = 28
Top = 57
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = RowOutClick
Spacing = 0
TabOrder = 2
end
object ColIn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = RowOut
AnchorSideTop.Side = asrBottom
Left = 186
Height = 28
Top = 117
Width = 28
BorderSpacing.Top = 32
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = ColInClick
Spacing = 0
TabOrder = 4
end
object ColOut: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = ColIn
AnchorSideTop.Side = asrBottom
Left = 186
Height = 28
Top = 147
Width = 28
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = ColOutClick
Spacing = 0
ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 52
ClientWidth = 253
Items.Strings = (
'Let each variable be a reference variable'
'Use only the reference variable selected'
)
OnClick = RefGrpClick
TabOrder = 5
end
object RowEdit: TEdit
AnchorSideLeft.Control = RowIn
object AlphaEdit: TEdit[8]
AnchorSideLeft.Control = AlphaLabel
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideTop.Control = AlphaLabel
AnchorSideTop.Side = asrCenter
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = RowOut
AnchorSideBottom.Side = asrBottom
Left = 222
Left = 361
Height = 23
Top = 50
Width = 178
Anchors = [akLeft, akRight, akBottom]
Top = 373
Width = 50
Alignment = taRightJustify
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'RowEdit'
end
object ColList: TListBox
AnchorSideLeft.Control = ColOut
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Label4
Left = 222
Height = 127
Top = 134
Width = 170
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Top = 8
BorderSpacing.Right = 8
ItemHeight = 0
OnClick = ColListClick
OnSelectionChange = VarListSelectionChange
BorderSpacing.Bottom = 8
TabOrder = 6
Text = 'AlphaEdit'
end
object RefEdit: TEdit
AnchorSideLeft.Control = ColOut
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
object Panel1: TPanel[9]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 222
Height = 23
Top = 286
Width = 170
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
ReadOnly = True
AnchorSideBottom.Control = GroupBox1
Left = 0
Height = 214
Top = 0
Width = 416
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 8
BevelOuter = bvNone
ClientHeight = 214
ClientWidth = 416
TabOrder = 7
Text = 'RefEdit'
end
object Bevel2: TBevel
Left = 386
Height = 20
Top = 288
Width = 14
Shape = bsSpacer
object Label1: TLabel
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Panel1
Left = 8
Height = 15
Top = 8
Width = 46
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Variables'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = RowEdit
AnchorSideBottom.Control = RowEdit
Left = 230
Height = 15
Top = 33
Width = 103
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Row Labels Variable'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = ColList
AnchorSideTop.Control = ColIn
Left = 230
Height = 15
Top = 101
Width = 92
Caption = 'Column Variables'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = RefEdit
AnchorSideBottom.Control = RefEdit
Left = 230
Height = 15
Top = 174
Width = 96
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 16
BorderSpacing.Bottom = 2
Caption = 'Reference Variable'
ParentColor = False
end
object VarList: TListBox
AnchorSideLeft.Control = Panel1
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = RowIn
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 189
Top = 25
Width = 178
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 0
end
object RowIn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 194
Height = 28
Top = 25
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = RowInClick
Spacing = 0
TabOrder = 1
end
object RowOut: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = RowIn
AnchorSideTop.Side = asrBottom
Left = 194
Height = 28
Top = 57
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = RowOutClick
Spacing = 0
TabOrder = 2
end
object ColIn: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = RowOut
AnchorSideTop.Side = asrBottom
Left = 194
Height = 28
Top = 101
Width = 28
BorderSpacing.Top = 16
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = ColInClick
Spacing = 0
TabOrder = 4
end
object ColOut: TBitBtn
AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = ColIn
AnchorSideTop.Side = asrBottom
Left = 194
Height = 28
Top = 131
Width = 28
BorderSpacing.Top = 2
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = ColOutClick
Spacing = 0
TabOrder = 5
end
object RowEdit: TEdit
AnchorSideLeft.Control = RowIn
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = RowOut
AnchorSideBottom.Side = asrBottom
Left = 230
Height = 23
Top = 50
Width = 186
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'RowEdit'
end
object ColList: TListBox
AnchorSideLeft.Control = ColOut
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Label4
Left = 230
Height = 40
Top = 118
Width = 178
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
ItemHeight = 0
OnClick = ColListClick
OnDblClick = ColListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 6
end
object RefEdit: TEdit
AnchorSideLeft.Control = ColOut
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 230
Height = 23
Top = 191
Width = 178
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 7
Text = 'RefEdit'
end
object Bevel2: TBevel
Left = 386
Height = 20
Top = 288
Width = 14
Shape = bsSpacer
end
end
end
inherited ParamsSplitter: TSplitter
Left = 428
Height = 477
end
end

View File

@ -5,25 +5,20 @@ unit RIDITUnit;
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls,
MainUnit, Globals, FunctionsLib, OutputUnit, MatrixLib, ContextHelpUnit;
MainUnit, Globals, FunctionsLib, MatrixLib, BasicStatsReportFormUnit;
type
{ TRIDITFrm }
{ TRIDITForm }
TRIDITFrm = class(TForm)
Bevel1: TBevel;
TRIDITForm = class(TBasicStatsReportForm)
Bevel2: TBevel;
BonChk: TCheckBox;
AlphaEdit: TEdit;
HelpBtn: TButton;
Panel1: TPanel;
ResetBtn: TButton;
CloseBtn: TButton;
ComputeBtn: TButton;
Label5: TLabel;
AlphaLabel: TLabel;
ObsChk: TCheckBox;
ExpChk: TCheckBox;
PropChk: TCheckBox;
@ -46,123 +41,208 @@ type
VarList: TListBox;
procedure ColInClick(Sender: TObject);
procedure ColListClick(Sender: TObject);
procedure ColListDblClick(Sender: TObject);
procedure ColOutClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure RefGrpClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
procedure RowInClick(Sender: TObject);
procedure RowOutClick(Sender: TObject);
procedure Analyze(RefCol: integer; ColNoSelected: IntDyneVec;
RowLabels: StrDyneVec; ColLabels: StrDyneVec;
NoToAnalyze: integer; Freq: IntDyneMat;
Props: DblDyneMat; NoRows: integer; AReport: TStrings);
procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean);
private
{ private declarations }
FAutoSized: Boolean;
procedure UpdateBtnStates;
protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
public
{ public declarations }
procedure Reset; override;
end;
var
RIDITFrm: TRIDITFrm;
RIDITForm: TRIDITForm;
implementation
{$R *.lfm}
uses
Math,
Utils;
Utils, GridProcs;
{ TRIDITFrm }
{ TRIDITForm }
procedure TRIDITFrm.ResetBtnClick(Sender: TObject);
var
i: integer;
procedure TRIDITForm.AdjustConstraints;
begin
VarList.Clear;
ColList.Clear;
RowEdit.Text := '';
RefEdit.Text := '';
AlphaEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
BonChk.Checked := true;
Label4.Visible := false;
RefEdit.Visible := false;
RefGrp.ItemIndex := 0;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
UpdateBtnStates;
inherited;
ParamsPanel.Constraints.MinWidth := MaxValue([
CloseBtn.Width * 4 + CloseBtn.BorderSpacing.Left * 3,
GroupBox1.Width,
AlphaEdit.Left + AlphaEdit.Width
]);
ParamsPanel.Constraints.MinHeight := ColOut.Top + ColOut.Height +
Label4.BorderSpacing.Top + Label4.Height + Label4.BorderSpacing.Bottom + RefEdit.Height +
Panel1.BorderSpacing.Bottom + GroupBox1.Height + RefGrp.Height +
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
end;
procedure TRIDITFrm.RowInClick(Sender: TObject);
procedure TRIDITForm.Analyze(RefCol : integer; ColNoSelected : IntDyneVec;
RowLabels : StrDyneVec; ColLabels : StrDyneVec;
NoToAnalyze : integer; Freq : IntDyneMat;
Props : DblDyneMat; NoRows : integer;
AReport: TStrings);
var
index: integer;
probdists : DblDyneMat;
refprob : DblDyneMat;
sizes : DblDyneVec;
meanridits : DblDyneVec;
Cratios : DblDyneVec;
OverMeanRidit : double;
chisquare : double;
probchi : double;
alpha : double;
StdErr : DblDyneVec;
Bonferroni : double;
i, j : integer;
outline : string;
details : boolean;
term1,term2,term3,term4 : double;
begin
index := VarList.ItemIndex;
if (index > -1) and (RowEdit.Text = '') then
SetLength(probdists,NoRows,NoToAnalyze);
SetLength(refprob,NoRows,4);
SetLength(sizes,NoToAnalyze);
SetLength(meanridits,NoToAnalyze);
SetLength(Cratios,NoToAnalyze);
SetLength(StdErr,NoToAnalyze);
alpha := StrToFloat(AlphaEdit.Text);
details := DetailsChk.Checked;
AReport.Add('ANALYSIS FOR STANDARD %s', [ColLabels[RefCol]]);
// AReport.Add('');
// print frequencies
outline := 'Frequencies Observed';
IntArrayPrint(Freq, NoRows, NoToAnalyze, 'Frequencies', RowLabels, ColLabels, outline, AReport);
// print column proportions
outline := 'Column Proportions Observed';
MatPrint(Props, NoRows, NoToAnalyze, outline, RowLabels, ColLabels, NoCases, AReport);
// Get sizes in each column
for i := 0 to NoToAnalyze - 1 do
sizes[i] := Freq[NoRows,i];
// Get the reference variable probabilities for all variables
for j := 0 to NoToAnalyze - 1 do
begin
RowEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
UpdateBtnStates;
end;
for i := 0 to NoRows - 1 do
begin
refprob[i,0] := Props[i,j];
refprob[i,1] := Props[i,j] / 2.0;
end;
refprob[0,2] := 0.0;
for i := 1 to NoRows - 1 do refprob[i,2] := refprob[i-1,2] + refprob[i-1,0];
for i := 0 to NoRows - 1 do refprob[i,3] := refprob[i,1] + refprob[i,2];
if (details) then // print calculations table
begin
outline := 'Ridit calculations for ' + ColLabels[j];
MatPrint(refprob, NoRows, 4, outline, RowLabels, ColLabels, NoCases, AReport);
end;
procedure TRIDITFrm.RowOutClick(Sender: TObject);
begin
if RowEdit.Text <> '' then
// store results in probdists
for i := 0 to NoRows - 1 do probdists[i,j] := refprob[i,3];
end;
outline := 'Ridits for all variables';
MatPrint(probdists, NoRows, NoToAnalyze, outline, RowLabels, ColLabels, NoCases, AReport);
// obtain mean ridits for the all variables using the reference variable
for i := 0 to NoToAnalyze - 1 do
begin
VarList.Items.Add(RowEdit.Text);
RowEdit.Text := '';
meanridits[i] := 0.0;
for j := 0 to NoRows - 1 do
meanridits[i] := meanridits[i] + (probdists[j,RefCol] * Freq[j,i]);
meanridits[i] := meanridits[i] / sizes[i];
end;
UpdateBtnStates;
// print the means using the reference variable
outline := 'Mean RIDITS Using the Reference Values';
DynVectorPrint(meanridits, NoToAnalyze, outline, ColLabels, NoCases, AReport);
// obtain the weighted grand mean ridit
OverMeanRidit := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then OverMeanRidit := OverMeanRidit + sizes[i] * meanridits[i];
OverMeanRidit := OverMeanRidit / (Freq[NoRows,NoToAnalyze] - sizes[RefCol]);
AReport.Add('Overall mean for RIDITS in non-reference groups: %8.4f', [OverMeanRidit]);
// obtain chisquare
chisquare := 0.0;
term4 := sqr(OverMeanRidit - 0.5);
term3 := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then term3 := term3 + sizes[i] * sizes[i];
term3 := 12.0 * term3;
term2 := Freq[NoRows,NoToAnalyze];
term1 := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then
term1 := term1 + sizes[i] * sqr(meanridits[i] - 0.5);
term1 := term1 * 12.0;
chisquare := term1 - (term3 / term2) * term4;
probchi := 1.0 - ChiSquaredProb(chisquare, NoToAnalyze-1);
AReport.Add('Chisquared: %8.4f', [chisquare]);
AReport.Add(' with probability < %8.4f', [probchi]);
// do pairwise comparisons
Cratios[RefCol] := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then
begin
StdErr[i] := sqrt(sizes[RefCol] + sizes[i]) / (2.0 * sqrt(3.0 * sizes[RefCol] * sizes[i]));
Cratios[i] := (meanridits[i] - 0.5) / StdErr[i];
end;
outline := 'z critical ratios';
DynVectorPrint(Cratios, NoToAnalyze, outline, ColLabels, NoCases, AReport);
alpha := alpha / 2.0;
if (BonChk.Checked) then alpha := alpha / (NoToAnalyze - 1);
Bonferroni := InverseZ(1.0 - alpha);
AReport.Add('Significance level used for comparisons: %8.3f', [Bonferroni]);
AReport.Add('');
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then
begin
if (abs(Cratios[i]) > Bonferroni) then
AReport.Add('%s vs %s: significant', [ColLabels[i], ColLabels[RefCol]])
else
AReport.Add('%s vs %s: not significant', [ColLabels[i], ColLabels[RefCol]]);
end;
// cleanup
StdErr := nil;
Cratios := nil;
meanridits := nil;
sizes := nil;
refprob := nil;
probdists := nil;
end;
procedure TRIDITFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
HelpBtn.Constraints.MinWidth := w;
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TRIDITFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
end;
procedure TRIDITFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TRIDITFrm.HelpBtnClick(Sender: TObject);
begin
if ContextHelpForm = nil then
Application.CreateForm(TContextHelpForm, ContextHelpForm);
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
procedure TRIDITFrm.RefGrpClick(Sender: TObject);
begin
RefEdit.Visible := RefGrp.ItemIndex > 0;
Label4.Visible := RefEdit.Visible;
end;
procedure TRIDITFrm.ColInClick(Sender: TObject);
procedure TRIDITForm.ColInClick(Sender: TObject);
var
i: integer;
begin
@ -180,7 +260,8 @@ begin
UpdateBtnStates;
end;
procedure TRIDITFrm.ColListClick(Sender: TObject);
procedure TRIDITForm.ColListClick(Sender: TObject);
var
index: integer;
begin
@ -190,7 +271,22 @@ begin
UpdateBtnStates;
end;
procedure TRIDITFrm.ColOutClick(Sender: TObject);
procedure TRIDITForm.ColListDblClick(Sender: TObject);
var
index: Integer;
begin
index := ColList.ItemIndex;
if index > -1 then
begin
VarList.Items.Add(ColList.Items[index]);
ColList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TRIDITForm.ColOutClick(Sender: TObject);
var
index: integer;
begin
@ -203,7 +299,8 @@ begin
UpdateBtnStates;
end;
procedure TRIDITFrm.ComputeBtnClick(Sender: TObject);
procedure TRIDITForm.Compute;
var
AllRefs : boolean;
i, j, RowNo, RefColNo, NoToAnalyze : integer;
@ -220,98 +317,50 @@ var
likelihood, problikelihood, phi: double;
pearsonr, VarX, VarY, SumX, SumY, MantelHaenszel, MHProb, CoefCont: double;
CramerV: double;
tmp: Double;
lReport: TStrings;
begin
if AlphaEdit.Text = '' then
begin
AlphaEdit.SetFocus;
MessageDlg('Alpha level not specified.', mtError, [mbOK], 0);
exit;
end;
if not TryStrToFloat(AlphaEdit.Text, tmp) then
begin
AlphaEdit.Setfocus;
MessageDlg('Numeric input required for alpha level.', mtError, [mbOK], 0);
exit;
end;
if (tmp <= 0) or (tmp >= 1) then
begin
AlphaEdit.Setfocus;
MessageDlg('Alpha level must be > 0 and < 1', mtError, [mbOK], 0);
exit;
end;
AllRefs := RefGrp.ItemIndex = 0;
SetLength(ColNoSelected,NoVariables+1);
RowNo := 0;
for i := 1 to NoVariables do
SetLength(ColNoSelected, NoVariables+1); // +1 due to RowNo in first element
RowNo := GetVariableIndex(OS3MainFrm.DataGrid, RowEdit.Text);
if (RowNo = -1) then
begin
cellstring := OS3MainFrm.DataGrid.Cells[i,0];
if (cellstring = RowEdit.Text) then RowNo := i;
end;
{
results := VarTypeChk(RowNo,2);
if (result = 1)
begin
delete[] ColNoSelected;
return;
end;
}
Nrows := NoCases;
Ncols := ColList.Items.Count;
SetLength(RowLabels,Nrows+1);
SetLength(ColLabels,Ncols+1);
if (RowNo = 0) then
begin
MessageDlg('A variable for the row labels was not entered.', mtError, [mbOK], 0);
ColNoSelected := nil;
exit;
RowEdit.Setfocus;
ErrorMsg('A variable for the row labels was not entered.');
ColNoSelected := nil;
exit;
end;
ColNoSelected[0] := RowNo;
// Get Column labels
for i := 0 to Ncols - 1 do
begin
ColLabels[i] := ColList.Items.Strings[i];
for j := 1 to NoVariables do
begin
cellstring := OS3MainFrm.DataGrid.Cells[j,0];
if (cellstring = ColLabels[i]) then
begin
ColNoSelected[i+1] := j;
{ result := VarTypeChk(j,1);
if (result = 1)
begin
delete[] ColLabels;
delete[] RowLabels;
delete[] ColNoSelected;
return;
end; }
end;
end;
end;
// Get row labels
for i := 1 to NoCases do
NRows := NoCases;
SetLength(RowLabels, NRows+1); // wp: why +1?
for i := 1 to NRows do
RowLabels[i-1] := OS3MainFrm.DataGrid.Cells[RowNo,i];
// Get Column labels
NCols := ColList.Items.Count;
SetLength(ColLabels, NCols+1); // wp: why +1?
for i := 0 to ColList.Items.Count-1 do
begin
ColLabels[i] := ColList.Items[i];
ColNoSelected[i+1] := GetVariableIndex(OS3MainFrm.DataGrid, ColLabels[i]);
end;
// allocate and initialize
SetLength(Freq, Nrows+1, Ncols+1);
SetLength(Prop, Nrows+1, Ncols+1);
SetLength(Expected, Nrows, Ncols);
SetLength(CellChi, Nrows, Ncols);
for i := 1 to Nrows + 1 do
for j := 1 to Ncols + 1 do
SetLength(Freq, NRows+1, NCols+1);
SetLength(Prop, NRows+1, NCols+1);
SetLength(Expected, NRows, NCols);
SetLength(CellChi, NRows, NCols);
for i := 1 to NRows + 1 do
for j := 1 to NCols + 1 do
Freq[i-1,j-1] := 0;
RowLabels[Nrows] := 'Total';
ColLabels[Ncols] := 'Total';
RowLabels[NRows] := 'Total';
ColLabels[NCols] := 'Total';
// get cell data
Ncases := 0;
NCases := 0;
for i := 1 to NoCases do
begin
Row := i;
@ -354,7 +403,7 @@ begin
CellChi[i-1,j-1] := sqr(Freq[i-1,j-1] - Expected[i-1,j-1])/ Expected[i-1,j-1]
else
begin
MessageDlg('Zero expected value found.', mtError, [mbOK], 0);
ErrorMsg('Zero expected value found.');
CellChi[i-1,j-1] := 0.0;
end;
ChiSquare := ChiSquare + CellChi[i-1,j-1];
@ -364,10 +413,10 @@ begin
if yates then // 2 x 2 corrected chi-square
begin
Adjchisqr := abs((Freq[0,0] * Freq[1,1]) - (Freq[0,1] * Freq[1,0]));
Adjchisqr := sqr(Adjchisqr - Ncases / 2.0) * Ncases; // numerator
Adjchisqr := Adjchisqr / (Freq[0,2] * Freq[1,2] * Freq[2,0] * Freq[2,1]);
Adjprobchi := 1.0 - chisquaredprob(Adjchisqr,df);
AdjChiSqr := abs((Freq[0,0] * Freq[1,1]) - (Freq[0,1] * Freq[1,0]));
AdjChiSqr := sqr(AdjChiSqr - Ncases / 2.0) * Ncases; // numerator
AdjChiSqr := AdjChiSqr / (Freq[0,2] * Freq[1,2] * Freq[2,0] * Freq[2,1]);
AdjProbChi := 1.0 - chisquaredprob(AdjChiSqr,df);
end;
end;
@ -395,7 +444,7 @@ begin
df := Nrows - 1;
end;
ProbChi := 1.0 - chisquaredprob(ChiSquare,df); // prob. larger chi
ProbChi := 1.0 - ChiSquaredProb(ChiSquare, df); // prob. larger chi
//Print results to output form
lReport := TStringList.Create;
@ -555,174 +604,72 @@ begin
Analyze(RefColNo, ColNoSelected, RowLabels,ColLabels, NoToAnalyze, Freq, Prop, Nrows, lReport);
end;
DisplayReport(lReport);
FReportFrame.DisplayReport(lReport);
finally
lReport.Free;
ColLabels := nil;
RowLabels := nil;
CellChi := nil;
Expected := nil;
Prop := nil;
Freq := nil;
ColNoSelected := nil;
end;
end;
procedure TRIDITFrm.Analyze(RefCol : integer; ColNoSelected : IntDyneVec;
RowLabels : StrDyneVec; ColLabels : StrDyneVec;
NoToAnalyze : integer; Freq : IntDyneMat;
Props : DblDyneMat; NoRows : integer;
AReport: TStrings);
procedure TRIDITForm.RefGrpClick(Sender: TObject);
begin
RefEdit.Visible := RefGrp.ItemIndex > 0;
Label4.Visible := RefEdit.Visible;
end;
procedure TRIDITForm.Reset;
var
probdists : DblDyneMat;
refprob : DblDyneMat;
sizes : DblDyneVec;
meanridits : DblDyneVec;
Cratios : DblDyneVec;
OverMeanRidit : double;
chisquare : double;
probchi : double;
alpha : double;
StdErr : DblDyneVec;
Bonferroni : double;
i, j : integer;
outline : string;
details : boolean;
term1,term2,term3,term4 : double;
i: integer;
begin
SetLength(probdists,NoRows,NoToAnalyze);
SetLength(refprob,NoRows,4);
SetLength(sizes,NoToAnalyze);
SetLength(meanridits,NoToAnalyze);
SetLength(Cratios,NoToAnalyze);
SetLength(StdErr,NoToAnalyze);
inherited;
alpha := StrToFloat(AlphaEdit.Text);
details := DetailsChk.Checked;
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
ColList.Clear;
RowEdit.Clear;
RefEdit.Clear;
AlphaEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
BonChk.Checked := true;
Label4.Visible := false;
RefEdit.Visible := false;
RefGrp.ItemIndex := 0;
AReport.Add('ANALYSIS FOR STANDARD %s', [ColLabels[RefCol]]);
// AReport.Add('');
// print frequencies
outline := 'Frequencies Observed';
IntArrayPrint(Freq, NoRows, NoToAnalyze, 'Frequencies', RowLabels, ColLabels, outline, AReport);
// print column proportions
outline := 'Column Proportions Observed';
MatPrint(Props, NoRows, NoToAnalyze, outline, RowLabels, ColLabels, NoCases, AReport);
// Get sizes in each column
for i := 0 to NoToAnalyze - 1 do
sizes[i] := Freq[NoRows,i];
// Get the reference variable probabilities for all variables
for j := 0 to NoToAnalyze - 1 do
begin
for i := 0 to NoRows - 1 do
begin
refprob[i,0] := Props[i,j];
refprob[i,1] := Props[i,j] / 2.0;
end;
refprob[0,2] := 0.0;
for i := 1 to NoRows - 1 do refprob[i,2] := refprob[i-1,2] + refprob[i-1,0];
for i := 0 to NoRows - 1 do refprob[i,3] := refprob[i,1] + refprob[i,2];
if (details) then // print calculations table
begin
outline := 'Ridit calculations for ' + ColLabels[j];
MatPrint(refprob, NoRows, 4, outline, RowLabels, ColLabels, NoCases, AReport);
end;
// store results in probdists
for i := 0 to NoRows - 1 do probdists[i,j] := refprob[i,3];
end;
outline := 'Ridits for all variables';
MatPrint(probdists, NoRows, NoToAnalyze, outline, RowLabels, ColLabels, NoCases, AReport);
// obtain mean ridits for the all variables using the reference variable
for i := 0 to NoToAnalyze - 1 do
begin
meanridits[i] := 0.0;
for j := 0 to NoRows - 1 do
meanridits[i] := meanridits[i] + (probdists[j,RefCol] * Freq[j,i]);
meanridits[i] := meanridits[i] / sizes[i];
end;
// print the means using the reference variable
outline := 'Mean RIDITS Using the Reference Values';
DynVectorPrint(meanridits, NoToAnalyze, outline, ColLabels, NoCases, AReport);
// obtain the weighted grand mean ridit
OverMeanRidit := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then OverMeanRidit := OverMeanRidit + sizes[i] * meanridits[i];
OverMeanRidit := OverMeanRidit / (Freq[NoRows,NoToAnalyze] - sizes[RefCol]);
AReport.Add('Overall mean for RIDITS in non-reference groups: %8.4f', [OverMeanRidit]);
// obtain chisquare
chisquare := 0.0;
term4 := sqr(OverMeanRidit - 0.5);
term3 := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then term3 := term3 + sizes[i] * sizes[i];
term3 := 12.0 * term3;
term2 := Freq[NoRows,NoToAnalyze];
term1 := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then
term1 := term1 + sizes[i] * sqr(meanridits[i] - 0.5);
term1 := term1 * 12.0;
chisquare := term1 - (term3 / term2) * term4;
probchi := 1.0 - ChiSquaredProb(chisquare, NoToAnalyze-1);
AReport.Add('Chisquared: %8.4f', [chisquare]);
AReport.Add(' with probability < %8.4f', [probchi]);
// do pairwise comparisons
Cratios[RefCol] := 0.0;
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then
begin
StdErr[i] := sqrt(sizes[RefCol] + sizes[i]) / (2.0 * sqrt(3.0 * sizes[RefCol] * sizes[i]));
Cratios[i] := (meanridits[i] - 0.5) / StdErr[i];
end;
outline := 'z critical ratios';
DynVectorPrint(Cratios, NoToAnalyze, outline, ColLabels, NoCases, AReport);
alpha := alpha / 2.0;
if (BonChk.Checked) then alpha := alpha / (NoToAnalyze - 1);
Bonferroni := InverseZ(1.0 - alpha);
AReport.Add('Significance level used for comparisons: %8.3f', [Bonferroni]);
AReport.Add('');
for i := 0 to NoToAnalyze - 1 do
if (i <> RefCol) then
begin
if (abs(Cratios[i]) > Bonferroni) then
AReport.Add('%s vs %s: significant', [ColLabels[i], ColLabels[RefCol]])
else
AReport.Add('%s vs %s: not significant', [ColLabels[i], ColLabels[RefCol]]);
end;
// cleanup
StdErr := nil;
Cratios := nil;
meanridits := nil;
sizes := nil;
refprob := nil;
probdists := nil;
end;
procedure TRIDITFrm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TRIDITFrm.UpdateBtnStates;
procedure TRIDITForm.RowInClick(Sender: TObject);
var
index: integer;
begin
index := VarList.ItemIndex;
if (index > -1) and (RowEdit.Text = '') then
begin
RowEdit.Text := VarList.Items[index];
VarList.Items.Delete(index);
end;
UpdateBtnStates;
end;
procedure TRIDITForm.RowOutClick(Sender: TObject);
begin
if RowEdit.Text <> '' then
begin
VarList.Items.Add(RowEdit.Text);
RowEdit.Text := '';
end;
UpdateBtnStates;
end;
procedure TRIDITForm.UpdateBtnStates;
begin
inherited;
RowIn.Enabled := (VarList.ItemIndex > -1) and (RowEdit.Text = '');
RowOut.Enabled := (RowEdit.Text <> '');
@ -730,8 +677,61 @@ begin
ColOut.Enabled := (ColList.ItemIndex > -1);
end;
initialization
{$I riditunit.lrs}
function TRIDITForm.Validate(out AMsg: String; out AControl: TWinControl): Boolean;
var
tmp: Double;
begin
Result := false;
if AlphaEdit.Text = '' then
begin
AControl := AlphaEdit;
AMsg := 'Alpha level not specified.';
exit;
end;
if not TryStrToFloat(AlphaEdit.Text, tmp) then
begin
AControl := AlphaEdit;
AMsg := 'Numeric input required for alpha level.';
exit;
end;
if (tmp <= 0) or (tmp >= 1) then
begin
AControl := AlphaEdit;
AMsg := 'Alpha level must be > 0 and < 1';
exit;
end;
Result := true;
end;
procedure TRIDITForm.VarListDblClick(Sender: TObject);
var
index: Integer;
s: String;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
s := VarList.Items[index];
if RowEdit.Text = '' then
RowEdit.Text := s
else
ColList.Items.Add(s);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TRIDITForm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
end.

View File

@ -29,7 +29,7 @@ object SRHTest: TSRHTest
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Fact1In
AnchorSideBottom.Control = Bevel1
AnchorSideBottom.Control = ButtonBevel
Left = 8
Height = 361
Top = 221
@ -389,7 +389,7 @@ object SRHTest: TSRHTest
ModalResult = 1
TabOrder = 19
end
object Bevel1: TBevel
object ButtonBevel: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom

View File

@ -5,7 +5,7 @@ unit SRHTestUnit;
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls,
MainUnit, Globals, FunctionsLib, OutputUnit, DataProcs, GraphLib,
ContextHelpUnit;
@ -97,6 +97,8 @@ var
implementation
{$R *.lfm}
uses
Math, MathUnit;
@ -319,7 +321,8 @@ begin
end;
procedure TSRHTest.getlevels(Sender: TObject);
VAR i : integer;
var
i : integer;
begin
minf1 := 10000;
maxf1 := -10000;
@ -726,8 +729,6 @@ begin
GraphFrm.Ypoints := nil;
end;
initialization
{$I srhtestunit.lrs}
end.

View File

@ -916,47 +916,6 @@ begin
TwoPropFrm.ShowModal;
end;
// Menu "Analysis" > "Nonparametric" > "RIDIT Analysis"
procedure TOS3MainFrm.mnuAnalysisNonPar_RIDITClick(Sender: TObject);
begin
if RIDITFrm = nil then
Application.CreateForm(TRIDITFrm, RIDITFrm);
RIDITFrm.ShowModal;
end;
// Menu "Analysis" > "Nonparametric" > "Runs Test for Normality"
procedure TOS3MainFrm.mnuAnalysisNonPar_RunsTestClick(Sender: TObject);
begin
if RunsTestForm = nil then
Application.CreateForm(TRunsTestForm, RunsTestForm);
RunsTestForm.ShowModal;
end;
// Menu "Analysis" > "Nonparametric" > "mnuAnalysisNonPar_Sens's Slope Analysis"
procedure TOS3MainFrm.mnuAnalysisNonPar_SensClick(Sender: TObject);
begin
if SensForm = nil then
Application.CreateForm(TSensForm, SensForm);
SensForm.ShowModal;
end;
// Menu "Analysis" > "Nonparametric" > "Simple Chi Square for Categories"
procedure TOS3MainFrm.mnuAnalysisNonPar_SimpleChiSqClick(Sender: TObject);
begin
if SimpleChiSqrForm = nil then
Application.CreateForm(TSimpleChiSqrForm, SimpleChiSqrForm);
SimpleChiSqrForm.ShowModal;
end;
// Menu "Analysis" > "Nonparametric" > "Schreier-Ray-Heart Two-Way mnuAnalysisComp_Anova"
procedure TOS3MainFrm.mnuAnalysisNonPar_SRHClick(Sender: TObject);
begin
if SRHTest = nil then
Application.CreateForm(TSRHTest, SRHTest);
SRHTest.ShowModal;
end;
// Menu "Analysis" > "Comparisons" > "t-tests"
procedure TOS3MainFrm.mnuAnalysisComp_tTestsClick(Sender: TObject);
begin
@ -1920,6 +1879,47 @@ begin
KaplanMeierForm.Show;
end;
// Menu "Analysis" > "Nonparametric" > "RIDIT Analysis"
procedure TOS3MainFrm.mnuAnalysisNonPar_RIDITClick(Sender: TObject);
begin
if RIDITForm = nil then
Application.CreateForm(TRIDITForm, RIDITForm);
RIDITForm.Show;
end;
// Menu "Analysis" > "Nonparametric" > "Runs Test for Normality"
procedure TOS3MainFrm.mnuAnalysisNonPar_RunsTestClick(Sender: TObject);
begin
if RunsTestForm = nil then
Application.CreateForm(TRunsTestForm, RunsTestForm);
RunsTestForm.Show;
end;
// Menu "Analysis" > "Nonparametric" > "mnuAnalysisNonPar_Sens's Slope Analysis"
procedure TOS3MainFrm.mnuAnalysisNonPar_SensClick(Sender: TObject);
begin
if SensForm = nil then
Application.CreateForm(TSensForm, SensForm);
SensForm.ShowModal;
end;
// Menu "Analysis" > "Nonparametric" > "Simple Chi Square for Categories"
procedure TOS3MainFrm.mnuAnalysisNonPar_SimpleChiSqClick(Sender: TObject);
begin
if SimpleChiSqrForm = nil then
Application.CreateForm(TSimpleChiSqrForm, SimpleChiSqrForm);
SimpleChiSqrForm.ShowModal;
end;
// Menu "Analysis" > "Nonparametric" > "Schreier-Ray-Heart Two-Way mnuAnalysisComp_Anova"
procedure TOS3MainFrm.mnuAnalysisNonPar_SRHClick(Sender: TObject);
begin
if SRHTest = nil then
Application.CreateForm(TSRHTest, SRHTest);
SRHTest.ShowModal;
end;
{ Descriptive statistics commands }