Stat Tools Automation
Stat Tools Automation
Windows Version 5
April, 2009
Palisade Corporation
798 Cascadilla St
Ithaca, NY 14850
(607) 277-8000
http://www.palisade.com
Copyright Notice
Copyright © 2009, Palisade Corporation.
Trademark Acknowledgments
Microsoft, Excel and Windows are registered trademarks of Microsoft, Inc.
Lotus and 1-2-3 are registered trademarks of Lotus Development Corporation
IBM is a registered trademark of International Business Machines, Inc.
Palisade, TopRank, BestFit and RISKview are registered trademarks of Palisade Corporation.
RISK is a trademark of Parker Brothers, Division of Tonka Corporation and is used under license.
Contents
Introduction............................................................................................ 1
An Overview to Automating StatTools ........................................................ 1
Creation of Custom Analyses................................................................ 1
Automation of Existing Analyses ......................................................... 2
The Automation Components ....................................................................... 3
The StatTools Object Library (StatToolsOL.DLL)............................... 3
The StatTools Controls Library (STControls5.OCX) .......................... 4
The StatTools Core Pack Automation Library
(StatToolsCoreAL5.DLL)........................................................................ 5
Packs, Categories, and Analyses ................................................................... 6
Terminology............................................................................................. 6
Automation Objects ................................................................................ 7
The StatToolsAnalysis and StatToolsAnalyses Objects.......................... 8
Data Sets, Variables, and Variable Lists ....................................................... 9
Terminology............................................................................................. 9
Automation Objects ................................................................................ 9
Scanning Workbooks............................................................................ 10
Stacked and Unstacked Variables....................................................... 11
Creating New Data Sets and Variables .............................................. 14
Selecting Variables in Dialogs ............................................................. 15
Reports, Tables, and Charts ......................................................................... 16
Reports Objects...................................................................................... 16
Table Objects.......................................................................................... 18
Chart Objects.......................................................................................... 20
Live vs. Static Results ........................................................................... 20
Contents i
Creating a Defined Type and Global State Variable ........................ 26
The Required Public Subroutines ....................................................... 27
Compiling and Saving the New Analysis.......................................... 32
Debugging Your Custom Analysis..................................................... 33
Creating Analysis Packs ............................................................................... 34
Creating a Simple Custom Analysis Pack ......................................... 34
Customizing Packs with Configuration Files.................................... 34
Creating an Analysis Pack Help File .................................................. 38
ii
BuiltIn Property..................................................................................... 65
DebugMode Property........................................................................... 65
Default Method ..................................................................................... 66
DefaultDataSet Method........................................................................ 68
DefaultRange Method .......................................................................... 69
DefaultVariable Method ...................................................................... 70
DefaultVariableList Method................................................................ 71
HelpContextID Property...................................................................... 72
LoadAddIn Method.............................................................................. 73
MenuCaption Property ........................................................................ 74
Name Property ...................................................................................... 74
NewSheetName Property .................................................................... 75
ReportDescription Property ................................................................ 75
RequiresVariables Property................................................................. 76
Run Method ........................................................................................... 77
ShowHelp Method................................................................................ 78
UnloadAddin Method .......................................................................... 79
Utility Property ..................................................................................... 80
StatToolsAnalysisCategories Object ........................................................... 81
Count Property...................................................................................... 81
Item Property......................................................................................... 82
StatToolsAnalysisCategory Object .............................................................. 83
Analyses Property................................................................................. 83
AnalysisPack Property ......................................................................... 83
BeginGroup Property ........................................................................... 84
BuiltIn Property..................................................................................... 84
MenuCaption Property ........................................................................ 85
Name Property ...................................................................................... 85
ToolbarBitmapFile Property ................................................................ 86
StatToolsAnalysisPack Object...................................................................... 87
Analyses Property................................................................................. 87
AnalysisCategories Property............................................................... 87
BuiltIn Property..................................................................................... 88
Description Property ............................................................................ 88
HasConfigurationFile Property........................................................... 89
HelpPath Property ................................................................................ 89
Name Property ...................................................................................... 90
Path Property......................................................................................... 90
Priority Property ................................................................................... 91
ShowHelp Method................................................................................ 91
StatToolsAnalysisPacks Object .................................................................... 92
Count Property...................................................................................... 92
Item Property......................................................................................... 92
Contents iii
Path Property ......................................................................................... 93
StatToolsChart Object.................................................................................... 94
AddCategoryXAxis Method................................................................ 94
AddLegend Method.............................................................................. 95
AddTitle Method................................................................................... 95
AddValueXAxis Method...................................................................... 96
AddValueYAxis Method...................................................................... 97
AddWatermark Method....................................................................... 98
ApplyDefaultFormatting Method....................................................... 98
ApplyGradientToBars Method ........................................................... 99
Chart Property ....................................................................................... 99
DefaultSeriesColor Method ............................................................... 101
StatToolsDataSet Object .............................................................................. 103
Attach Method ..................................................................................... 103
AutoFitColumns Method ................................................................... 104
CreateUtilityVariables Method ......................................................... 104
CreateUtilityVariables_Validate Method ........................................ 106
DataRegion Property .......................................................................... 107
Delete Method ..................................................................................... 108
ExcelRange Property........................................................................... 108
ExcelRangeCount Property................................................................ 109
FormatRange Property ....................................................................... 109
Name Property .................................................................................... 110
NameRegion Property........................................................................ 111
Variables Property .............................................................................. 111
StatToolsDataSets Object ............................................................................ 113
Add Method......................................................................................... 113
AddMulti Method ............................................................................... 116
CheckModelLimitations Method ...................................................... 119
Count Property .................................................................................... 119
DeleteAll Method ................................................................................ 120
Find Method......................................................................................... 121
Item Property ....................................................................................... 122
Scan Method ........................................................................................ 123
ScannedWorkbook Property.............................................................. 124
ShowDataSetManager Method ......................................................... 124
TotalNumVariables Property ............................................................ 125
StatToolsProductInfo Object ...................................................................... 127
Copyright Property............................................................................. 127
DaysUntilExpiration Property .......................................................... 127
Edition Property .................................................................................. 128
Language Property.............................................................................. 128
LimitedModelSize Property............................................................... 129
Name Property .................................................................................... 129
ProductType Property ........................................................................ 130
iv
RegisteredCompany Property........................................................... 130
RegisteredSerialNumber Property ................................................... 131
RegisteredUser Property.................................................................... 131
Version Property ................................................................................. 131
WatermarkedGraphs Property.......................................................... 132
StatToolsReport Object ............................................................................... 133
FinalizeReport Method....................................................................... 133
HeaderRange Property....................................................................... 134
ReportRange Property........................................................................ 134
Result Property.................................................................................... 135
StatToolsSettings Object.............................................................................. 137
AnalysisDialogsUseMemory Property ............................................ 137
AnalysisPercentileCalculationMethod Property ............................ 138
AnalysisWarnMissingData Property ............................................... 139
AnalysisWarnNonNumericData Property ...................................... 140
ClearWorkbookMemory Method ..................................................... 141
DataSetDefaultFormatRange Property ............................................ 142
DataSetDefaultNamesInRange Property ......................................... 143
DataSetDefaultVariableLayout Property......................................... 144
ReportDestinationCell Property ....................................................... 145
ReportEducationalComments Property........................................... 146
ReportLiveUpdatingPreferred Property.......................................... 147
ReportNotesAndWarnings Property ............................................... 148
ReportOverwriteExisting Property................................................... 149
ReportPlacement Property................................................................. 150
ReportReuseNewWorkbook Property ............................................. 151
ShowDialog Method........................................................................... 152
UtilityLiveUpdatingPeferred Property............................................ 153
UtilityNewVariablePreference Property.......................................... 154
StatToolsTable Object.................................................................................. 156
AddCustomComment Method ......................................................... 156
AddDividerLine Method ................................................................... 157
AddHeaderTallText Method ............................................................. 158
AddHeaderText Method.................................................................... 159
AddHeaderVariable Method............................................................. 160
AddHeaderVariableList Method ...................................................... 161
AddStandardComment Method ....................................................... 162
HeaderRange Property....................................................................... 163
InteriorRange Property ...................................................................... 164
SignatureRange Property................................................................... 164
TableRange Property .......................................................................... 165
StatToolsVariable Object............................................................................. 166
AutoFitColumns Method................................................................... 166
Contents v
CheckCategoryHeuristic Method ..................................................... 167
CountCategories Method ................................................................... 168
CountCategoryOccurrences Method................................................ 169
CountCells Method ............................................................................. 170
Covariance Property ........................................................................... 171
DisplayName Property....................................................................... 172
ExcelRange Property........................................................................... 173
ExcelRangeCount Property................................................................ 174
FreezeData Method............................................................................. 175
GetCategoryNames Method.............................................................. 176
GetCategoryOccurrences Method..................................................... 177
GetCellPositions Method ................................................................... 178
GetCellValues Method ....................................................................... 179
GetCellValuesAsCategories Method................................................ 180
GetCellValuesAsNumbers Method .................................................. 181
HasMissingData Property.................................................................. 182
HasNonNumericData Property ........................................................ 183
Maximum Property............................................................................. 183
Mean Property ..................................................................................... 184
Minimum Property ............................................................................. 185
Name Property .................................................................................... 185
NumberFormatExcelCode Property................................................. 186
NumberFormatIsAuto Property ....................................................... 188
NumberFormatNumDigits Property................................................ 189
NumberFormatString Property......................................................... 190
NumberFormatType Property .......................................................... 191
Percentile Property.............................................................................. 192
RangeName Property ......................................................................... 193
ReferenceStr Property......................................................................... 194
ReferenceStrEx Property .................................................................... 195
Stacked Property ................................................................................. 196
StackedCategoryVariable Property .................................................. 197
StackedValueVariable Property ........................................................ 198
StdDev Property .................................................................................. 199
Variance Property ............................................................................... 200
WriteCustomFormattedFormula Method........................................ 201
WriteStandardFormattedFormula Method ..................................... 202
StatToolsVariableList Object ...................................................................... 205
Add Method......................................................................................... 205
AddList Method .................................................................................. 206
AllFromSameDataSet Property ......................................................... 206
AllSameLayout Property.................................................................... 207
AllSameSize Property ......................................................................... 207
ApplyUtilityFormatting Method ...................................................... 208
Clear Method ....................................................................................... 209
vi
Count Property.................................................................................... 209
HasMissingData Property.................................................................. 210
HasMultiRangeVariable Property .................................................... 210
HasNonNumericData Property ........................................................ 211
IsStackingSet Property........................................................................ 211
Item Property....................................................................................... 212
MaxCellCount Property ..................................................................... 212
Remove Method .................................................................................. 213
SharedNumberFormatExcelCode Property .................................... 214
Validate Method.................................................................................. 216
StatToolsVariables Object........................................................................... 217
Count Property.................................................................................... 217
Insert Method ...................................................................................... 218
InsertValidate Method........................................................................ 218
Item Property....................................................................................... 220
Layout Property .................................................................................. 220
NamesInRange Property.................................................................... 221
Contents vii
MissingDataMiddleResponse Property ........................................... 241
MissingDataSetAll Method................................................................ 242
MultiRangeVariablesAllowed Property .......................................... 243
NonNumericDataResponse Property............................................... 243
NumericRangeMax Property ............................................................ 244
NumericRangeMin Property ............................................................. 245
RowVariablesAllowed Property ....................................................... 246
SelectionCountMax Property ............................................................ 246
SelectionCountMin Property ............................................................. 247
SetDefaultConfiguration Method ..................................................... 248
SingleDataSet Property....................................................................... 250
ValidateEvenIfInvisible Property ..................................................... 250
STControlsVarSelector Object.................................................................... 251
ActiveDataSet Property ...................................................................... 251
Attach Method ..................................................................................... 252
Caption Property................................................................................. 253
DataFormat Property .......................................................................... 254
DataFormatChange Event.................................................................. 255
DataFormatMode Property................................................................ 256
Detach Method .................................................................................... 257
EnforceSingleSelectionPerRow Property......................................... 258
Fields Property .................................................................................... 259
SelectionChange Event ....................................................................... 259
StdCaption Property ........................................................................... 260
Validate Method.................................................................................. 261
STControlsVarSelectorField Object ........................................................... 263
Caption Property................................................................................. 263
EnforceSingleSelection Property ....................................................... 263
GetSelectionCount Method................................................................ 264
Index Property ..................................................................................... 264
Selection Property ............................................................................... 265
SelectionList Property......................................................................... 266
Validation Property ............................................................................ 266
Visible Property................................................................................... 267
STControlsVarSelectorFields Object ......................................................... 269
Count Property .................................................................................... 269
GetVariableListFromStackedPair Method....................................... 270
Item Property ....................................................................................... 271
SetStackedPairFromVariableList Method........................................ 272
viii
An Example.......................................................................................... 276
x
Contents xi
Introduction
An Overview to Automating StatTools
StatTools is a Microsoft Excel statistics add-in that allows you to
calculate statistics on data in Excel worksheets. Along with standard
toolbars and menus for user control, StatTools includes a complete,
object-oriented, programming interface. Using this interface, custom
statistical procedures may be added to StatTools using Excel's built-in
VBA programming language. These procedures can utilize StatTools'
built-in data management, charting and reporting tools, all accessible
via StatTools custom controls, functions and methods. Custom
procedures can even be displayed on the StatTools menu for easy
access.
The StatTools programming interface also allows you to write macros in
VBA that control existing "built-in" StatTools analyses. This is useful
for automating repetitive analyses and reports.
Each of these StatTools automation capabilities -
1) Creating Your Own Custom Analyses
2) Controlling Existing StatTools Analyses
are briefly discussed here.
Introduction 1
Automation of Existing Analyses
The second type of automation allows you to control existing analyses.
For example, you might want to take a particular data set and create a
composite report by automating a series of calls to different analyses,
and then applying custom formatting or adding additional calculations
to the output.
Not all analysis packs will support this sort of automation. The
analyses that are built into StatTools itself, the so-called “core analysis
pack” do support automation. See the section Automating the
StatTools Core Analysis Pack of this document for more information.
Custom analysis packs that you write yourself can be configured to
support 3rd party automation, but this document does not cover how to
implement that functionality. Contact Palisade Corporation for more
information on automating custom analysis packs.
Make sure the item Palisade StatTools 5.0 Object Library is checked in
this list.
Once your VBA project has referenced this object, immediately you
have access to StatTools methods, objects, and properties via the global
StatTools object. As a simple example, you can get the number of
analyses installed with StatTools with the code:
numAnalyses = StatTools.Analyses.Count
The three sections of this document 1) Packs, Categories, and Analyses,
2) Data Sets, Variables, and Variable Lists, and 3) Reports, Tables,
and Charts discuss the most important objects in this library and how
to use them. The section StatTools Object Library Reference contains
a list of the library’s objects, methods, and properties.
Introduction 3
The StatTools Controls Library (STControls5.OCX)
This component is only use in the development of your own analyses.
It provides two custom controls to help you implement your analysis’
own dialog.
To use these controls in Excel, you must add them to the list of VBA’s
Additional Controls. To do this, bring up an Excel UserForm window
in VBA, and choose the Tools menu’s Additional Controls menu item.
Then select the STControls5.STControlsOptionPanel and
STControls5.STControlsVarSelector items:
After doing so, the Excel VBA Toolbox window should have two new
controls added:
See the section Using the STControls OCX of this document for more
information on setting up and using these controls. The section
“STControls OCX Library Reference” contains a list of all of the objects,
methods, and properties of the controls.
Make sure the item Palisade StatTools 5.0 Core Pack Automation
Library is checked.
The section Automating the StatTools Core Analysis Pack of this
document gives a general overview of how this library can be used,
while the section StatTools Core Analysis Pack Automation Reference
contains a list of all of its objects, methods, and properties.
Introduction 5
Packs, Categories, and Analyses
To understand the expansion capabilities of StatTools, it is important to
first master the basic concepts of “analyses”, “analysis categories”, and
“analysis packs.” The sections of this document Creating a Custom
Analysis for StatTools and Creating and Distributing Analysis Packs
cover how to create your own analyses and analysis packs.
Terminology
Each individual StatTools procedure that you can run is called an
analysis. An analysis consists of an Excel add-in (.xla) file that
implements a dialog, and a specific set of public subroutines and
functions for calculating results and displaying StatTools reports. For
example, the One Variable Summary procedure that ships with
StatTools is one analysis, in the file StatToolsOneVarSummary.xla.
Each analysis belongs to a single “analysis category.” An analysis
category is a collection of analyses that appear under a single menu and
icon in the StatTools interface. For example, the category Normality
Tests is a built-in analysis category. Your custom add-ins may be
added to new categories that you create, or be added to the built in
categories.
An analysis pack is a collection of analyses and categories which is
distributed as a unit. One pack, the “core” analysis pack, with a large
number of built-in categories and analyses, ships with every copy of
StatTools. Additional packs may be purchased from Palisade
Corporation. StatTools makes it easy to make your own packs as well,
as described later in this section.
Introduction 7
Next
Terminology
This document assumes you are already comfortable with the concepts
of data sets and variables in StatTools, and this section serves only as a
brief review of those concepts.
A “variable” is a collection of spreadsheet cells that contain data
entered by the user. Typically a variable is a single column of a
spreadsheet, although they can be arranged row-wise, or extended to
multiple rows or columns using a multiple-range data set. A data set is
a collection of variables which are adjacent to one another in the
spreadsheet and each have the same number of cells.
Automation Objects
There are five StatTools automation objects used to control StatTools
data sets and variables.
The StatToolsDataSets collection object, accessible using the DataSets
property of the StatTools root object, contains a list of all data sets in the
currently scanned workbook. You can use the Scan method of this
object to scan a workbook manually. See the Scanning Workbooks
section later in this document for more information about scanning.
The Add and AddMulti methods of this object allow you to create new
data sets. See the section Creating New Data Sets and Variables
section later in this document for more information.
There is one StatToolsDataSet object, a child of the data sets collection
described above, for each data set in the currently scanned workbook.
The Variables property of this object returns a StatToolsVariables
collection object, containing one StatToolsVariable object for each
variable in the data set.
Introduction 9
The StatToolsVariables collection object is a child of a StatToolsDataSet
object and contains a list of StatToolsVariable objects. There is one such
object for each variable in the data set. Using this object, you can insert
new variables into an existing data set, or return information about how
the variables are arranged in that data set.
The StatToolsVariableList collection object also contains a set of
StatToolsVariable objects, but in this case the members of the collection
are arbitrary. A variable list object provides a convenient object for
grouping and manipulating an arbitrary collection of variables.
Finally, the StatToolsVariable object represents a variable. This can be
either be a real, “unstacked” variable (one that has a data set as a
parent) or a virtual, “stacked” variable. See the section Stacked and
Unstacked variables later in this document for more information.
Scanning Workbooks
When automating StatTools, it is important to understand how
StatTools keeps track of the data sets and variables in your workbook
models. The DataSets property of the root StatTools object gives you
access to a StatToolsDataSets collection object. But that list will be
empty until an Excel workbook is “scanned.”
The scanning process consists of StatTools going though an Excel
workbook (only one workbook may be scanned at any one time) and
identifying all the data sets and variables in the model. StatTools then
constructs the appropriate StatToolsDataSet, StatToolsVariables, and
StatToolsVariable objects, all accessible via the data sets collection object.
In some cases the scanned model can become out of sync with the Excel
model. For example, if you have scanned a workbook for data sets and
variables, and then you insert a column into a data set. The new
variable in the middle of that column will not be in the list of variable
objects for that data set until you rescan the workbook. Thus, often you
will want to rescan whatever workbook you are using if you have
changed the spreadsheet in this sort of way, or if you have given control
to the user who might have done such an operation.
Since there can only be one currently scanned workbook at any one
time, you will need to run a scan every time you switch between
workbooks.
Introduction 11
Stacked Here’s an example of how to use a stacked variable object. Imagine
Variable there are two columns of data in Excel as follows:
Example
Gender Weight
Male 200
Female 120
Female 130
Male 190
Male 185
Female 120
Female 135
Male 210
Male 175
Female 115
If you want to perform an analysis of all the men in the data set, you
can construct a stacked variable with the following code:
Set sourceCatVar = sourceDataSet.Variables(1)
Set sourceValVar = sourceDataSet.Variables(2)
Set stackedVar = StatTools.NewStackedVariable(sourceValVar, sourceCatVar,
“Male”)
Now the new variable stackedVar can, for most purposes, be treated as
any other StatToolsVariable object. So for example, you could write the
following code to retrieve the mean and standard deviation of all the
men in the data set.
myMean = stackedVar.Mean
myStdDev = stackedVar.StdDev
If you want to get a list of stacked variables, one for each category in the
source category variable, you can use the NewVariableList method:
Set sourceCatVar = sourceDataSet.Variables(1)
Set sourceValVar = sourceDataSet.Variables(2)
Set stackedVarList = StatTools.NewStackedVariableList(sourceValVar,
sourceCatVar, 100)
Now stackedVarList is a StatToolsVariableList object filled containing
two stacked variables, one for males and one for females. The last
argument of the NewStackedVariableList method is the maximum
Introduction 13
Creating New Data Sets and Variables
The previous section discussed how to create new stacked variables. To
create new unstacked variables, however, you must either create a new
data set or insert variables into an existing data set.
Creating New To create an entirely new data set, use the Add or AddMulti methods of
Data Sets the StatToolsDataSets collection object. The former method should be
used for data sets consisting of a single Excel range, while the latter for
multiple range data sets. Here’s an example of how you could add the
range A1:F50 as a new data set, with six variables (one per column) and
with the first row reserved for the variable names:
StatTools.DataSets.Add(ActiveSheet.Range(“A1:F50”,
StatToolsVariableLayoutColumns, TRUE)
When you create a new data set using either the Add or AddMulti
methods, usually you will let StatTools automatically “attach” it to the
workbook for you. The attaching process writes the data set
information into the workbook, sets up any defined names for the data
set’s variables, and (if specified) formats the data set’s range. If,
however, after you create the data set, you need to make a large number
of modifications to the variables of the data set, you may want to attach
it manually after you have made these changes. This prevents a large
amount of reading and writing of information from Excel and will
speed the process of creating a new data set. See the description of the
Add method of the StatToolsDataSets collection object for more
information.
Inserting New To insert a variable into an existing data set, you can use the Insert
Variables into method of the StatToolsVariables collection object. Keep in mind, that
an Existing Data this process inserts rows or columns into the Excel spreadsheet and
Set might have unintended consequences. To check if there is enough room
to insert one or more variables without actually inserting anything, call
the InsertValidate method of the same object. For example, the following
code checks if there is enough room to insert three variables at the end
of a data set and, if so, to actually insert them:
If Not theDataSet.Variables.InsertValidate(3) Then
MsgBox “Couldn’t insert variables.”
Else
For I = 1 to 3
theDataSet.Insert(“var #” & I)
Next i
End If
Introduction 15
Reports, Tables, and Charts
Your custom analyses will typically create new StatTools reports and
then fill them with one or more tables and charts. StatTools provides
several objects and dozens of useful methods and properties for you to
do this in a quick and consistent manner.
Reports Objects
When your analysis needs to generate output information (usually in
the form of tables or charts) to an Excel spreadsheet, you should create a
StatToolsReport object. This object will find a destination location of the
size (number of rows and columns) you specify, as well as create any
new worksheets and header ranges. It also provides a utility for
“finalizing” the report, as discussed below.
Creating a To create a report object, use the NewReport method of the root StatTools
StatToolsReport object. StatTools will:
Object
1) Examine the current settings to determine where the report
should be placed (in a new worksheet or workbook, etc)
2) Appropriately format the report range, and
3) Generate a new StatToolsReport object.
For reports that should be put in new worksheets, the method will
create the new worksheet, name it, and put a report “header” at the top
of the report.
For complicated reasons, and unlike most other StatTools methods,
when you create a StatToolsReport object using the NewReport method of
the root StatTools object, and it fails (because the requested report size is
too large to fit in the destination location, or the user cancelled the
operation, or some other exceptional condition) it will not raise an error
to the calling application. Instead it will still create StatToolsReport
object, but will set the Result property of that object to an non-zero error
code. Thus, after you create a new StatToolsReport object, but before
you use it, you should always check the Result code for a non-zero
value. Typically in your custom analyses, you will simply return this
result back to the StatTools function that called your routine.
.Finalize
End With
Introduction 17
Table Objects
Most of your numeric results should be placed in standard StatTools
style tables. StatTools makes this process easy by providing the
StatToolsTable object.
Creating a To create a table object call the NewTable method of the StatTools root
StatToolsTable object. You pass as arguments to this method the upper-left cell of the
Object table’s destination, as well as the size of the table (the number of interior
table rows and columns.) This method then constructs a table, with
default StatTools formatting, of the specified size and at the specified
location, and returns a new StatToolsTable object which you can then
proceed to use.
The Parts of a Each table has four parts. The “signature” range of the table consists of
Table two cells in the upper-left corner of the table where a small description
of the table is placed. There are two “header” ranges, one on the left
and one of the top of the table where descriptions of the rows and
columns of the table may be placed. Finally, the “interior” range of the
table is the area where your output result may be placed. These ranges
can be accessed via the SignatureRange, HeaderRange, and InteriorRange
properties of the table object. To get the entire table range use the
TableRange property.
Adding Header To add headers to your tables, you can always get the header ranges
Text and write to the header cells directly. However, the table object
provides several methods for efficiently writing text to the headers. The
AddHeaderText and AddHeaderTallText can be used to write arbitrary text
to the headers. The AddHeaderVariable and AddHeaderVariableList
methods are useful for writing the names of variables to the headers.
Adding Table The table object provides two methods for adding pop-up comments to
Comments tables. The AddCustomComment method allows you to add a comment
containing arbitrary text. The AddStandardComment method adds a
comment with predefined text. Comments fall in two categories. The
“Notes and Warnings” category includes comments that are general in
nature, and which we you want all users of the product, at least at first,
to read. These comments are shown, by default, when reports are
generated unless the user specifically turns them off. The second
category has “Educational Comments” which serve as learning aids for
students using StatTools in a classroom environment. These comments
are, by default, not shown, unless they are turned on by the user. When
you create a comment using the AddCustomComment method, you must
specify if it is in the “Notes and Warnings” category or the “Educational
Comments” category.
End With
Introduction 19
Chart Objects
You are free to create an Excel chart object using normal Excel VBA
commands. However, StatTools provides a wrapper object, the
StatToolsChart object, which make it easy to make charts that have a
consistent look and feel.
Creating as To create a new chart call the NewChart method of the StatTools root
StatToolsChart object. You pass as an arguments to this method the cell where the
Object upper-left corner of the chart should be placed, the type of the chart,
and the graph’s data source. The method will create an Excel
ChartObject in the specified location, configured with the default
StatTools formatting, and returns a StatToolsChart object.
Customizing the Once the chart is created, you can customize the chart in two ways.
Chart First, you can always access the underlying Excel chart object using the
Chart property of the StatToolsChart object. Then you can modify the
chart as you would any other Excel chart object. But in addition, there
are a number of methods of the StatToolsChartObject for adding chart
elements which are formatted in a standard StatTools manner. To add
axes, legends, and a title to your chart, use the AddCategoryXAxis,
AddValueXAxis, or AddValueYAxis, AddLegend, and AddTitle methods.
Introduction 21
22 Reports, Tables, and Charts
Creating a Custom Analysis for
StatTools
Building an Analysis
Introduction
A StatTools custom analysis is a new statistical procedure which you
wish to add to StatTools. A custom analysis can utilize StatTools' built-
in data management, charting and reporting tools and can even be
displayed on the StatTools menu for easy access. Example custom
analyses are the three non-parametric tests that are available from
Palisade.
Creating your own custom analysis for StatTools is a relatively
straightforward process:
1) First, you must create an add-in (.xla) file and add a reference
to the main StatTools Object Library (StatToolsOL.DLL) file.
2) Second, you should create a defined type and a global variable
of that type to represent the “state” of your add-in.
3) Third, you must implement a small number of public
subroutines that perform certain standard functions, such as
reading default values, putting up an analysis dialog, and so
on.
4) Finally, you must place that analysis in a destination where
StatTools can find it and add it to your copy of StatTools.
An example add-in, Template.xls, is in the Developer Kit sub-folder of
the folder with example spreadsheets (accessible through the Help >
Example Spreadsheets command). We recommend you use this
template as a starting point for your analysis development efforts.
Many of the steps described below will already be accomplished if you
use the template.
Make sure the item Palisade StatTools 5.0 Object Library is checked in
this list.
24 Building an Analysis
Running Your Custom Analysis
To run a custom analysis one needs to write appropriate VBA code that
will be executed when the user clicks a button or selects a menu item
(with the button or menu created by the VBA programmer). The
example Running Custom Analysis.xls (accessible through the Help >
Example Spreadsheets command) demonstrates how to do that using a
custom button.
For example, the following code will run custom analysis named
"Template":
26 Building an Analysis
The VariableList member of the type keeps track of what variables are
selected in the variable selector at the top of the dialog. The
BinMinimum, BinMaximum, and NumBins members keep track of the
like-named items in the dialog (There are special constant values – not
shown here - for the “auto” options for each of these.) And the
ExtendFirstBinToMinusInfinity and ExtendLastBinToInfinity Boolean
members correspond to the check boxes.
The global variable analysisInfo contains the current “state” of the
analysis. For example, after the user dismisses the analysis’ dialog, the
global state variable will contain the choices that were made there. Or,
when StatTools asks you to store the current settings as defaults, the
setting you store should come from that variable.
28 Building an Analysis
Defaults Each analysis add-in must provide a Defaults function, with the
prototype:
Public Function Defaults(writeDefaults As Boolean, wbContext As Workbook)
As StatToolsResult
This function is called when StatTools either wants to write the current
global state of your analysis as the default, or alternatively, if it wants to
set the global state of the analysis to the default values.
Analysis defaults determine what values are put into the global state
variable when the analysis is first initialized. There are two levels of
these defaults. First, the currently active workbook may have defaults
for an analysis stored within it. These values are written whenever an
analysis dialog is dismissed with a click of the OK button. This allows
those same settings to reappear when the analysis is again used for the
same workbook. Second, there is a set of global defaults, stored in the
system registry, which are used when the analysis dialog is displayed in
the context of a workbook that doesn’t have any workbook level
defaults. These global defaults are written when the user clicks the
Save as Defaults icon in an analysis dialog.
The first argument to the function is writeDefaults. If TRUE, defaults are
being written from the global state into a workbook or the global
defaults. If FALSE, defaults are being read from the workbook or
global defaults into the global state. Usually, you simply pass this
argument back into individual default functions you call in this routine,
as you’ll see in the example at the end of this section.
The second argument to the function is the wbContext. If this is Nothing
the default is being read from or written to the global defaults. If this is
set to a specific workbook, the defaults are being read from or written to
that specific workbook. Note some items can only be written to a
workbook. For example, you can not write a specific variable object as a
global default, since that object has no meaning outside the current
workbook. For convenience, you can still call the default functions in
these cases, but no values will be written, and empty object variables
will always be returned.
30 Building an Analysis
ShowDialog Each analysis must provide a ShowDialog function with the following
prototype:
Public Function ShowDialog() As StatToolsResult
This function show display your analysis’s custom dialog. Make sure to
always show the dialog modally. If you show the dialog modelessly,
StatTools will crash. The return value should be StatToolsResultOK if
the dialog’s OK button is pressed, or StatToolsResultActionCancelled if
the dialog’s Cancel button was pressed.
What goes into your dialog is up to you, but we recommend you follow
the basic design of the dialog in the Template.xls add-in. StatTools has
two custom controls to aid your dialog development. The section
Using the STControls OCX of this document discusses how to set up
and use these controls.
GenerateReport Each analysis add-in must provide a GenerateReport function, with the
prototype:
Public Function GenerateReport() As StatToolsResult
This function is called when StatTools wants you to generate your
analysis’ report using the current global state.
How you implement the GenerateReport function is up to you, but here
is a general outline of the sequence you will most likely want to follow:
1) Based on the current global state, determine how large a report
(number of rows and columns) you will need.
2) Call the NewReport method of the root StatTools object to create
a new StatToolsReport object, being sure to check the .Result
property of this object before proceeding to use it.
3) Use the .ReportRange property of the StatToolsReport object as
the destination range for your analysis’ report, filling it in with
whatever charts, tables, and numeric results are necessary.
4) Optionally, call the .Finalize method of the StatToolsReport
object. The method provides a convenient method for
converting a live report into a static one, and also for resizing
the columns of your report to be able to display the result.
In code, this sequence would be something like this:
Public Function GenerateReport() as StatToolsResult
Dim rc as StatToolsResult
Dim numRows as Long
Dim numColumns as Long
fail:
GenerateReport = rc
End Function
32 Building an Analysis
Debugging Your Custom Analysis
While developing your analysis add-in, you will most likely want to
debug the .xls file, while having it be called by StatTools as if it were
already compiled. StatTools will normally not recognize .xls files as
analyses, but there is a way you can force StatTools to call the .xls file
you are working on instead of your analysis’ compiled add-in.
To do this, compile your .xla and place it in a directory where StatTools
can find it (as described in the section Creating and Distributing
Analysis Packs below.) After you launch the StatTools add-in,
manually open your analysis’ .xls file. When StatTools tries to run a
procedure in your analysis, and it sees that an .xls file with the same
name as the .xla file that it would normally run is there, it will call the
.xls code instead of the .xla code. It also will never dynamically try to
load or unload your add-in, which it normally would do for other .xla
files.
Thus you can now set breakpoints and other debugging information in
the .xls file.
StatTools Object
Analyses Property
Description Returns a StatToolsAnalyses collection object which
contains all the analysis modules that were registered with
StatTools when the program was launched. See the
section Packs, Categories, and Analyses of this
document for more information on analyses.
Syntax Object.Analyses
Arguments None.
AnalysisCategories Property
Description Returns a StatToolsAnalysisCategories collection object
which contains all the analysis categories that were
registered with StatTools when the program was launched.
An analysis category is a collection of analyses that are
grouped together under a common StatTools icon and
submenu. For example, StatTools has a built-in category
called “Normality Tests” which contains several analyses
all related to performing normality tests. See the section
Packs, Categories, and Analyses of this document for
more information on analysis categories.
Syntax Object.AnalysisCategories
Arguments None.
40 StatTools Object
StatTools Object — AnalysisPacks Property
AnalysisPacks Property
Description Returns a StatToolsAnalysisPacks collection containing all
the analysis packs that were registered with StatTools
when then program was launched. An analysis pack is a
collection of analyses and analysis categories that are
packaged and sold together as a unit. StatTools comes
with a single built-in analysis pack, called the “core” pack,
which contains the most commonly used statistical
analyses. Additional packs, containing additional
analyses, can be purchased directly from Palisade
Corporation, or from 3rd party vendors. You can also write
and publish your own analysis packs. See the section
Packs, Categories, and Analyses of this document for
more information on analysis packs.
Syntax Object.AnalysisPacks
Arguments None.
AskOKCancel Method
Description Presents a standard StatTools OK/Cancel dialog to the
user, displaying the message specified. If the user selects
“OK”, the method will return TRUE. If the user selects
“Cancel”, the method will return FALSE. If the
DisplayAlerts property has been set to False, the dialog
will not appear and this method will always return TRUE.
AskYesNo Method
Description Presents a standard StatTools Yes/No dialog to the user,
displaying the message specified. If the user selects
“Yes”, the method will return TRUE. If the user selects
“No”, the method will return FALSE. If the DisplayAlerts
property has been set to False, the dialog will not appear
and this method will always return TRUE.
42 StatTools Object
StatTools Object — DataSets Property
DataSets Property
Description Returns a StatToolsDataSets object, which is the
collection of currently scanned StatTools data sets. In
addition, this same object provides access to several
methods and properties for manipulating this collection of
data sets. Only a single workbook can be “scanned” at
any one time. See the section Data Sets and Variables” of
this document for more information about DataSets and
how they are scanned.
Syntax Object.DataSets
Arguments None.
DisplayAlerts Property
Description Controls whether StatTools messages, warnings, and
queries are displayed. If set to TRUE, all messages are
displayed normally. If set to FALSE, all StatTools
messages, including those passing through the
AskOKCancel, AskYesNo, and Message methods, are not
displayed. This is useful for automation code which needs
to suppress user interaction.
Syntax Object.DisplayAlerts
Arguments None.
ExcelApp Property
Description Returns the Microsoft Excel Application object, which the
running copy of StatTools is attached to.
Syntax Object.ExcelApp
Arguments None.
44 StatTools Object
StatTools Object — Message Method
Message Method
Description Presents a standard StatTools message dialog to the user,
with a single “OK” button. If the StatTool’s DisplayAlerts
property has been set to False, the dialog will not appear.
NewChart Method
Description Creates and returns a new StatToolsChart object, which is a
wrapper object for an embedded Excel chart. The four built-in
chart types are preset StatTools templates for standard Excel
charts, which make it easy to create charts which have the
standard StatTools look and feel. If these chart types are not
sufficient for your needs, you can also create a “custom” chart.
See the section “Creating Reports, Tables, and Charts” for
more information.
Syntax Object.NewChart(anchorCell As Range, chartType As
StatToolsChartType, xDataRange As Range, yDataRange As
Range)
Arguments anchorCell (Range object) – the upper-left cell location where
the StatTools style chart will be located.
chartType (StatToolsChartType Enumerated Constant) –
controls what type of Excel graph is being made. The different
chartTypes have different data requirements, which are listed
in the xDataRange and yDataRange arguments. One of the
following constant values:
o StatToolsChartTypeColumn – a Excel column chart.
o StatToolsChartTypeScatterMarkers – an (x-y) plot
with markers and no lines.
o StatToolsChartTypeScatterLine – an (x-y) plot with
lines and markers
o StatToolsChartTypeLine – a “line” plot
o StatToolsChartTypeCustom – a chart that does not
fall into one of the above categories.
xDataRange (Range object) – the “x” data for the chart. This
should be set to “Nothing” except for scatter (x,y) chart types,
in which case it should be set to a range consisting of a single
Excel row or column, containing the x-data for the graph.
yDataRange (Range object) – the “y” data for the chart. For a
column chart, this should be set to an Excel range, with the
data arranged in columns. There will be one chart series per
column in the range. For a scatter (x,y) chart, this should be
set to a range consisting of a single Excel row or column,
containing the y-data for the graph. For a line chart, this
should be set to a single row or column, containing the heights
of the line graph.
Return Value A StatToolsChart object.
Example ‘Create a scatter plot of the data in the range A1:B100:
Set theXData = sourceSheet.Range(“A1:A100”)
Set theYData = sourceSheet.Range(“B1:B100”)
Set newChart = StatTools.NewChart(destSheet.Cells(1,1),
StatToolsChartTypeScatterLine, theXData, theYData)
46 StatTools Object
StatTools Object — NewReport Method
NewReport Method
Description Call this method when you need StatTools to determine
the destination in Excel for a new StatTools report.
StatTools will examine the current settings to determine
where the report should be placed (in a new worksheet or
workbook, etc,) will appropriately format the report range,
and then will generate a new StatToolsReport object. For
reports that should be put in new worksheets, the method
will create the new worksheet, name it, and put a report
“header” at the top of the report. Note: Make sure to
always check the .Result property of the object
returned by the NewReport method before using it to
check for any error conditions. See the example
below. See the section “Creating Reports, Tables, and
Charts” of this document for more information.
Arguments numRows (Long) – the number of rows for the report. This
does not include the rows used by the header range that
StatTools puts at the top of reports that are placed on new
worksheets. The maximum number of rows is 65525.
numCols (Long) – the number of columns for the report.
The maximum number of columns is 256.
whichAnalysis (Optional Variant) – if specified, either a
StatToolsAnalysis object or the string name of the analysis
from which the report is being generated. Supplying this
information allows StatTools to place the appropriate
information in the report header range, and also give
appropriate names to any new worksheet required by the
report. If not supplied, StatTools will put generic
information in these spots.
reportUpdating (Optional StatToolsReportUpdating
Enumerated Constant) – by default StatTools will examine
the current settings to determine what the preferred
updating style the user has chosen (“live” or “static”) for
reports. In some cases, however, your report might not be
able to support that preference, and you need to override
it. In those cases specified one of the following constants:
o StatToolsReportUpdatingAuto – the default. The
report will use either “Live” or “Static” updating
depending on the user preference specified in the
Settings dialog.
Example ‘Have StatTools make a new report of (45x15) cells for the
analysis named “CustomAnalysis” with “Static” updating:
.FinalizeReport
End With
48 StatTools Object
StatTools Object — NewStackedVariable Method
NewStackedVariable Method
Description Creates a new, stacked StatToolsVariable object. A
stacked variable is a “virtual” variable created from the
combination of two “real” variables (one category variable
and one value variable) and a category name. For
example, if you had one variable called “Gender” filled with
cells labeled either “Male” or “Female” and a second
variable called “Height” filled with numbers, you could
make a “virtual” stacked variable of the heights of all males
using this function, which could then be used like a “real”
variable in other StatTools methods and properties. See
the section DataSets, Variables, and VariableLists of
this document for more information.
Syntax Object.NewStackedVariable(valueVariable As
StatToolsVariable, categoryVariable As StatToolsVariable,
categoryName as String)
NewStackedVariableList Method
Syntax Object.NewStackedVariableList(valueVariable As
StatToolsVariable, categoryVariable As StatToolsVariable,
maxNumCategories as Integer)
50 StatTools Object
StatTools Object — NewTable Method
NewTable Method
Description Creates a new StatToolsTable object . This object
provides a convenient wrapper for creating tables in Excel
with a standard StatTools look and feel. Once the table
object is created, additional methods and properties of it
may be used to customize the table appropriately. See the
section Creating Reports, Tables, and Charts of this
document for more information.
End With
NewVariableList Method
Description Creates a new, empty StatToolsVariableList object. A
variable list is simply a collection of StatToolsVariable
objects. The list may consist of simple “unstacked”
variables, virtual “stacked” variables, or a combination of
both. The list object also contains a number of methods
and properties for manipulating the collection of variables
as a whole. The variable list, when created, contains no
variables. Use the Add or AddList methods to add
variables to a list object.
Syntax Object.NewVariableList
Arguments None.
52 StatTools Object
StatTools Object — ProductInformation Property
ProductInformation Property
Description Returns the StatToolsProductInfo object, which contains
general information about the installed copy of StatTools,
like version or edition.
Syntax Object. ProductInformation
Arguments None.
ProgramDirectory Property
Description Returns the fully qualified directory path from which
StatTools is currently running.
Syntax Object.ProgramDirectory
Arguments None.
ProgressBar Method
Description Displays, updates, or closes the standard StatTools
progress bar.
54 StatTools Object
StatTools Object — ProgressBar Method
status (Optional Variant) – an optional string or number. If
not missing, this is the value or text that will be displayed
in the bottom of the progress bar window. If a numeric
value, it should be a value between 0 and 1, and will be
formatted and displayed as a percentage. If it is a string,
that string will be displayed.
Example ‘Below is the most common way you will use the Progress
Bar:
‘Imagine a loop through N items which potentially can take
a long time:
For i = 1 to N
‘Show the progress bar (in delayed mode)
if
StatTools.ProgressBar(StatToolsProgressBarModeUpdat
eDelayed, “Processing Items”, CDbl(i)/N) <> 0 then
cancelFlag = True: Exit For
ResultString Property
Description Several StatTools methods and properties return
StatToolsResult codes. These typically are error
conditions, or result codes stemming from abnormal user
responses, for example an operation cancelled by the
user. This function returns a string description of a given
StatToolsResult.
Settings Property
Description Returns the StatToolsSettings which contains all the
current user settings for the program.
Syntax Object.Settings
Arguments None.
Example StatTools.Settings.ReportPlacement =
StatToolsPlaceInNewWorkbook
56 StatTools Object
StatTools Object — ShowAboutDialog Method
ShowAboutDialog Method
Description Shows the StatTools “About” dialog, which displays the
version, registered user name, company, and serial
number of the product.
Syntax Object.ShowAboutDialog
Arguments None.
Example StatTools.ShowAboutDialog
ShowAuthorizationDialog Method
Description Shows the “Authorization” dialog for StatTools and the
StatTools Core Analysis Pack. To show authorization
information for a different analysis pack, call the similarly
named method of the appropriate StatToolsAnalysisPack
object. See the StatTools User’s Guide for more
information about authorization and how to authorize your
copy of StatTools.
Syntax Object.ShowAuthorizationDialog
Arguments None.
Example StatTools.ShowAuthorizationDialog
ShowHelp Method
Description Shows the main StatTools help file, displaying the
specified context page. This method shows the help file
for the main StatTools product. To show help for a
specific analysis, call the similarly named method in the
appropriate StatToolsAnalysis object.
Example ‘Show the help file page for the StatTools Settings dialog:
StatTools.ShowHelp(StatToolsHelpContextSettingDialog)
ShowOnlineManual Method
Description Shows the online manual for the main StatTools program
and the Core Analysis Pack. The online manual is in
Adobe Acrobat format. You will need a copy of Acrobat
Reader 4.0 or higher in order to display this document.
Syntax Object.ShowOnlineManual
Arguments None.
Example StatTools.ShowOnlineManual
58 StatTools Object
StatTools Object — SystemDirectory Property
SystemDirectory Property
Description Returns the full path of the shared Palisade “System”
directory. This directory is used by a large number of
software packages developed by Palisade Corporation,
including StatTools.
Syntax Object.SystemDirectory
Arguments None.
Return Value A string containing the full path of the system directory.
60 StatTools Object
StatTools Analyses Object — Count Property
Syntax Object.Count
Arguments None.
Item Property
Description Returns a specific analysis, by index or by “internal” name,
from the collection of analyses. Note this is the default
method for this object.
StatToolsAnalysis Object
AddinPath Property
Description Returns the path and filename of the add-in (.xla) file of
the analysis.
AnalysisCategory Property
Description Returns the StatToolsAnalysisCategory object which this
analysis belongs to. See the section Packs, Categories,
and Analyses for more information on the relationship
between analyses and analysis categories.
Syntax Object.AnalysisCategory
Arguments None.
AnalysisPack Property
Description Returns the StatToolsAnalysisPack object which this
analysis belongs to. See the section Packs, Categories,
and Analyses for more information on the relationship
between analyses and analysis packs.
Syntax Object.AnalysisPack
Arguments None.
BeginGroup Property
Description Returns whether this analysis begins a “group” within its
category. A group has a divider line separating it from its
predecessor in the StatTools menu and toolbars. You can
set this property in your own custom analyses by creating
a configuration file. See the Configuration Files section
of this document for more information.
Syntax Object.BeginGroup
Arguments None.
64 StatToolsAnalysis Object
StatToolsAnalysis Object — BuiltIn Property
BuiltIn Property
Description Returns whether this analysis belongs to StatTools’ Core
Analysis Pack, or to another analysis pack.
Syntax Object.BuiltIn
Arguments None.
DebugMode Property
Description To facilitate debugging, you can manually load an .xls
version of an analysis you are working on, and StatTools
will call it instead of the .xla file it would normally call. In
those cases, this property will be set to TRUE.
Syntax Object.DebugMode
Arguments None.
Default Method
Description Reads or writes an analysis default to the specified
workbook or to StatTools’ global defaults in the registry.
Use this function to write string, numeric, or Boolean
values. Variants filled with arrays of these values are also
allowed. The DefaultDataSet, DefaultRange,
DefaultVariable, or DefaultVariableList methods are
available for writing or reading defaults of these objects.
Typically you will only call this function from within your
custom analysis’ public “Defaults” function.
Analysis defaults determine what values are shown when
an analysis dialog is first displayed. There are two levels
of these defaults. First, the currently active workbook may
have defaults for an analysis stored within it as hidden
defined names. These values should be written whenever
an analysis dialog is dismissed with a click to the OK
button. This allows those same settings to reappear when
the dialog is next displayed for the same workbook.
Second there is a set of global defaults, stored in the
system registry, which are used when the analysis dialog
is displayed in the context of a workbook that doesn’t have
any workbook level defaults. These global defaults are
written when the user clicks the “Save as Defaults” icon in
an analysis dialog.
Syntax Object.Default(writeDefault As Boolean, wbContext As
Workbook, keyName as String,, val As Variant, Optional
defaultValue)
Arguments writeDefault (Boolean) – TRUE if the default is being
written. FALSE if being read.
wbContext (Workbook) – If set to “Nothing” the default will
be written to or read from StatTools’ global defaults in the
registry. If set to an Excel workbook, the default will be
written to or read from that workbook.
keyName (String) – The name of this item which must be
an alphanumeric string, capable of being written as an
Excel defined name, to identify the default.
val (Variant) – The value that is being written or read into.
Must be one of the following data types
o Boolean
o Integer
o Long
o Double
o String
o A variant containing an array of one of the above
data types.
66 StatToolsAnalysis Object
StatToolsAnalysis Object — Default Method
defaultValue (Optional Variant) – This setting should be
left blank when writing a default, but is required when
reading. There is no guarantee that the setting you
request will be found stored in either a workbook or the
global defaults. The default value is what value will be
assigned to the val argument if no entry is found.
DefaultDataSet Method
Description This routine reads or writes a StatToolsDataSet object to a
workbook level default. Unlike the Default method, this
method requires the default to be written into a workbook;
Data set defaults can not be stored in the global defaults.
If reading a default from a workbook that does not have
that particular default stored in it, or if the data set stored
there has been deleted, the returned data set will be set to
“Nothing.”
68 StatToolsAnalysis Object
StatToolsAnalysis Object — DefaultRange Method
DefaultRange Method
Description This routine reads or writes an Excel Range object to a
workbook level default. Unlike the Default method, this
method requires the default to be written into a workbook;
Excel Range defaults can not be stored in the global
defaults. If reading a default from a workbook that does
not have that particular default stored in it, or if the Excel
Range stored there has been deleted, the returned object
will be set to “Nothing.” See the Default method for more
information on how defaults are used in StatTools.
DefaultVariable Method
Description This routine reads or writes a StatToolsVariable object to a
workbook level default. Unlike the Default method, this
method requires the default to be written into a workbook;
Variable defaults can not be stored in the global defaults.
If reading a default from a workbook that does not have
that particular default stored in it, or if the variable stored
there has been deleted, the returned variable will be set to
“Nothing.” See the Default method for more information
on how defaults are used in StatTools.
70 StatToolsAnalysis Object
StatToolsAnalysis Object — DefaultVariableList Method
DefaultVariableList Method
Description This routine reads or writes a StatToolsVariableList object
to a workbook level default. Unlike the Default method,
this method requires the default to be written into a
workbook; Variable list defaults can not be stored in the
global defaults. If reading a default from a workbook that
does not have that particular default stored in it, an empty
variable list object will be returned. If reading a default list
of which some of the variables have been deleted, the list
will contain only the variables which still exist in the
workbook. See the Default method for more information
on how defaults are used in StatTools.
HelpContextID Property
Description Returns the help context ID for this analysis. This ID
number identifies what context page in the analysis pack’s
help file is displayed when the user requests help for this
particular analysis. To set the context ID for your own
analyses, you need do two things. First, imbed a context
ID code in the help file you have written for your analysis
pack. Second, create a configuration file for your analysis
pack, and put the help context ID for this analysis in that
file. See the section “Configuration Files” of this document
for more information.
Syntax Object.HelpContextID
Arguments None.
72 StatToolsAnalysis Object
StatToolsAnalysis Object — LoadAddIn Method
LoadAddIn Method
Description Since StatTools has a large number of different analysis
procedures, each within its own Excel .xla add-in file, it
loads and unloads them dynamically in order to effectively
utilize system resources. Typically StatTools takes care of
this process automatically. If, however, you want to
explicitly load and unload an analysis .xla, you can use the
LoadAddin and UnloadAddin methods to do so.
Syntax Object.LoadAddIn
Arguments None.
MenuCaption Property
Description Returns the text that appears in the StatTools menu for
this analysis. If the item has an accelerator key
associated with the menu caption, a “&” character will
precede that accelerated letter.
Syntax Object.MenuCaption
Arguments None.
Name Property
Description Returns the “internal” name of the analysis object. The
“internal” name of an analysis is always the same as the
filename of the analysis on disk, minus the extension. For
example, the One-Variable Summary analysis has the
filename “OneVarSummary.xla” and its “internal” name is
“OneVarSummary.”
Syntax Object.Name
Arguments None.
74 StatToolsAnalysis Object
StatToolsAnalysis Object — NewSheetName Property
NewSheetName Property
Description Returns the text which appears when this analysis creates
a new worksheet for generating StatTools reports.
StatTools will append a “uniquifier” to this name to make
sure the actual worksheet name does not conflict with an
existing worksheet.
Syntax Object.NewSheetName
Arguments None.
ReportDescription Property
Description Returns the descriptive text which appears in the header
region of a StatTools report for this analysis.
Syntax Object.ReportDescription
Arguments None.
RequiresVariables Property
Description Returns whether this analysis requires one or more
StatTools variables to be selected by the user in order to
run. Most analyses require the user to select one or
more variable to analyze. There are some that do not,
however, and StatTools will treat these analyses slightly
differently. For example, StatTools will never prompt the
user to switch from a workbook without defined data sets
to one that has them when running an analysis that
doesn’t require variables.
Syntax Object.RequiresVariables
Arguments None.
76 StatToolsAnalysis Object
StatToolsAnalysis Object — Run Method
Run Method
Description Run the analysis, just as if the user had clicked on the
analysis’ menu item.
Syntax Object.Run
Arguments None.
ShowHelp Method
Description Shows the help file for the analysis pack to which this
analysis belongs to, displaying the appropriate context
page if there is one. See the HelpContextID property for
information on help file context pages.
Syntax Object.ShowHelp
Arguments None.
Example myAnalysisObj.ShowHelp
78 StatToolsAnalysis Object
StatToolsAnalysis Object — UnloadAddin Method
UnloadAddin Method
Description Since StatTools has a large number of different analysis
procedures, each within its own Excel .xla add-in file, it
loads and unloads them dynamically in order to effectively
utilize system resources. Typically StatTools takes care of
this process automatically. If, however, you want to
explicitly load and unload an analysis .xla, you can use the
LoadAddin and UnloadAddin methods to do so.
Syntax Object.UnloadAddin
Arguments None.
Utility Property
Description Returns whether this analysis is considered a “utility” or
not. A utility performs operations on data sets and
variables to create or modify existing data sets and
variables. StatTools treats utilities differently from regular
analyses. For example, a utility uses the settings on the
“Utilities” tab of the StatTools settings dialog instead of the
“Reports” tab.
Syntax Object.Utility
Arguments None.
80 StatToolsAnalysis Object
StatToolsAnalysisCategories Object — Count Property
StatToolsAnalysisCategories Object
Count Property
Description Return the number of analysis categories in the collection.
Syntax Object.Count
Arguments None.
Item Property
Description Returns a specific StatToolsAnalysisCategory object from
the collection, referenced by either index or name. Note
this is the default method for this object.
82 StatToolsAnalysisCategories Object
StatToolsAnalysisCategory Object — Analyses Property
StatToolsAnalysisCategory Object
Analyses Property
Description Returns a StatToolsAnalyses collection object, containing
a list of all the analyses that belong to this particular
category object. See the section Packs, Categories, and
Analyses of this document for more information on the
relationship between analyses and analysis categories.
Syntax Object.Analyses
Arguments None
AnalysisPack Property
Description Returns the StatToolsAnalysisPack object which this
analysis category belongs to. See the section Packs,
Categories, and Analyses of this document for more
information on the relationship between analysis packs
and analysis categories.
Syntax Object.AnalysisPack
Arguments None.
BeginGroup Property
Description Returns whether this analysis category begins a “group”
within the user-interface. A group has a divider line
separating it from its predecessor in the StatTools menu
and toolbars.
You can set this property in your own custom analyses by
creating a configuration file. See the “Configuration Files”
section of this document for more information.
Syntax Object.BeginGroup
Arguments None.
BuiltIn Property
Description Returns whether this analysis category belongs to
StatTools’ Core Analysis Pack, or to another analysis
pack.
Syntax Object.BuiltIn
Arguments None.
84 StatToolsAnalysisCategory Object
StatToolsAnalysisCategory Object — MenuCaption Property
MenuCaption Property
Description Returns the text that appears in the StatTools menu for
this analysis category. If the item has an accelerator key
associated with the menu caption, a “&” character will
precede that accelerated letter.
You can set this property in your own custom analyses by
creating a configuration file. See the “Configuration Files”
section of this document for more information.
Syntax Object.MenuCaption
Arguments None.
Name Property
Description Returns the “internal” name of this analysis category. The
“internal” name of an analysis category can be explicitly
defined in an analysis pack’s configuration file. If no
configuration file exists, each analysis pack will have one
analysis category, with the same internal name as the
pack itself. See the section Packs, Categories, and
Analyses and “Configuration Files” of this document for
more information.
Syntax Object.Name
Arguments None.
ToolbarBitmapFile Property
Description Returns the fully qualified path and file name of the bitmap
used in the StatTools toolbar to display this category. This
bitmap can be specified for your own custom analyses
using a configuration file. See the “Configuration Files”
section of this document for more information.
Syntax Object.ToolbarBitmapFile
Arguments None.
86 StatToolsAnalysisCategory Object
StatToolsAnalysisPack Object — Analyses Property
StatToolsAnalysisPack Object
Analyses Property
Description Returns a StatToolsAnalyses collection object which
contains a list of all the analyses which belong to the pack.
See the section Packs, Categories, and Analyses of this
document for information about the relationship between
analysis packs and analyses.
Syntax Object.Analyses
Arguments None.
AnalysisCategories Property
Description Returns a StatToolsAnalysisCategories collection object
which contains a list of all the analysis categories which
come from the pack. See the section Packs, Categories,
and Analyses of this document for information about the
relationship between analysis packs and categories.
Syntax Object.AnalysisCategories
Arguments None.
BuiltIn Property
Description Returns TRUE if this analysis pack is the built-in “core”
analysis pack that ships with StatTools.
Syntax Object.BuiltIn
Arguments None.
Return Value Boolean. TRUE if the pack is the “core” analysis pack.
FALSE if not.
Description Property
Description Returns a descriptive string that describes the analysis
pack. This string appears in the header range when an
analysis in the pack creates a report.
Syntax Object.Description
Arguments None.
88 StatToolsAnalysisPack Object
StatToolsAnalysisPack Object — HasConfigurationFile Property
HasConfigurationFile Property
Description Returns TRUE if this analysis pack uses a configuration
file. A configuration file allows you to control, in detail, an
analysis packs integration with the StatTools program.
While an analysis pack is not required to have a
configuration file, if you plan on distributing your custom
analysis packs to others you will most likely want to write
one. See the “Configuration Files” section of this
document for more information.
Syntax Object.HasConfigurationFile
Arguments None.
HelpPath Property
Description Returns the full path and filename of this analysis’ help file.
If the analysis does not have a help file, the string returned
is empty. The help file for your custom written analysis
pack can be set using a configuration file. See the
“Configuration Files” section of this document for more
information.
Syntax Object.HelpPath
Arguments None.
Return Value A String containing the full path and filename of the help
file.
Name Property
Description Returns the name of the analysis pack. An analysis pack’s
name is the name of the subdirectory of the
\StatTools\Analyses folder.
Syntax Object.Name
Arguments None.
Path Property
Description Returns the path of the analysis pack’s directory on disk.
An analysis pack is installed as a subdirectory of the
\StatTools\Analyses folder.
Syntax Object.Path
Arguments None.
Return Value A string containing the directory path of the analysis pack
90 StatToolsAnalysisPack Object
StatToolsAnalysisPack Object — Priority Property
Priority Property
Description Returns the priority of the pack, which is a number which
determines which packs are displayed first in the StatTools
user interface. The lower the pack’s priority, the earlier in
the user interface it will be listed. Ties are broken by
alphabetical order. The built-in core analysis pack will
always have earlier priority than all other packs.
The priority for your custom written analysis pack can be
set using a configuration file. See the “Configuration Files”
section of this document for more information.
Syntax Object.Priority
Arguments None.
ShowHelp Method
Description Shows the help file for the analysis pack, optionally set to
display the given help context ID.
Example analysisPackObj.ShowHelp
StatToolsAnalysisPacks Object
Count Property
Description Returns the number of StatToolsAnalysisPack objects in
the collection.
Syntax Object.Count
Arguments None.
Item Property
Description Returns a specific analysis pack, by index or by name,
from the collection of analysis packs. Note this is the
default method for this object.
92 StatToolsAnalysisPacks Object
StatToolsAnalysisPacks Object — Path Property
Path Property
Description Returns the “Analyses” subdirectory of StatTools.
Syntax Object.Path
Arguments None.
StatToolsChart Object
AddCategoryXAxis Method
Description Adds a category (i.e. non-numeric) x-axis to a
StatToolsChart object, formatted in the standard StatTools
manner.
Syntax Object.AddCategoryXAxis(categoryNamesRange As
Range, Optional axisTitle as String, Optional
verticalLabels As Boolean)
94 StatToolsChart Object
StatToolsChart Object — AddLegend Method
AddLegend Method
Description Adds a legend to a StatToolsChart object formatted in the
standard StatTools manner.
AddTitle Method
Description Adds a title to a StatToolsChart object, formatted in the
standard StatTools manner.
AddValueXAxis Method
Description Adds a value (i.e. numeric) x-axis to a StatToolsChart
object, formatted in the standard StatTools manner.
96 StatToolsChart Object
StatToolsChart Object — AddValueYAxis Method
AddValueYAxis Method
Description Adds a value (i.e. numeric) y-axis to a StatToolsChart
object, formatted in the standard StatTools manner.
AddWatermark Method
Description StatTools charts generated from a student or trial versions
typically will automatically be given watermarks in order to
show the user that this is an academic or unlicensed
version of the software. If, however, you make a chart of
type StatToolsChartTypeCustom, you should call this
method to manually add the watermark. Note: You do not
need to check first if the currently running copy of
StatTools is a student or trial version before calling this
method. StatTools will ignore the call if no watermark is
needed.
Syntax Object.AddWatermark
Arguments None.
Example myChartObject.AddWatermark
ApplyDefaultFormatting Method
Description StatTools will normally format new charts in a consistent
manner, but if you create a chart of type
StatToolsChartTypeCustom, you may want to call this
function to format chart axes, titles, and legends in the
standard StatTools fashion.
Syntax Object.ApplyDefaultFormatting
Arguments None.
Example myChartObject.ApplyDefaultFormatting
98 StatToolsChart Object
StatToolsChart Object — ApplyGradientToBars Method
ApplyGradientToBars Method
Description For column style charts, StatTools often will apply a
shading gradient to the bars. If you wish to apply the
standard StatTools shading to your own graphs, this
method may be called.
Syntax Object.ApplyGradientToBars
Arguments None.
Example myChartObject.ApplyGradientToBars
Chart Property
Description The StatToolsChart object is just a wrapper for an Excel
Chart object, which allows you to quickly format your
charts in the standard StatTools manner. Often you will
need to access the underlying Excel chart object from the
StatTools wrapper. The Chart property allows you to
retrieve that object.
Syntax Object.Chart
Arguments None.
DefaultSeriesColor Method
Description To provide a consistent look to graphs with multiple series,
often you need a color “sequence.” That is, a nice
sequence of colors that are mutually distinct and look good
together on a graph. This method provides a utility for
doing that.
Example ‘Use the default series color sequence on the series of this
graph
For i=1 to myChartObject.Chart.SeriesCollection.Count
Set thisSeries =
myChartObject.Chart.SeriesCollection(i)
thisSeries.Interior.Color =
myChartObject.DefaultSeriesColor(i)
Next
StatToolsDataSet Object
Attach Method
Description “Attaches” a StatToolsDataSet object to its Excel
workbook location if the attachManually flag was set in
either the Add or AddMulti methods. When you create a
new data set using either the Add or AddMulti methods,
usually you will let StatTools automatically “attach” it to the
workbook for you. This attaching process writes the data
set information into the workbook, sets up any defined
names for the data set’s variables, and (if specified)
formats the data set’s range. If, however, after you create
the data set, you need to make a large number of
modifications to the variables of the data set, you may
want to attach it manually after you have made these
changes. This prevents a large amount of reading and
writing of information from Excel and will speed the
process of creating a new data set.
Syntax Object.Attach
Arguments None.
AutoFitColumns Method
Description Sizes the columns of the data set to be wide enough to
display it’s contents. This method will not shrink or
increase the column width beyond certain limits.
Syntax Object.AutoFitColumns
Arguments None.
Example myDataSetObject.AutoFitColumns.
CreateUtilityVariables Method
Description Creates one or more “utility” variables. A “utility” variable
is a variable created by the transformation of one or more
other variables in a data set. These variables are either
placed to the right of the existing variables in the data set,
or alternatively in a completely new data set on a new
worksheet. This is generally determined by the
UtilityNewVariablePreference property of the
StatToolsSettings object, but this setting can be
overridden in some circumstances. For example, if the
new variables will not fit if inserted into the existing data
set, they will be placed on a new worksheet. Also, if the
data set is made up of multiple ranges, it is not permitted
to create the new utility variables on a new worksheet.
The CreateUtilityVariables_Validate method can be used
to determine what placement style will be used in advance.
That same method can also be used to determine whether
utility variables are able to be created, without actually
doing so.
CreateUtilityVariables_Validate Method
Description See the CreateUtilityVariables method for more information
about utility variables. This method can be called in advance
of that method to determine whether it is possible to insert
certain number of utility variables into a data set. This method
will not actually create any variables. If the
displayUserWarningsAndQueries argument is set, this method
will also warn the user about inserting rows and columns into
their data, as well displaying other errors and warnings that
may occur. Optionally, you may also retrieve what type of
placement style will be used by the CreateUtilityVariables
method.
Syntax Object.CreateUtilityVariables_Validate(numVariables as
Integer, displayUserWarningsAndQueries As Boolean,
Optional resultPlacement as StatToolsUtilityPlacement)
DataRegion Property
Description Returns an Excel range corresponding to the data region
of the data set. The data region is the data set range
minus any part reserved for the names of variables. For a
multi-range data set, you must specify which of the
multiple ranges to retrieve. See the section “DataSets,
Variables, and VariableLists” of this document for more
information.
Delete Method
Description Deletes the data set. Deleting a data set will remove its
definition from the workbook where it resides, remove any
defined names associated with the data set, and remove
any formatting of the data set’s range. It does not,
however delete any cell values in the data set.
Syntax Object.Delete
Arguments None.
Example myDataSetObject.Delete
ExcelRange Property
Description Returns an Excel range corresponding to the entire data
set, including both the data region and the name region.
For a multi-range data set, you must specify which of the
multiple ranges to retrieve. See the section “DataSets,
Variables, and VariableLists” of this document for more
information.
ExcelRangeCount Property
Description Returns the number of Excel ranges that make up the data
set. Most data sets are made up of a single range, and
they will return a count of 1. Multiple-range data sets,
however, are made up of more than one Excel range, and
will return a count greater than 1. The maximum number
of ranges in a data set is 255.
Syntax Object.ExcelRangeCount
Arguments None.
FormatRange Property
Description Sets or returns whether the data set range is formatted.
Changing this property will add or remove formatting as
appropriate.
Syntax Object.FormatRange
Arguments None.
Return Value Boolean. TRUE if the data set’s Excel range is formatted.
FALSE if not.
Name Property
Description Returns or sets the descriptive name of the data set. Data
set names are required to be unique within a workbook.
Syntax Object.Name
Arguments None.
NameRegion Property
Description Returns an Excel range corresponding to the data set’s
variable name region, which is the first row or column of
the data set. If the data set does not store its variable
names in the spreadsheet, this property will return
“Nothing.” For a multi-range data set, you must specify
which of the multiple ranges to retrieve. See the section
Data Sets, Variables, and Variable Lists of this
document for more information.
Variables Property
Description Returns the StatToolsVariables collection object,
containing all the variables in this data set. See the
section Data Sets, Variables, and Variable Lists of this
document for more information concerning the relationship
between data sets and variables.
Syntax Object.Variables
Arguments None.
StatToolsDataSets Object
Add Method
Description Creates a new StatToolsDataSet object with the specified
properties. This method can not be used to create multi-
range data sets. You must use the AddMulti method to do
this. This method provides you with arguments to control
the most common options for the new data set. Other
options are set to default values, which you may change
by setting various properties of the object returned by this
method. If you do this, you should consider “attaching” the
data set manually, as discussed below.
When you create a new data set using either the Add or
AddMulti methods, usually you will let StatTools
automatically “attach” it to the workbook for you. This
attaching process writes the data set information into the
workbook, sets up any defined names for the data set’s
variables, and (if specified) formats the data set’s range.
If, however, after you create the data set, you need to
make a large number of modifications to the variables of
the data set, you may want to attach it manually after you
have made these changes. This prevents a large amount
of reading and writing of information from Excel and will
speed the process of creating a new data set.
Note: This method will cause a “rescan” of the data sets in
the StatToolsDataSets collection in order to ensure the
information in the Excel workbook is consistent with the
StatTools model definition. See the section Data Sets,
Variables, and Variable Lists of this document for more
information on data sets and how they are scanned.
Arguments xlRange (Excel Range Object) – the full range of the data
set, including both the name region (if used) and the data
region.
variableLayout (Optional StatToolsVariableLayout
Enumerated Constant) – the layout of the variables within
the data set. Must be one of the following enumerated
constant values:
StatTools Object Library Reference 113
StatToolsDataSets Object — Add Method
AddMulti Method
Description This function is similar to the Add method, but it allows you
to add multiple range data sets.
When you create a new data set using either the Add or
AddMulti methods, usually you will let StatTools
automatically “attach” it to the workbook for you. This
attaching process writes the data set information into the
workbook, sets up any defined names for the data set’s
variables, and (if specified) formats the data set’s range.
If, however, after you create the data set, you need to
make a large number of modifications to the variables of
the data set, you may want to attach it manually after you
have made these changes. This prevents a large amount
of reading and writing of information from Excel and will
speed the process of creating a new data set.
CheckModelLimitations Method
Description Student versions and other restricted versions of StatTools
may enforce limitations on the number and size of the data
sets and variables. This method allows you to determine if
all the requirements are met, without running an analysis.
Syntax Object.CheckModelLimitations
Arguments None.
Count Property
Description Returns the number of items in the collection of currently
scanned data sets. See the section Data Sets, Variables,
and Variable Lists of this document for more information
on data sets and scanning.
Syntax Object.Count
Arguments None.
DeleteAll Method
Description Deletes all data sets in the currently scanned workbook.
Syntax Object.DeleteAll
Arguments None.
Example StatTools.DataSets.DeleteAll
Find Method
Description Returns a data set in the currently scanned collection,
which either overlaps or exactly matches a given range.
Return Value If a match was found, the method returns the matching
StatToolsDataSet object. If no match was found, the
function returns “Nothing.”
Item Property
Description Returns a specific data set, by index or by name, from the
collection of data sets. Note this is the default method for
this object.
Scan Method
Description This method forces a scan of the specified workbook.
Example StatTools.DataSets.Scan(myWorkbook)
ScannedWorkbook Property
Description Returns the Excel Workbook object that was last scanned.
If no workbook has been scanned, “Nothing” is returned.
Syntax Object.ScannedWorkbook
Arguments None.
ShowDataSetManager Method
Description Shows StatTool’s “Data Set Manager” dialog in the context
of the currently active Excel workbook and applies any
changes the user made in it to the data set.
Syntax Object.ShowDataSetManager
Arguments None.
Return Value Boolean. TRUE if the dialog’s “OK” button was pressed.
FALSE if the dialog was cancelled.
TotalNumVariables Property
Description Returns the total number of variables in the currently
scanned workbook. See the section Data Sets,
Variables, and Variable Lists of this document for more
information on data sets and scanning.
Syntax Object.TotalNumVariables
Arguments None.
StatToolsProductInfo Object
Copyright Property
Description Returns a string containing the copyright text of the
product.
Syntax Object.Copyright
Arguments None.
DaysUntilExpiration Property
Description Returns the number of day left before the StatTools
product license expires.
Syntax Object.DaysUntilExpiration
Arguments None.
Edition Property
Description Indicates the edition (Professional or Industrial) of
StatTools.
Syntax Object.Edition
Arguments None.
Language Property
Description Indicates the language version of StatTools.
Syntax Object.Language
Arguments None.
LimitedModelSize Property
Description Indicates whether StatTools is running with a limited model
size restriction.
Syntax Object.LimitedModelSize
Arguments None.
Name Property
Description Returns the official name of the StatTools product,
localized appropriately for the current language.
Syntax Object.Name
Arguments None.
ProductType Property
Description Indicates the type of product license for the running copy
of StatTools
Syntax Object.ProductType
Arguments None.
RegisteredCompany Property
Description The registered company of the user, as specified during
the installation of StatTools.
Syntax Object.RegisteredCompany
Arguments None.
RegisteredSerialNumber Property
Description The registered serial number of the user, as specified
during the installation of StatTools.
Syntax Object.RegisteredSerialNumber
Arguments None.
RegisteredUser Property
Description The registered name of the user, as specified during the
installation of StatTools.
Syntax Object.RegisteredUser
Arguments None.
Version Property
Description Indicates the version of the running copy of StatTools.
Syntax Object.Version
Arguments None.
WatermarkedGraphs Property
Description Indicates whether StatTools graphs will have a watermark.
Syntax Object.WatermarkedGraphs
Arguments None.
StatToolsReport Object
FinalizeReport Method
Description When you are finished generating a report, you can call
this method to do some useful processing and formatting.
The FinalizeReport method performs three main actions.
First, if the report generated is a “static” report, it will scan
through the report range and replace all spreadsheet
function in the range with fixed values. Second, it will
resize column widths so the contents of the report cells are
visible. Third, it will scroll the active window’s view so that
the upper-left corner of the report will be visible to the
user.
HeaderRange Property
Description Returns an Excel Range Object which is the “header”
range of the report. This is at the top of the report’s
worksheet, and contains general information about the
analysis being run and the date and time. A report only
has a header range if it is being placed on a new
worksheet, either in the source data workbook or in
another workbook. If a report doesn’t have a header
range, this property will return “Nothing.” See the
“Creating Reports, Tables, and Charts” section of this
document for more information on the layout of reports.
Syntax Object.HeaderRange
Arguments None.
ReportRange Property
Description Returns an Excel Range Object containing the range in
which your report may write its output. This range will be
of the size requested when the report was created using
the NewReport method. See the “Creating Reports,
Tables, and Charts” section of this document for more
information on the layout of reports.
Syntax Object.ReportRange
Arguments None.
Result Property
Description Returns the a result code indicating the success or failure
of the creation of the report. A zero indicates success,
while a non-zero result indicates an error condition. The
result code can be passed to the ResultString method of
the root StatTools object to get a description of the error.
Syntax Object.Result
Arguments None.
.FinalizeReport
End With
StatToolsSettings Object
AnalysisDialogsUseMemory Property
Description Sets or returns if an analysis will look in the currently
active workbook for default dialog settings.
Syntax Object.AnalysisDialogsUseMemory
Arguments None.
Return Value Boolean. TRUE if default settings are read out of the
active workbook. FALSE if not.
AnalysisPercentileCalculationMethod Property
Description Returns or sets the method by which StatTool’s calculates
percentiles.
Syntax Object.AnalysisPercentileCalculationMethod
Arguments None
Example StatTools.Settings.
AnalysisPercentileCalculationMethod =
StatToolsPercentileClosestObservation
AnalysisWarnMissingData Property
Description Returns or sets whether analyses that support missing
data values warn the user when variables that contain
missing data are selected.
Syntax Object.AnalysisWarnMissingData
Arguments None.
AnalysisWarnNonNumericData Property
Description Returns or sets whether analyses that support non-
numeric data values warn the user when variables that
contain such data are selected.
Syntax Object.AnalysisWarnNonNumericData
Arguments None.
ClearWorkbookMemory Method
Description Clears all default settings stored in the specified workbook.
DataSetDefaultFormatRange Property
Description Sets or returns whether new data sets are created, by
default, with special formatting applied to their Excel
range. This affects the default settings for new data sets
in the Data Set Manager dialog, as well as new data sets
created with the Add or AddMulti methods of the
StatToolsDataSets object.
Syntax Object.DataSetDefaultFormatRange
Arguments None.
Return Value Boolean. TRUE if, by default, new data sets will be
formatted. FALSE if not.
DataSetDefaultNamesInRange Property
Description Sets or returns whether new data sets are created, by
default, with the first row or column of the data set
reserved for names. This affects the default settings for
new data sets in the Data Set Manager dialog, as well as
new data sets created with the Add or AddMulti methods
of the StatToolsDataSets object.
Syntax Object.DataSetDefaultNamesInRange(secondaryRange
as Boolean)
DataSetDefaultVariableLayout Property
Description Sets or returns whether new data sets are created, by
default, with variables arranged in columns or rows. This
affects the default settings for new data sets in the Data
Set Manager dialog, as well as new data sets created with
the Add or AddMulti methods of the StatToolsDataSets
object.
Syntax Object.DataSetDefaultVariableLayout
Arguments None.
ReportDestinationCell Property
Description Controls the destination range for reports when the
ReportPlacement property is set to
StatToolsPlaceInSpecificCell.
Syntax Object.ReportDestinationCell
Arguments None.
ReportEducationalComments Property
Description Returns or sets whether educational comments are shown
in reports.
Syntax Object.ReportEducationalComments
Arguments None.
ReportLiveUpdatingPreferred Property
Description Returns or sets the updating preference for reports. If
TRUE, the user prefers “live” reports. That is, reports
which use functions to generate results, and whose results
change as the user changes the source data. If FALSE,
the user prefers “static” reports. That is, reports whose
results do not contain functions, and whose results don’t
change as the user changes the source data. The default
setting is “live.”
Syntax Object.ReportLiveUpdatingPreferred
Arguments None.
ReportNotesAndWarnings Property
Description Returns or sets whether notes and warnings are shown in
reports.
Syntax Object.ReportNotesAndWarnings
Arguments None.
ReportOverwriteExisting Property
Description Controls whether newly generated reports in a workbook
will replace already existing reports in that same
workbook.
This property only has effect if the ReportPlacement
property is StatToolsPlaceInActiveWorkbook or if the
ReportPlacement property is
StatToolsPlaceInNewWorkbook and the
ReportReuseNewWorkbook property is True.
Syntax Object.ReportOverwriteExisting
Arguments None.
ReportPlacement Property
Description Determines where new reports are placed. Analyses that
are classified as utilities will not respect this preference.
They are controlled by the UtilityNewVariablePreference
property. The options are:
o StatToolsPlaceInNewWorkbook - Reports go in a
newly created Excel workbook.
o StatToolsPlaceInActiveWorkbook - Reports go in
the currently active Excel workbook.
o StatToolsPlaceInLastColumn – reports are
placed in the first unused column in the active
worksheet. If there is not enough room on the
active worksheet, the report will go on a new
worksheet in the active workbook.
o StatToolsPlaceInSpecificCell – reports are placed
in a location specified by the user via a dialog, or
from the ReportDestinationCell property.
Syntax Object.ReportPlacement
Arguments None.
ReportReuseNewWorkbook Property
Description Controls whether only a single new Excel workbook will be
created to hold reports.
This property only has effect if the ReportPlacement
property is set to StatToolsPlaceInNewWorkbook, in which
case a new Excel workbook will be created only the first
time reports are generated. All subsequent reports will
then be put into the workbook originally created.
Syntax Object. ReportReuseNewWorkbook
Arguments None.
ShowDialog Method
Description Shows the settings dialog to the user, with the specified
tab of the dialog activated.
Return Value Boolean. TRUE if the dialogs “OK” button was clicked.
FALSE if the dialog was cancelled.
Example ‘Bring up the settings dialog which the data sets tab active:
If
StatTools.Settings.ShowDialog(StatToolsSettingsDataSet
s) Then MsgBox “OK Clicked”
UtilityLiveUpdatingPeferred Property
Description Returns or sets the updating preference for results of
analyses classified as utilities. A utility is a special sort of
analysis that performs operations on data sets and
variables to create new data sets and variables.
If TRUE, the user prefers “live” utility results. That is, they
use functions to generate results, and these results
changes as the user changes the source data. If FALSE,
the user prefers “static” utility results. That is, results
which do not contain functions, and that don’t change as
the user changes the source data. The default setting is
“static.”
Syntax Object.UtilityLiveUpdatingPreferred
Arguments None.
UtilityNewVariablePreference Property
Description Returns or sets the preferred destination for utility results.
A utility is a special sort of analysis that performs
operations on data sets and variables to create new data
sets and variables. The placement of non-utility analyses
is governed by the ReportPlacement property.
Syntax Object.UtilityNewVariablePreference
Arguments None.
Example StatTools.Settings.UtilityNewVariablePreferrence =
StatToolsPlaceInInsertedVariables
StatToolsTable Object
AddCustomComment Method
Description Adds an “custom” comment to a cell of a table.
There are two ways to add comments to your own table cells,
using either the AddCustomComment method or the
AddStandardComment method. A “standard” comment’s text
is determined by StatTools. A “custom” comment’s text is
passed in as a arbitrary text string.
StatTools reports often add little comments to various cells, to
warn you of analysis limitations, or to point out certain results
or features. These comments fall in two categories. The
“Notes and Warnings” category includes comments that are
general in nature, and which we recommend all user of the
product, at least at first, read. These comments are shown, by
default, when reports are generated unless the user
specifically turns them off. The “Educational Comments”
category serve as learning aids for students using StatTools in
a classroom environment. These comments are, by default,
not shown, unless they are turned on by the user.
Arguments rowPos (Long) – the row position where the comment should
appear. This is relative to the interior cells of the table. Thus a
value of 1 is the 1st interior row of the table. A value of 0, will
put the comment in the header row at the top of the table.
colPos (Long) – the column position where the comment
should appear. This is relative to the interior of the table.
Thus a value of 1 is the 1st interior column of the table. A value
of 0, will put the comment in the header column at the left of
the table.
isEducationalComment (Boolean) – If TRUE, this comment is
an educational comment. In that case the comment will only
appear if the ReportEducationalComments property of the
user’s settings is set to TRUE. If FALSE, this comment is a
StatTools note or warning. In that case the comment will only
appear if the ReportNotesAndWarnings property of the user’s
settings is set to TRUE.
commentText (String) – the actual text of the message. Must
be no longer than 255 characters.
Return Value Boolean. TRUE if the comment was actually written. FALSE if
AddDividerLine Method
Description Adds a divider line to separate table rows or table
columns.
Example ‘Add a double divider line after the third row of the table:
myTableObject.AddDividerLine(TRUE, 3, xlDouble)
AddHeaderTallText Method
Description Writes a special type of text in the top header of the table
at the specified interior column position. If two strings are
specified, the first string appears on top of the other. If a
single string is specified, the two top header rows are
merged together, and the single string appears in the
newly merged cell.
AddHeaderText Method
Description Writes one or more strings to a table’s header. If you are
writing one or more variable names in a header, you
should use either the AddHeaderVariable or
AddHeaderVariableList methods. See the section
“Creating Reports, Tables, and Charts” of this document
for more information on tables, table headers, and their
layout.
AddHeaderVariable Method
Description Writes the name and data set name of a variable into a
table’s header. To write more than one variables’
information into a table header, use the
AddHeaderVariableList method. See the section “Creating
Reports, Tables, and Charts” of this document for more
information on tables, table headers, and their layout.
Syntax Object.AddHeaderVariable(whichHeader As
StatToolsHeader, startPos as Long, var As
StatToolsVariable)
AddHeaderVariableList Method
Description Writes the name and data set name of one or more
variables into a table’s header. To write a single
variable’s information into a table header, use the
AddHeaderVariable method. See the section “Creating
Reports, Tables, and Charts” of this document for more
information on tables, table headers, and their layout.
Syntax Object.AddHeaderVariableList(whichHeader As
StatToolsHeader, startPos as Long, varList As
StatToolsVariableList)
Example myTableObject.AddHeaderVariableList
StatToolsHeaderTop, 1, myVarListObject
AddStandardComment Method
Description Adds a “standard” comment to a cell of a table.
There are two ways to add comments to your own table
cells, using either the AddCustomComment method or the
AddStandardComment method. A “standard” comment’s
text is determined by StatTools. A “custom” comment’s
text is passed in as a arbitrary text string.
StatTools reports often add little comments to various
cells, to warn you of analysis limitations, or to point out
certain results or features. These comments fall in two
categories. The “Notes and Warnings” category includes
comments that are general in nature, and which we
recommend all user of the product, at least at first, read.
These comments are shown, by default, when reports are
generated unless the user specifically turns them off. The
“Educational Comments” category serve as learning aids
for students using StatTools in a classroom environment.
These comments are, by default, not shown, unless they
are turned on by the user. Note: Each “standard”
comment knows whether it is an educational comment or a
note or warning, thus unlike the AddCustomComment
method, you do not need to specify which category the
comment falls in.
HeaderRange Property
Description Returns the Excel Range Object corresponding to either
the top or left table header. See the section “Creating
Reports, Tables, and Charts” of this document for more
information on tables, table headers, and table layout.
InteriorRange Property
Description Returns the Excel Range Object corresponding to the
table’s interior, where the table’s data is typically written.
See the section “Creating Reports, Tables, and Charts” of
this document for more information on tables, table
interiors, and their layout.
Syntax Object.InteriorRange
Arguments None.
SignatureRange Property
Description Returns the Excel Range Object corresponding to the
table’s signature range, the small rectangle in the upper-
left corner of the table where the table’s description is
written. See the section “Creating Reports, Tables, and
Charts” of this document for more information on tables,
signature ranges, and table layout.
Syntax Object.SignatureRange
Arguments None.
TableRange Property
Description Returns the Excel Range Object corresponding to the
entire table range.
Syntax Object.TableRange
Arguments None.
StatToolsVariable Object
AutoFitColumns Method
Description Sizes the spreadsheet column or columns of the variable
to be wide enough to display it’s contents. This method
will not shrink or increase the column width beyond certain
limits.
Syntax Object.AutoFitColumns
Arguments None.
Example myVariableObject.AutoFitColumns.
CheckCategoryHeuristic Method
Description Checks if a variable “looks” like a category variable.
Syntax Object.CheckCategoryHeuristic(askUserIfQuestionable As
Boolean)
CountCategories Method
Description Returns the number of distinct categories in the variable.
Syntax Object.CountCategories
Arguments None.
CountCategoryOccurrences Method
Description Returns the number of times a given category name
appears in a variable.
Arguments catName (String) – the name of the category for which you
want to count the number of occurrences.
Return Value Long. The number of times that category name appears in
the variable.
CountCells Method
Description Counts the number of cells in the variable which meet a
specified criterion. You can use the GetCellPositions
method to return the positions of the cells within the
variable that meet the criterion in addition to the count.
Return Value Long. The number of cells in the variable meeting the
specified criterion.
Covariance Property
Description Returns the measure of covariance between this variable
and another specified variable. The two variables must
have the same number of values. Blank and non-numeric
values in either variable will be ignored.
Return Value Double. The covariance of the two variables. If the value
is not legal (for example if there is no data in one of the
variables) the special value StatToolsNoValue is returned.
Example myCovariance =
myFirstVariableObject.Covariance(mySecondVariableObj
ect)
If myCovariance = StatToolsNoValue Then Goto
errorHandler
DisplayName Property
Description Returns a descriptive string for the variable, suitable for
display in a dialog or in a report. For unstacked variables,
this is simply the name of the variable (optionally
appended to the name of the variable’s parent data set.)
For stacked variables, the name includes both the name of
the underlying value variable plus the category name for
this particular stacked variable. See the section Data
Sets, Variables, and Variable Lists of this document for
more information on stacked versus unstacked variables.
Example ‘Set the active cell to display the variables display name:
ActiveCell.Value =
myVariableObject.DisplayName(FALSE)
ExcelRange Property
Description Returns an Excel range corresponding to the variable,
optionally including or excluding the name region. For a
multi-range data set, you must specify which of the
multiple ranges of the variable to retrieve. See the section
“DataSets, Variables, and VariableLists” of this document
for more information.
ExcelRangeCount Property
Description Returns the number of Excel ranges that make up the
variable. Most variables are made up of a single range,
and they will return a count of 1. Multiple-range data sets,
however, have variables that are made up of more than
one Excel range, and these variables will return a count
greater than 1. The maximum number of ranges in a
variable is 255.
Syntax Object.ExcelRangeCount
Arguments None.
FreezeData Method
Description Replaces all Excel formulas in the variable cells with their
currently calculated values.
Syntax Object.FreezeData
Arguments None.
Example myVariableObject.FreezeData
GetCategoryNames Method
Description Returns an array of the distinct category names of this
variable.
GetCategoryOccurrences Method
Description For a variable that contains categorical data (for example,
a variable with values of “Male” and “Female”.) This
routine returns the positions of all the data values that
match a given category name. Categories are case-
insensitive, so “Male” “MALE” and “male” are all treated as
the same category.
GetCellPositions Method
Description Returns the positions and count of cells that match a
certain criterion. For example, you might want the cell
positions of all the blank cells in a variable. The returned
array are offsets of the cells in the variable object. So if
the array of 3 elements {2,7,13} were returned by this
function, that corresponds to the 2nd, 7th, and 13th cells of
the variable. You can use the CountCells method to
simply return the number of cells in a variable meeting the
same criterion, without getting the cell positions.
Syntax Object.GetCellPositions(getWhat As
StatToolsCountOption, cellPositions() As Long)
Example ‘Count the number of blank cells and get their positions:
Dim cellPositions() as Long
numBlankCells =
myVariableObject.GetCellPositions(StatToolsCountBlank
, cellPositions())
GetCellValues Method
Description Returns all the cell values of a particular type from the
variable. This function returns this information in an array
of Variants. See also the GetCellValuesAsNumbers and
GetCellValuesAsCategories for alternative methods.
GetCellValuesAsCategories Method
Description (Available in StatTools version 1.1 and later)
Returns all the cell values of a particular type from the
variable. This function returns this information in an array
of Strings. See also the GetCellValues and
GetCellValuesAsNumbers for alternative methods.
Syntax Object.GetCellValuesAsCategories(getWhat as
StatToolsCountOption, missingTextValue as String,
cellValues() as String)
Arguments getWhat (StatToolsCountOption Enumerated Constant) –
controls exactly what cells are to be counted. Must be one
of the following enumerated constant values:
StatToolsCountCells – get all cell values.
StatToolsCountNumeric – get only numeric values.
StatToolsCountNonBlank – get only cells that have a value
(numeric or text) in them.
StatToolsCountNonBlankNonNumeric – get only cells that
have non-numeric values in them.
GetCellValuesAsNumbers Method
Description (Available in StatTools version 1.1 and later)
Returns all the cell values of a particular type from the
variable. This function returns this information in an array
of Doubles. See also the GetCellValues and
GetCellValuesAsCategories for alternative methods.
Syntax Object.GetCellValuesAsNumbers(getWhat as
StatToolsCountOption, missingOrNonNumericValue as
Double, cellValues() as Double)
Arguments getWhat (StatToolsCountOption Enumerated Constant) –
controls exactly what cells are to be counted. Must be one
of the following enumerated constant values:
StatToolsCountCells – get all cell values.
StatToolsCountNumeric – get only numeric values.
StatToolsCountNonBlank – get only cells that have a value
(numeric or text) in them.
StatToolsCountNonBlankNonNumeric – get only cells that
have non-numeric values in them.
HasMissingData Property
Description Returns whether the variable contains missing values.
The search for missing values can be performed on the
entire variable, or limited to the beginning, middle, or end.
Syntax Object.HasMissingData(checkLocation As
StatToolsCheckLocation)
Return Value Boolean. TRUE if missing data was found in the specified
location. FALSE if not.
Example hasInteriorBlanks =
myVariableObject.HasMissingValues(StatToolsCheckMid
dle)
HasNonNumericData Property
Description Returns whether the variable contains any non-numeric
cell values. Blanks are ignored.
Syntax Object.HasNonNumericData
Arguments None.
Maximum Property
Description Returns the current maximum numeric value in the
variable. Blanks, and non-numeric values are ignored.
Syntax Object.Maximum
Arguments None.
Return Value Double. The maximum value. If the value is not legal (for
example if there is no data in the variables) the special
value StatToolsNoValue is returned.
Mean Property
Description Returns the current mean of the numeric values in the
variable. Blanks and non-numeric values are ignored.
Syntax Object.Mean
Arguments None.
Return Value Double. The mean value. If the value is not legal (for
example if there is no data in the variables) the special
value StatToolsNoValue is returned.
Minimum Property
Description Returns the current minimum numeric value in the
variable. Blanks, and non-numeric values are ignored.
Syntax Object.Minimum
Arguments None.
Return Value Double. The minimum value. If the value is not legal (for
example if there is no data in the variables) the special
value StatToolsNoValue is returned.
Name Property
Description Returns or sets the name of the variable.
Syntax Object.Name
Arguments None.
NumberFormatExcelCode Property
Description Returns an Excel number format code (a string that can be
passed to the NumberFormat) that gives a recommended
number format for a given statistical function of the
variable (i.e. Mean, Variance, Skewness, etc.) Most
statistics will respect the NumberFormatIsAuto,
NumberFormatNumDigits, and NumbeFormatType
properties (which are all set by the user via the Data Set
Manager dialog.) Others, however, use alternate or
modified formats. For example, the mean of the variable
will most likely be formatted differently than the skewness.
You may need a number format for your own statistic
function which is not in the list. In that case, you either
need to determine which one of the existing statistic
function is closest to your function (usually a fairly easy
task), or determine what number formatting to use
yourself.
NumberFormatIsAuto Property
Description Returns or sets whether this variable’s default output
number format is determined automatically by StatTools
based on the data stored in the variable. A variable’s
default output number format controls how many (but by
no means all) report cells will be numerically formatted.
Syntax Object.NumberFormatIsAuto
Arguments None.
NumberFormatNumDigits Property
Description Returns or sets the number of digits after the decimal in
the variable’s default output number format. If you set this
property, the NumberFormatIsAuto property will be turned
off. A variable’s default output number format controls
how many (but by no means all) report cells will be
numerically formatted.
Syntax Object.NumberFormatNumDigits
Arguments None.
Example ‘Set the default output format to 5 fixed digits after the
decimal:
myVariableObject.NumberFormatType =
StatToolsNumberFormatFixed
myVariableObject.NumberFormatNumDigits = 5
NumberFormatString Property
Description Allows you to return or set the default output number
format as a string. Setting this property is equivalent of
individually setting the NumberFormatIsAuto,
NumberFormatType, and NumberFormatNumDigits
properties.
Syntax Object.NumberFormatString
Arguments None.
With myVariableObject
.NumberFormatIsAuto = FALSE
.NumberFormatType = StatToolsNumberFormatFixed
.NumberFormatNumDigits = 5
End With
NumberFormatType Property
Description Returns or sets the type of the default output number
format for the variable. If you set this property, the
NumberFormatIsAuto property will be turned off. A
variable’s default output number format controls how many
(but by no means all) report cells will be numerically
formatted.
Syntax Object.NumberFormatType
Arguments None.
Example ‘Set the default output format to 5 fixed digits after the
decimal:
myVariableObject.NumberFormatType =
StatToolsNumberFormatFixed
myVariableObject.NumberFormatNumDigits = 5
Percentile Property
Description Calculates a percentile (x-value) from a specified p-value.
CalculationMethod (Optional
StatToolsPercentileCalculationMethod) - While the
concept of a percentile is unambiguous for theoretical
probability distributions, the calculation of percentiles of a
finite sample of data is problematic because there are a
number of different calculation methods. The possible
choices are:
o StatToolsPercentileExcelPercentileFunction
o StatToolsPercentileInterpolatedAssymmetricEndp
oints
o StatToolsPercentileClosestObservation
o StatToolsPercentileEmpiricalDistFunction
o StatToolsPercentileInterpolatedSymmetricEndpoi
nts
o StatToolsPercentileEmpiricalDistFunctionWithAv
eraging
o StatToolsPercentileAuto
If this option is left missing, the option is retrieved from the
AnalysisPercentileCalculationMethod property of the
settings object.
RangeName Property
Description Returns or sets the Excel range name of this variable.
Syntax Object.RangeName
Arguments None.
ReferenceStr Property
Description Returns a string which can be used to reference the
variable in a spreadsheet function.
Often you need to put a reference to a variable into a
spreadsheet function. For example, to make a cell return
the mean of a variable, you would write:
=StatMean(varRef)
into the cell. Instead of hard-coding the excel range (e.g.
$A$1:$A$100) of the variable, however, you should use
this property. For simple, unstacked variables, the range
name of the variable will be used (with or without full
qualification – see below.) For stacked variables,
however, it is much more complicated. This function will
take care of the details of creating the appropriate
StatDestack function. See the section Data Sets,
Variables, and Variable Lists for more information on the
differences between stacked and unstacked variable
objects.
One important note: References need to be fully qualified
(that is, they need to include the name of the workbook
where the variable resides) if the cell where the reference
is being made from is not the same as the workbook
where the variable resides. This function decides whether
to return a fully qualified reference or not based on the
current ReportPlacement, ReportDestinationWorkbook,
and ReportDestinationCell properties. If these properties
indicate that the destination is not the same as the
workbook the variable resides in, the reference will be fully
qualified. Otherwise it will be locally qualified. If you need
to control explicitly how the reference is qualified, use the
ReferenceStrEx method instead.
Syntax Object.ReferenceStr
Arguments None.
ReferenceStrEx Property
Description Returns a string which can be used to reference the variable in a
spreadsheet function. Unlike the ReferenceStr method,
ReferenceStrEx allows you to explicitly control the qualification of
the reference.
Often you need to put a reference to a variable into a
spreadsheet function. For example, to make a cell return the
mean of a variable, you would write:
=StatMean(varRef)
into the cell. Instead of hard-coding the excel range (e.g.
$A$1:$A$100) of the variable, however, you should use this
property. For simple, unstacked variables, the range name of the
variable will be used (with or without full qualification – see
below.) For stacked variables, however, it is much more
complicated. This function will take care of the details of creating
the appropriate StatDestack function. See the section Data Sets,
Variables, and Variable Lists for more information on the
differences between stacked and unstacked variable objects.
One important note: References need to be fully qualified (that
is, they need to include the name of the workbook where the
variable resides) if the cell where the reference is being made
from is not the same as the workbook where the variable resides.
This function decides whether to return a fully qualified reference
or not based on the argument you pass in. In contrast, the
method ReferenceStr examines the current user’s settings to
determine what qualification to use.
Stacked Property
Description Returns TRUE if this is a stacked variable.
Syntax Object.Stacked
Arguments None.
StackedCategoryVariable Property
Description For a stacked variable, returns the source category
variable. If this is not a stacked variable, “Nothing” is
returned. The corresponding value variable can be found
from the StackedValueVariable property, and the category
name is store in the variable’s Name property. You can
create a stacked variable object using the
NewStackedVariable or NewStackedVariableList methods
of the root StatTools object.
Syntax Object.StackedCategoryVariable
Arguments None.
StackedValueVariable Property
Description For a stacked variable, returns the source value variable.
If this is not a stacked variable, “Nothing” is returned. The
corresponding category variable can be found from the
StackedCategoryVariable property, and the category name
is store in the variable’s Name property. You can create a
stacked variable object using the NewStackedVariable or
NewStackedVariableList methods of the root StatTools
object.
Syntax Object.StackedValueVariable
Arguments None.
StdDev Property
Description Returns the current standard deviation of the numeric
values in the variable. Blanks and non-numeric values
are ignored.
Syntax Object.StdDev
Arguments None.
Return Value Double. The standard deviation. If the value is not legal
(for example if there is no data in the variables) the
special value StatToolsNoValue is returned.
Variance Property
Syntax Object.Variance
Arguments None.
Return Value Double. The variance. If the value is not legal (for
example if there is no data in the variables) the special
value StatToolsNoValue is returned.
WriteCustomFormattedFormula Method
Description Puts a custom spreadsheet formula into the specified
range and sets the range’s numeric formatting. If you are
writing one of the standard StatTools summary measures,
consider using the WriteStandardFormattedFormula
method instead.
Syntax Object.WriteCustomFormattedFormula(xlRange As
Range, formulaString as String, Optional formatLike As
StatToolsVariableFormula)
WriteStandardFormattedFormula Method
Description Puts a standard spreadsheet formula into the specified range and
sets the range’s numeric formatting. If you need to write a function
not on the list of standard ones, use the
WriteCustomFormattedFormula method instead.
Arguments xlRange (Excel Range Object) – the destination range for the
formula.
whichFormula (StatToolsVariableFormula Enumerated Constant) –
which standard formula to write. One of the following constant
values:
o StatToolsFuncAutocorrelation
o StatToolsFuncAveDev
o StatToolsFuncKurtosis
o StatToolsFuncMax
o StatToolsFuncMean (the default)
o StatToolsFuncMedian
o StatToolsFuncMin
o StatToolsFuncPercentile
o StatToolsFuncQuartile
o StatToolsFuncRange
o StatToolsFuncSkewness
o StatToolsFuncStdDev
o StatToolsFuncVariance
o StatToolsFuncCount
o StatToolsFuncSum
param (Optional Variant) – the median, percentile, and quartile
functions all require additional parameters. These can be entered
here. If the parameter is a single numeric value, simply add that
as the final argument. If there is more than one parameter, or the
parameter is not a number, enter it as a string.
StatToolsVariableList Object
Add Method
Description Adds a new variable to the variable list collection. If you
want to add one variable list collection to another, use the
AddList method.
AddList Method
Description Adds an entire variable list to this variable list. If you want
to add a single variable to a list, use the Add method.
AllFromSameDataSet Property
Description Returns whether all variables in the list come from the
same StatToolsDataSet object.
Syntax Object.AllFromSameDataSet
Arguments None.
Return Value Boolean. TRUE if all variables in the collection come from
the same data set. FALSE if not.
AllSameLayout Property
Description Returns whether all variables in the list have the same
layout. That is, if they all are arranged in rows or if they
are all in columns.
Syntax Object.AllSameLayout
Arguments None.
AllSameSize Property
Description Returns whether all variables in the list have the same
number of cells.
Syntax Object.AllSameSize
Arguments None.
Return Value Boolean. TRUE if all the variables in the list contain the
same number of spreadsheet cells. FALSE if not.
ApplyUtilityFormatting Method
Description Applies formatting for new variables created by a utility
analysis. A utility performs operations on data sets and
variables to create or modify existing data sets and
variables.
The method will optionally freeze the cells and resize the
columns of all the variables in the list.
Example myVarListObject.ApplyUtilityFormatting
Clear Method
Description Removes all items from the variable list.
Syntax Object.Clear
Arguments None.
Example myVarListObject.Clear
Count Property
Description Returns the number of StatToolsVariable objects in the
list.
Syntax Object.Count
Arguments None.
HasMissingData Property
Description Returns whether any variable in the variable list collection
has missing (i.e. blank) data cells.
Syntax Object.HasMissingData
Arguments None.
HasMultiRangeVariable Property
Description Returns whether any variable in the variable list collection
is a multiple range variable.
Syntax Object.HasMultiRangeVariable
Arguments None.
Return Value Boolean. TRUE if any variables in the collection are multi-
range variables. FALSE if not.
HasNonNumericData Property
Description Returns whether any variable in the variable list collection
has non-numeric cell values. Missing data is not
considered non-numeric.
Syntax Object.HasNonNumericData
Arguments None.
Return Value Boolean. TRUE if any variable in the collection has non-
numeric data
IsStackingSet Property
Description Returns whether all variables in the variable list collection
are stacked, and if so, if they all have the same source
category variable and value variable. See the section
Data Sets, Variables, and Variable Lists of this
document for more information on stacked versus
unstacked variables.
Syntax Object.IsStackingSet
Arguments None.
Return Value Boolean. TRUE if all variables in the list are stacked from
the same source. FALSE if not.
Example ‘If the variable list doesn’t form a “stacking set” fail:
If Not myVarListObject.IsStackingSet Then Goto fail
Item Property
Description Returns a specific variable, by index, from the variables in
the collection. Note this is the default method for this
object.
MaxCellCount Property
Description Returns the number of data cells in the largest variable in
the variable list collection.
Syntax Object.MaxCellCount
Arguments None.
Return Value Long. The number of data cells in the largest variable in
the list.
Remove Method
Description Removes the specified item from the list.
SharedNumberFormatExcelCode Property
Description Returns an Excel number format code (a string that can be
passed to the NumberFormat) that gives a recommended
number format for a given statistical function of the
variables.
This is similar to the NumberFormatExcelCode property of
the StatToolsVariable object, except it tries to determine a
single number format appropriate for displaying statistic of
the entire variable list, if possible. If all the variables in the
list have the same NumberFormatExcelCode property for
the formatStyle specified, this is simple, and that shared
value is returned by this function. If not, however, this
property will determine the mode that best encompasses
the different codes.
Note: You may need a number format for your own
statistic function which is not in the formatStyle list. In that
case, you either need to determine which one of the
existing statistic function is closest to your function (usually
a fairly easy task), or determine what number formatting to
use yourself.
Syntax Object.SharedNumberFormatExcelCode(Optional
formatStyle As StatToolsVariableFormula)
Validate Method
Description Performs simple validation of a variable list, which can be used to
simplify repetitive checks in an analysis’s public Validate routine.
Its exact behavior changes depending on the validation mode
passed in. This mode is usually the same value passed into the
analysis’s Validate routine.
Syntax Object.Validate(validationMode As StatToolsValidationMode,
Optional minCount, Optional maxCount)
StatToolsVariables Object
Count Property
Description Returns the number of variable objects in a data set’s
variables collection.
Syntax Object.Count
Arguments None.
Insert Method
Description Inserts a new variable in an existing variable into an
existing data set’s variable collection.
Note: This method will insert a new row or column into the
spreadsheet for the new variable. You can call the
InsertValidate method before calling this method to
determine if there is enough room to insert variables.
Example ‘If there is enough room, insert three new variables at the
end of the data set:
If myDataSet.Variables.InsertValidate(3) = 0 Then
myDataSet.Variables.Insert(“New Var #1”)
myDataSet.Variables.Insert(“New Var #2”)
myDataSet.Variables.Insert(“New Var #3”)
End If
InsertValidate Method
Description Determines if there is enough room to insert one or more
Example ‘If there is enough room, insert three new variables at the
end of the data set:
If myDataSet.Variables.InsertValidate(3) = 0 Then
myDataSet.Variables.Insert(“New Var #1”)
myDataSet.Variables.Insert(“New Var #2”)
myDataSet.Variables.Insert(“New Var #3”)
End If
Item Property
Description Returns a specific variable, by index, from the
collection of variables. Note this is the default
method for this object.
Layout Property
Description Returns how the variables are laid out in the data set,
either in rows or in columns. This property is set when you
create the data set parent of the variables object, and may
not be changed subsequently.
Syntax Object.Layout
Arguments None.
Example If myDataSet.Variables.Layout =
StatToolsVariableLayoutColumns Then
MsgBox “Columns”
Else
MsgBox “Rows”
End If
NamesInRange Property
Description Returns whether the first row or column of each variable in
a data set’s range is reserved for the variable name. This
property is set when you create the data set parent of the
variables object, and may not be changed subsequently.
Return Value Boolean. TRUE if names are displayed in the first cell of
the range. FALSE if not.
Example namesInPrimaryRange =
myDataSet.NamesInRange(FALSE)
namesInSecondaryRanges =
myDataSet.NamesInRange(TRUE)
Overview
Each analysis you write needs to be able to display a dialog to the user to
retrieve the source data and parameters for your analysis. StatTools
provides two controls, the STControlsOptionPanel control and the
STControlsVarSelector control to make this process easier. The
STControlsOptionPanel control is a simple container control consisting of
three buttons, which provide a way for the user to request context sensitive
help, save the current dialog settings as the default settings for the
analysis, and bring up StatTools’ settings dialog. The STControlsVarSelector
control is a flexible component for allowing the user to select one or more
variables to be analyzed.
A list of all the methods, properties, and objects of these controls is listed in
the section “STControls OCX Library Reference” of this document.
222 Overview
Overview — Attaching and Detaching the Controls
After doing so, the Excel VBA Toolbox window should have two new
controls added:
fail:
'Detach the controls from the External StatTools Module:
VarSelector.Detach dialogWasCancelled
OptionPanel.Detach
ShowDialog = rc
End Function
224 Overview
Overview — The Variable Selector Control
The dialogs of most analyses need to provide a mechanism for the user to
select one or more variables to analyze. The STControlsVarSelector control
(shown above) provides a convenient and flexible way to ask for this
information.
Make sure to call the Attach method of the control before you use it, and
the Detach method when you are finished with it as described in the
previous section.
Parts of the The variable selector control is made of four parts: the caption, the data
Variable set selector, the data format selector, and the list of variables and fields.
Selector Control
The caption is the text that appears at the very top of the control, and
which explains to the user the number (and sometimes the type) of
variables that should be selected. The caption can be set using either the
StdCaption or Caption properties of the control. The StdCaption property
allows you to choose from a small number of default captions. Using this
makes it easy to be consistent with the core analysis pack’s captions. If
none of the standard captions meet your needs, use the Caption method to
write any text you desire in the caption.
The data set selector, just beneath the caption, lets the user select the active
data set of the control. Only the variables in the chosen data set will be
shown in the grid display underneath. The user can also set the control to
show all data sets simultaneously. The ActiveDataSet property of the
control corresponds to this setting.
226 Overview
Overview — The Variable Selector Control
If you know that a given field must have at most one selected variable, you
should set the field’s EnforceSingleSelection property. If the user clicks on a
field’s checkbox when this property set, the control will automatically
uncheck other selections in the same field. The
EnforceSingleSelectionPerRow property of the STControlsVarSelector control
does a similar thing, except it enforces that a given variable may be
selected in only a single field.
It is often convenient to hide one or more fields. For example, if your
control supports both stacked and unstacked data formats, a good way to
support both formats is to configure the control with three fields, one for
the unstacked case, and two for the category and value variables of the
stacked case. Then if the user switches data format modes, you simply
need hide or unhide the appropriate fields. Use the Visible property of the
STControlsVarSelectorField object to hide and unhide fields.
Validation When the user clicks the OK button of your dialog, you will usually want
to check that there is a proper number of selected variables, and perhaps
that the variables selected meet certain requirements. While it is certainly
possible for you to do all your own validation of selected variables, by
retrieving the selected variables from the control (and sometimes for
custom validation you will need to do this very thing) the
STControlsValidation object can make your life much easier. It also help
you remain consistent with other StatTools analyses.
Each STControlsVarSelectorField object has a child STControlsValidation
object, which can be accessed via the Validation property. The validation
object contains a large number of properties which you can set
individually to control the validation process. Typically, however, you
will use the SetDefaultConfiguration method to set the validation object to a
base state, and then set one or two other properties to non-default values.
For example, to create a field that requires between two and five variables,
all which must have the size (bigger than ten cells), you could write the
code:
With VarSelector.Fields(1).Validation
.SetDefaultConfiguration STControlsNumericVariables, 2, 5
.CellCountMatching = STControlsMatchWithinField
.CellCountMin = 10
End With
When the user clicks the OK button of your dialog, call the Validate method
of the STControlsVarSelector control to actually perform the validation. If
the method returns a zero, the validation passed. If the method returns a
non-zero result the validation failed and the dialog should not be
dismissed.
Using the STControls OCX 227
Overview — The Variable Selector Control
228 Overview
STControlsOptionPanel Object — Attach Method
STControlsOptionPanel Object
Attach Method
Detach Method
Description Informs the control that you are finished using it. This
method should be called when you are finished with the
STControlsOptionPanel object. Make sure to call the
Attach method before you use the control.
Syntax Object.Detach
Arguments None.
SaveAsDefault Event
Description An event that fires when the user clicks the “Save as
Default” icon.
Arguments None.
STControlsValidation Object
CategoryCountMax Property
Description Sets or returns the maximum number of categories (that is
distinct text values) that are allowed in the variables being
validated. A value of zero suppresses any check for
maximum number of categories. The response to having
too many categories is controlled by the
CategoryOverflowResponse property.
Syntax Object.CategoryCountMax
Arguments None.
CategoryCountMin Property
Description Sets or returns the minimum number of categories (that is
distinct text values) that are allowed in variables being
validated. A value of zero suppresses any check for
minimum number of categories. The response to having
too few categories is an error, never a warning.
Syntax Object.CategoryCountMin
Arguments None.
CategoryHeuristic Property
Description Sets or returns whether the user should be warned if a
variable doesn’t appear to be a category variable. This
validation step will call the CheckCategoryHeuristic
method for each of the variables being validated, and
warns the user if any one of them fails the check.
Syntax Object.CategoryHeuristic
Arguments None.
Example VarSelector.Fields(1).Validation.CategoryHeuristic =
TRUE
CategoryOverflowResponse Property
Description Sets or returns what happens if there are more categories
than the value given in the CategoryCountMax property.
Syntax Object.CategoryOverflowResponse
Arguments None.
CellCountMatching Property
Description Sets or returns whether every variable being validated
must have the same number of data cells. This check can
be performed in two fashions. First, it can be done only on
the selected variables within the field. Second, it can be
done on all selected variables in all fields with the
matchingStyle option set to STControlsMatchAcrossFields.
Syntax Object.CellCountMatching
Arguments None.
CellCountMin Property
Description Sets or returns the minimum number of data values that
must be present in the variables being validated. A value
of zero suppresses any check for the minimum number of
values.
Syntax Object.CellCountMin
Arguments None.
Return Value The minimum number of data values in the variables being
validated, or zero if the check is not being performed.
CellCountMax Property
Description Sets or returns the maximum number of data values that is
allowed in the variables being validated. A value of zero
suppresses any check for the maximum number of values.
Syntax Object.CellCountMax
Arguments None.
CellCountNonMissingOnly Property
Description Sets or returns whether the CellCountMin and
CellCountMax properties perform their check on all cell
values (regardless if they are blank or occupied) or if it
performs it on only the non-missing cell values.
Syntax Object.CellCountNonMissing
Arguments None.
Enabled Property
Description Sets or returns whether the validation object is enabled. A
disabled validation object performs no validation at all.
Note: Even if this property is set to TRUE to enable the
validation, if the STControlsField parent object is invisible,
the validation will not be performed unless the
ValidateEvenIfInvisible property is set to TRUE.
Syntax Object.Enabled
Arguments None.
MissingDataBeginningResponse Property
Description Sets or returns the response of the validator when missing
data is found at the “beginning” of the data set. The
beginning of the data set is all the data before the first
non-blank cell in the data set.
Syntax Object.MissingDataBeginningResponse
Arguments None.
MissingDataEndResponse Property
Description Sets or returns the response of the validator when
missing data is found at the “end” of the data set.
The end of the data set is all the data after the last
non-blank cell in the data set.
Syntax Object.MissingDataEndResponse
Arguments None.
MissingDataMiddleResponse Property
Syntax Object.MissingDataBeginningResponse
Arguments None.
MissingDataSetAll Method
Syntax Object.MissingDataSetAll(newValue As
STControlsResponseType)
.MissingDataSetAll(STControlsResponseWarningMessage)
MultiRangeVariablesAllowed Property
Description Returns or sets whether the variables being validated are
allowed to be made up of multiple Excel ranges.
Syntax Object.MultiRangeVariablesAllowed
Arguments None.
Example VarSelector.Fields(1).Validation.MultiRangeVariablesAll
owed = FALSE
NonNumericDataResponse Property
Description Sets or returns the response when non-numeric data is
found in the variables being validated. Note: Blank data is
not treated as non-numeric data.
There are three possible responses. First, The missing
data may be ignored entirely. Second, a warning message
may be displayed to the user, warning them of the missing
data and giving them an opportunity to cancel the
operation. Finally, an error message may be displayed to
the user, and the validation fails.
Syntax Object.NonNumericDataResponse
Arguments None.
Example VarSelector.Fields(1).Validation.NonNumericDataRespons
e = STControlsResponseWarningMessage
NumericRangeMax Property
Description Sets or returns the maximum numeric data value allowed
in the variables being validated. If set to the special value
StatToolsInfinity (which is the default value) there is no
upper limit to the numeric values in the variables.
Syntax Object.NumericRangeMax
Arguments None.
Example ‘Make sure all numeric values are between 0 and 100:
With VarSelector.Fields(1).Valiadation
.NumericRangeMin = 0
.NumericRangeMax = 100
End With
NumericRangeMin Property
Description Sets or returns the minimum numeric data value
allowed in the variables being validated. If set to the
special value StatToolsMinusInfinity (which is the
default value) there is no lower limit to the numeric
values in the variables.
Syntax Object.NumericRangeMin
Arguments None.
Example ‘Make sure all numeric values are between 0 and 100:
With VarSelector.Fields(1).Valiadation
.NumericRangeMin = 0
.NumericRangeMax = 100
End With
RowVariablesAllowed Property
Description Returns or sets whether the variables being validated are
allowed to be oriented in rows.
Syntax Object.RowVariablesAllowed
Arguments None.
SelectionCountMax Property
Description Sets or returns the maximum number of variables that may
be selected in the given field being validated. If set to
zero, there is not maximum number of variables.
Syntax Object.SelectionCountMax
Arguments None.
SelectionCountMin Property
Description Sets or returns the minimum number of variables that may
be selected in the given field being validated. If set to zero,
there is not minimum number of variables.
Syntax Object.SelectionCountMin
Arguments None.
SetDefaultConfiguration Method
Description Sets the validation object to one of several preset
configurations.
Instead of setting up a validation object from scratch, setting
potentially a dozen or more properties, it is usually much more
efficient to call this method to set the STControlsValidation
object to one of the preset base configurations and then apply
a smaller number of changes to arrive at the final configuration.
Syntax Object.SetDefaultConfiguration(whichDefault As
STControlsDefaultValidationConfiguration, Optional
selectionCountMin as Integer, Optional selectionCountMax as
Integer, Optional categoryCountMin as Integer, Optional
categoryCountMax as Integer)
Arguments whichDefault (STControlsDefaultValidationConfiguration
Enumerated Constant) – one of the following constant values:
o STControlsNoValidation
o STControlsNumericVariables
o STControlsStackedCategoryVariable
o STControlsStackedValueVariable
o STControlsTextVariables
Each of these preset configurations has a default set of
validation properties as shown in the table below:
selectionCountMin (Optional Integer) – sets the
SelectionCountMin property. The default value is zero if the
argument is missing.
selectionCountMax (Optional Integer) – sets the
SelectionCountMax property. The default value is zero if the
argument is missing.
categoryCountMin (Optional Integer) – sets the
CategoryCountMin property. The default value is zero if the
argument is missing.
categoryCountMax (Optional Integer) - sets the
CategoryCountMax property. The default value is zero if the
argument is missing.
Example VarSelector.Fields(1).Validation.SetDefaultConfiguration
STControlsTextVariables
SingleDataSet Property
Description Returns or sets whether all the variables being validated
when the field must belong to the same data set object.
Syntax Object.SingleDataSet
Arguments None.
Return Value Boolean. TRUE if all variables being validation must come
from the same data set. FALSE if not.
ValidateEvenIfInvisible Property
Description Returns or sets whether the validation will occur even if the
parent STControlsField object is not visible. Normally, you
will not wish to do this.
Syntax Object.ValidateEvenIfInvisible
Arguments None.
Example VarSelector.Fields(1).Validation.ValidateEvenIfInvisible =
TRUE
STControlsVarSelector Object
ActiveDataSet Property
Description Returns or sets the data set that is currently shown in the
Data Set combo box. If that control is set to display “All
Data Sets” the object is “Nothing.”
Syntax Object.ActiveDataSet
Arguments None.
Attach Method
Description Initializes the variable selector control to work with
StatTools and the analysis specified. At this point the
number of fields (i.e. the number of columns containing
check boxes) that the control should display must be set.
This method must be called before any other methods or
properties of the STVarSelector object. Make sure to call
the Detach method when you are finished with the control.
Caption Property
Description Sets or returns the caption of the control. Use this
property to set a custom caption of arbitrary text. Use the
StdCaption property to set the caption to one of the
standard, built-in captions.
Syntax Object.Caption
Arguments None.
DataFormat Property
Description Sets or returns the current data format. The two formats
are “stacked” and “unstacked.” The related
DataFormatMode property controls which options are
allowed for this property and if the user is allowed to
change them.
Syntax Object.DataFormat
Arguments None.
DataFormatChange Event
Description Raised when the user changes the DataFormat property
via the control’s user interface. Your code is responsible
for implementing whatever changes to the control’s
interface are required when the user changes this setting.
Syntax Object_DataFormatChange(newFormat As
STControlsDataFormat)
End Sub
DataFormatMode Property
Description Sets or returns how the “Data Format” button should be
configured. It can be set to allow either one or both of the
stacked and unstacked formats, or alternatively, the entire
control can be removed if it is not relevant.
Syntax Object.DataFormatMode
Arguments None.
Detach Method
Description Informs the control that you are finished using it. This
method should be called when you are finished with the
STVarSelector control. Make sure to call the Attach
method before you use the control.
EnforceSingleSelectionPerRow Property
Syntax Object.EnforceSingleSelection
Arguments None.
Return Value Boolean. TRUE if at most one field may be selected per
variable. FALSE if any number of fields may be selected
per variable.
Fields Property
Description Returns a STControlsVarSelectorFields object containing
a collection of all the STControlsVarSelectorField objects
in the control.
Syntax Object.Fields
Arguments None.
SelectionChange Event
Description Raised when the user clicks in any field’s check box.
Syntax Object_SelectionChange()
Arguments None.
StdCaption Property
Description Sets the caption of the control to one of several standard
string values. Use the Caption property to set a custom
caption to an arbitrary text string.
Syntax Object.StdCaption
Arguments None.
Example VarSelector.StdCaption =
STControlsStdCaptionOneOrMore
Validate Method
Description Causes the control to validate all fields based on the current
settings in each field's validation object.
STControlsVarSelectorField Object
Caption Property
Description Sets the caption (the text in the header row for this field.)
Note, this caption is limited to an extremely small number
of characters. Typically only three or four characters
(depending on the exact characters being displayed) will fit
in the header. Typical captions are “Cat”, “Val”, “C1”, “C2”,
etc. It is also very common, usually when there is a single
field, to have a blank field caption.
Syntax Object.Caption
Arguments None.
EnforceSingleSelection Property
Description Returns or sets whether more than one variable may be
selected in a given field. If this property is set, and the
user clicks a checkbox in the field, the control will ensure
that all other check boxes in the same field are unchecked.
Syntax Object.EnforceSingleSelection
Arguments None.
Return Value Boolean. TRUE if the field may have only one variable
selected at a time. FALSE if more than one variable may
be selected in the field.
GetSelectionCount Method
Description Returns the number of selected variables in the field. Use
the Selection and SelectionList properties to get the items
that were selected.
Syntax Object.GetSelectionCount
Arguments None.
Example numSelectedItem =
VarSelector.Fields(1).GetSelectionCount()
Index Property
Description Returns the position of this field within the collection of
fields in the control.
Syntax Object.Index
Arguments None.
Selection Property
Description Returns or sets the field’s selection. This method is useful
to retrieve or set a field that allows only single variable to
be selected at a time. Use the SelectionList property to
return or set a list of variables.
Syntax Object.Selection
Arguments None.
SelectionList Property
Description Returns all the variables selected in the field in a new
StatToolsVariableList collection object. If you know the
selection will only ever be one variable at a time, you can
use the Selection property instead.
Syntax Object.SelectionList
Arguments None.
Validation Property
Description Returns the STControlsValidation object corresponding to
this field.
Syntax Object.Validation
Arguments None.
Visible Property
Description Returns or sets whether the field is visible or not. The
ability to toggle the visibility of fields is very useful if you
have a selector control which has two or more different
configurations depending on the other settings in your
analysis dialog. As the user makes changes to the dialog,
the appropriate fields can be shown or hidden as
appropriate.
Syntax Object.Visible
Arguments None.
Return Value Boolean. TRUE if the field is visible. FALSE if the field is
invisible.
STControlsVarSelectorFields Object
Count Property
Description Returns the number of fields in the collection. The number
of fields is set when the variable selector is first initialized
with the Attach method and can not subsequently be
changed.
Syntax Object.Count
Arguments None.
GetVariableListFromStackedPair Method
Description Returns (in the varList argument) a list of stacked
variables created from a source value variable and
category variable that the user has selected. Typically,
there will be one stacked variable in the list for each
distinct category name in the selected category variable.
The number of variables is limited, however, by the
maxNumVariables argument, and optionally by the
catNames list.
You may use the SetStackedPairFromVariableList method
to (approximate) the opposite of this routine.
See the section Data Sets, Variables, and Variable Lists
of this document for more information about stacked and
unstacked variables.
Syntax Object.GetVariableListFromStackedPair(valFieldIndex as
Integer, catFieldIndex as Integer, varList As Object,
maxNumVariables as Integer, Optional catNames)
Item Property
Description Returns a specific field, by index, from the collection of
fields. Note this is the default method for this object.
SetStackedPairFromVariableList Method
Description Given a StatToolsVariableList object filled with stacked
variables, presumably constructed from the
GetVariableListFromStackedPair method, this method sets
the selection of a pair of a pair of fields with the
appropriate value and category variable.
Syntax Object.SetStackedPairFromVariableList(valFieldIndex as
Integer, catFieldIndex as Integer, varList As Object)
Example ‘Set the stacked value and category variables that are to
be selected
VarSelector.Fields.SetStackedPairFromVaribleList 2,1,
myVarListObject
Overview
It is fairly easy to automate the built-in “core” StatTools analyses as part of
your own custom VBA code. To do this you must first attach to the core
pack’s automation library, as described below. Next, you must create a
automation object corresponding to the particular analysis you want to
automate, set the properties of that object as appropriate, and then run the
analysis by calling one or more methods of that object.
The rest of this section of this document discusses how to automate the
core analysis pack. It is possible to automate other analysis packs if they
come with an automation library. While the process will be similar to
automating the core analysis pack, you need to check with the pack’s
documentation before proceeding.
Make sure the item “Palisade StatTools Core Pack Automation Library” is
checked.
274 Overview
Overview — Creating an Automation Object
StatTools_ANOVAOneWay StatTools_Histogram
StatTools_ANOVATwoWay StatTools_HypothesisTest
StatTools_Autocorrelation StatTools_Interaction
StatTools_BoxPlot StatTools_Lags
StatTools_ChiSqIndependence StatTools_Lilliefors
StatTools_ChiSqTest StatTools_Logistic
StatTools_Combination StatTools_OneVarSummary
StatTools_ConfInterval StatTools_QQNormal
StatTools_ControlChartC StatTools_RandomSample
StatTools_ControlChartP StatTools_Regression
StatTools_ControlChartU StatTools_RunsTest
StatTools_ControlChartXR StatTools_SampleSize
StatTools_CorrAndCovar StatTools_ScatterPlot
StatTools_Diff StatTools_Stack
StatTools_Discriminant StatTools_TimeSeriesGraph
StatTools_Dummy StatTools_Transform
StatTools_Forecast StatTools_Unstack
An Example
As a concrete example of how to automate an analysis in the core
analysis pack, here is a code snippet of how to generate a one-variable
summary report:
‘Add the first two variables of the first data set to the list of variables
to analyze:
With automationObj.VariableList
.Add StatTools.DataSets(1).Variables(1)
.Add StatTools.DataSets(1).Variables(2)
End With
276 Overview
AnalysisObject Property
AnalysisObject Property
Description Returns the StatToolsAnalysis object corresponding to this
analysis automation object. Use this object to gain access to
the generic properties and methods of the StatToolsAnalysis
object.
Syntax Object.AnalysisObject
Arguments None.
Defaults Method
Description Forces the analysis to either read or write its current state
as a default, either to the global defaults or to a specific
workbook’s defaults.
Analysis defaults determine what values are shown when
an automation object is first created or an analysis dialog
is first displayed. There are two levels of these defaults.
First, the currently active workbook may have defaults for
an analysis stored within it as hidden defined names.
These values should be written whenever an analysis
dialog is dismissed with a click to the OK button. This
allows those same settings to reappear when the dialog is
next displayed for the same workbook. Second there is a
set of global defaults, stored in the system registry, which
are used when the analysis dialog is displayed in the
context of a workbook that doesn’t have any workbook
level defaults. These global defaults are written when the
user clicks the “Save as Defaults” icon in an analysis
dialog.
Note: This method is automatically called for you (in read
mode) when the automation object is first created. It is
also automatically called when you call the RunAnalysis
method.
Note: When you call this method to write defaults, it will
automatically call the Validate method with ValidationMode
set to StatToolsValidationModeWriteDefaults.
GenerateReport Method
Description Causes the analysis to generate a report based on the
current automation object properties.
Note: When you call this method, it will automatically call
the Validate method with ValidationMode set to
StatToolsValidationGenerateReport.
Note: This method is automatically called when you call
the RunAnalysis method.
Syntax Object.GenerateReport
Arguments None.
RunAnalysis Method
Description Runs the complete analysis, just as if the analysis button
had been pressed in the user interface, including getting
analysis defaults, presenting the user with the dialog, and
generating the report.
Syntax Object.RunAnalysis
Arguments None.
ShowDialog Method
Description Causes the analysis’ dialog to be displayed, using the
current settings as the dialog defaults. When the dialog’s
OK button is pressed, the current settings will change to
reflect the user’s choices.
Syntax Object.ShowDialog
Arguments None.
Validate Method
Description Validates the current automation object settings.
Syntax Object.Validate(validationMode as
StatToolsValidationMode)
StatTools_ANOVAOneWay
Property or Method Description
DefaultDataFormat Controls the default data format mode for the One-Way
(StatToolsDataFormat ANOVA dialog. NOTE: This setting does not affect the
Enumerated Constant) analysis results in anyway. Must be of the following
enumerated constants:
o StatToolsDataFormatStacked
o StatToolsDataFormatUnstacked
VariableList The list of variables to be analyzed. There must be
(StatToolsVariableList Object) between 2 and 50 variables to analyze. Either stacked or
unstacked variables may be specified.
NoCorrection (Boolean) Specifies whether confidence intervals will be generated
with using the “no-correction” method.
Bonferroni (Boolean) Specifies whether confidence intervals will be generated
with using the “Bonferroni” correction method.
Tukey (Boolean) Specifies whether confidence intervals will be generated
with using the “Tukey” correction method.
Scheffe (Boolean) Specifies whether confidence intervals will be generated
with using the “Scheffe” correction method.
ConfidenceLevel (Double) Sets the confidence level to be used in the confidence
interval calculations. A number between 0 and 1.
StatTools_ANOVATwoWay
Property or Method Description
CategoryVariable1 The first category variable to be analyzed. Must be
(StatToolsVariable Object) an unstacked variable.
CategoryVariable2 The second category variable to be analyzed. Must
(StatToolsVariable Object) be an unstacked variable.
ValueVariable The value variable to be analyzed. Must be an
(StatToolsVariable Object) unstacked variable.
NOTE: All the variables must have the same number of elements, and the pair of
category variables must form a “balanced” design. That is, the number elements
in each distinct combination of the two category variables must have the same
number of elements.
StatTools_Autocorrelation
Property or Method Description
VariableList The list of variables to be analyzed. There must be
(StatToolsVariableList Object) between 1 and 10 variables to analyze. All variables
must be unstacked.
NumLags (Integer) The number of lags. Must be between 1 and 32, or
the special value StatToolsAutoNumLags to have the
number of lags be determined automatically for you,
based on the size of your variables.
CreateChart (Boolean) determines whether an autocorrelation (or
correleogram) chart is created.
284
StatTools_BoxPlot
StatTools_BoxPlot
Property or Method Description
DefaultDataFormat controls the default data format mode for the Box-Plot
(StatToolsDataFormat) dialog. NOTE: This setting does not affect the analysis
results in anyway. Must be of the following enumerated
constants:
o StatToolsDataFormatStacked
o StatToolsDataFormatUnstacked
VariableList the list of variables to analyze. Must be between 1 and
(StatToolsVariableList) 10. Stacked or unstacked variables may be specified.
IncludeKey (Boolean) determines whether a picture is displayed under the
boxplot, which serves as a “key” to identify the different
pieces of a box-plot and what they mean.
StatTools_ChiSqIndependence
Property or Method Description
ContingencyTableRange the range of the contingency table to analyze, which may
(Excel Range Object) or may not include a header row and column.
StatTools_ChiSqTest
Property or Method Description
VariableList the list of variables to analyze. In the current release
(StatToolsVariableList Object) of StatTools, you can populate this list with only a
single variable. Future versions of StatTools may
expand this analysis to support more than a single
variable. The variables must be unstacked.
BinMinimum (Double) the minimum of the first bin. If
ExtendFirstBinToMinusInfinity is TRUE, this is the
maximum of the first bin (which has no minimum.)
BinMaximum (Double) the maximum of the last bin. If
ExtendLastBinToInfinity is TRUE, this is the minimum
of the last bin (which has no maximum.)
NumBins (Integer) the number of bins in the chi-sq test. Must be
between 3 and 50. You may also set it to the special
value StatToolsAutoNumBins.
ExtendFirstBinToMinusInfinity If TRUE, the first bin extends from the BinMinimum
(Boolean) value to negative infinity.
ExtendLastBinToInfinity if TRUE, the last bin extends from the BinMaximum
(Boolean) value to positive infinity.
286
StatTools_Combination
StatTools_Combination
Property or Method Description
VariableList the list of variables to be analyzed. There must be
(StatToolsVariableList Object) between 2 and 30 variables to combine. All variables
must be unstacked.
StatTools_ConfInterval
Property or Method Description
AnalysisType determines what sort of analysis will be
(StatToolsConfidenceIntervalA performed. Must be one of the following
nalysisType Enumerated enumerated constants:
Constant) StatToolsConfIntervalOneSample
StatToolsConfIntervalTwoSample
StatToolsConfIntervalPairedSample
288
StatTools_ControlChartC
StatTools_ControlChartC
Property or Description
Method
VariableList the list of variables to analyze. In the current release of
(StatToolsVariableList StatTools, you can populate this list with only a single variable.
Object) Future versions of StatTools may expand this analysis to
support more than a single variable. The variables must be
unstacked.
LimitGraphRange controls whether the values shown in the graph is limited to the
(Boolean) data with indices between GraphStartIndex and
GraphStopIndex.
GraphStartIndex the starting index of the data shown in the graph. This only
(Integer) takes effect if the LimitGraphRange property is TRUE.
GraphStopIndex the stopping index of the data shown in the graph. This only
(Integer) takes effect if the LimitGraphRange property is TRUE.
ControlLimitsType controls what data is used to calculate the controls limits:
(StatToolsControlChart StatToolsControlChartLimitsAll – all the source data is used to
LimitsType calculate the control limits.
Enumerated Constant)
StatToolsControlChartLimitsObservationsInRange – only the
source data in the range specified by ControlLimitsStartIndex
and ControlLimitsStopIndex is used to calculate the control
limits.
StatToolsControlChartLimitsPrevious – the control limits are
calculated based on the results of a previous analysis, with the
previous data’s average C value specified in PreviousCBar.
ControlLimitsStartIndex the starting index of the data to use to calculate the control
(Long) limits. This property only has effect when the
ControlLimitsType property is set to
StatToolsControlChartLimitsObservationsInRange.
ControlLimitsStopIndex the stopping index of the data to use to calculate the control
(Long) limits. This property only has effect when the
ControlLimitsType property is set to
StatToolsControlChartLimitsObservationsInRange.
290
StatTools_ControlChartP
StatTools_ControlChartP
Property or Description
Method
InputDataType controls what type of P-analysis is being performed. Must
(StatToolsPChartDataTy be one of the following enumerated constant values:
pe Enumerated o StatToolsPChartNumberDefects – in this mode, each data
Constant) point in the variable to analyze contains the number of
defects in a batch of items.
o StatToolsPChartFractionofDefects – in this mode, each
each data point is the fraction of defective items in the
sample
VariableList the list of variables to analyze. In the current release of
(StatToolsVariableList StatTools, you can populate this list with only a single
Object) variable. Future versions of StatTools may expand this
analysis to support more than a single variable. The
variables must be unstacked.
UseCommonSampleSiz If the number of items in each batch is fixed, set this
e (Boolean) property to TRUE and then specify the batch size in the
CommonSampleSize property. If the number of items in
each batch is dynamic (that is, it has a potentially different
value for each sample taken) set this property to FALSE
and specify the batch size in the SizeVariable.
CommonSampleSize If the number of items in each batch is fixed, set that
(Long) common size here. The UseCommonSampleSize property
must be TRUE for this property to take effect.
SizeVariable If the number of items in each batch changes with each
(StatToolsVariable sampled value, set this property to a variable containing the
Object) batch sizes. The UseCommonSampleSize property must
be FALSE for this property to take effect.
LimitGraphRange controls whether the values shown in the graph is limited to
(Boolean) the data with indices between GraphStartIndex and
GraphStopIndex.
GraphStartIndex the starting index of the data shown in the graph. This only
(Integer) takes effect if the LimitGraphRange property is TRUE.
GraphStopIndex the stopping index of the data shown in the graph. This only
(Integer) takes effect if the LimitGraphRange property is TRUE.
292
StatTools_ControlChartU
StatTools_ControlChartU
Property or Method Description
InputDataType controls what type of U-analysis is being performed. Must be
(StatToolsUChartDataType one of the following enumerated constant values:
Enumerated Constant) o StatToolsPChartNumberDefects – in this mode, each data
point in the variable to analyze contains the number of
defects in a batch of items.
o StatToolsPChartRateofDefects – in this mode, each data
point is the number of defect per unit time.
294
StatTools_ControlChartXR
StatTools_ControlChartXR
Property or Method Description
ControlChartType controls which charts are created. Must be on of the
(StatToolsXRControlChartTy following enumerated constant values:
pe Enumerated Constant) o StatToolsControlChartTypeXR – create both an X
and an R chart.
o StatToolsControlChartTypeX – create an X chart
only.
o StatToolsControlChartTypeR – create an R chart
only.
LimitGraphRange (Boolean) controls whether the values shown in the graph is limited to
the data with indices between GraphStartIndex and
GraphStopIndex.
GraphStartIndex (Integer) the starting index of the data shown in the graph. This only
takes effect if the LimitGraphRange property is TRUE.
GraphStopIndex (Integer) the stopping index of the data shown in the graph. This only
takes effect if the LimitGraphRange property is TRUE.
ControlLimitsType controls what data is used to calculate the controls limits:
(StatToolsControlChartLimits StatToolsControlChartLimitsAll – all the source data is used
Type Enumerated Constant) to calculate the control limits.
StatToolsControlChartLimitsObservationsInRange – only the
source data in the range specified by
ControlLimitsStartIndex and ControlLimitsStopIndex is used
to calculate the control limits.
StatToolsControlChartLimitsPrevious – the control limits are
calculated based on the results of a previous analysis, with
the previous data’s average X-bar value specified in
PreviousXBarBar, the previous average R-value in
PreviousRBar and the sample size in PreviousSampleSize.
ControlLimitsStartIndex the starting index of the data to use to calculate the control
(Long) limits. This property only has effect when the
ControlLimitsType property is set to
StatToolsControlChartLimitsObservationsInRange.
296
StatTools_CorrAndCovar
StatTools_CorrAndCovar
Property or Method Description
VariableList (StatToolsVariableList the list of variables to be analyzed. There must be
Object) between 1 and 250 variables to analyze. All variables
must be unstacked.
CorrelationTable (Boolean) controls if a correlation table is created.
CovarianceTable (Boolean) controls if a covariance table is created.
TableStructure controls how the correlation and covariance tables
(StatToolsTableStructure are filled in. Since these tables are both always
Enumerated Constant) symmetric around the diagonal, in some cases you
might want to fill in only half the table. Must be one of
the following enumerated constant values:
StatToolsTableStructureSymmetric - fill in all table
elements.
StatToolsTableStructureAboveDiagonal- fill in only
the upper half of the table.
StatToolsTableStructureBelowDiagonal - fill in only
the lower half of the table.
StatTools_Diff
Property or Method Description
Variable (StatToolsVariable Object) the variable to calculate the differences of. Must
be unstacked.
StatTools_Discriminant
Property or Method Description
DependentVariable (StatToolsVariable) the dependent variable to analyze.
298
StatTools_Dummy
StatTools_Dummy
Property or Method Description
Variable (StatToolsVariable) the variable to create dummy variables from. Must be an
unstacked variable, which typically will contain a small
number of text “category” values, such as “Male” and
“Female.”
DummyType the type of dummy variable to construct. Must be one of
(StatToolsDummyType the following enumerated values:
Enumerated Constant) o StatToolsDummyCategories – creates one
dummy variable for each unique category in the
source variable. Each of these dummy variables
will have a “1” where the source variable has that
particular category, and a “0” otherwise.
o StatToolsDummyNumericCondition – creates a
single dummy variable by comparing the source
variable to a value using the given
ConditionOperator and ConditionValue
properties.
StatTools_Forecast
Property or Method Description
Variable (StatToolsVariable the variable to run the forecast analysis on.
Object)
NumberOfForecasts (Integer) the number of forecast values to project into the future.
NumberOfHoldOuts (Integer) the number of values to reserve in the hold-out region.
Hold-out values are not used in the forecast, but are used to
validate the forecast model.
OptimizeParameters (Boolean) controls whether the forecasting parameters (Span, Level,
Trend, and Seasonality) should be set to their optimal
values by the forecast analysis, or left at fixed values you
specify.
ForecastMethod controls the forecasting method to be used. Must be on of
(StatToolsForecastMethod the following enumerated constant values:
Enumerated Constant) StatToolsForecastMethodMovingAverage
StatToolsForecastMethodExponentialSimple
StatToolsForecastMethodExponentialHolts
StatToolsForecastMethodExponentialWinters
300
StatTools_Forecast
SeasonalPeriod controls the seasonal period of the analysis. This not only
(StatToolsSeasonalPeriod controls the deasonalizing process, but also controls how
Enumerated Constant) the graphs will be labeled if the UseSeasonLabels property
is TRUE. Must be one of the following enumerated constant
values:
o StatToolsAnnual
o StatToolsQuarterly
o StatToolsMonthly
o StatToolsWeekly
o StatToolsDaily
o StatToolsNone
302
StatTools_Histogram
StatTools_Histogram
StatTools_HypothesisTest
Property or Method Description
AnalysisType determines what sort of analysis will be performed.
(StatToolsHypothesisTestAnalysisT Must be one of the following enumerated constants:
ype Enumerated Constant) StatToolsHypothesisTestOneSample
StatToolsHypothesisTestTwoSample
StatToolsHypothesisTestPairedSample
PerformMeanTest (Boolean) controls whether a hypothesis test for the mean will
be performed.
MeanNullValue (Double) the null value for the mean hypothesis test.
304
StatTools_HypothesisTest
PerformStdDevTest (Boolean) controls whether a hypothesis test for the standard
deviation will be performed. Only available if
AnalysisType is set to
StatToolsHypothesisOneSample.
StdDevNullValue (Double) the null value for the standard deviation test.
StatTools_Interaction
Property or Method Description
InteractionType controls what type of interaction variable or variables to
(StatToolsInteractionType create. Must be on of the following enumerated constant
Enumerated Constant) values:
o StatToolsInteractionTypeValues - combines two
numeric variables (both in the ValueVariableList) to
create a new variable which is the product of the
two variables.
o StatToolsInteractionTypeValueAndCategory -
combines a single value variable (in the
ValueVariableList) with a single category variable
(in the CategoryVariableList) to create a new
variable for each distinct category. The variable for
each category contains the product of the original
value variable with a dummy (0,1) variable based
on the source category variable and the particular
category in question.
o StatToolsInteractionTypeCategories - combines
two categorical variables (both in
CategoryVariableList) to create a set of dummy
(0,1) variables representing all possible
combinations of categories.
ValueVariableList the value variables to use in the utility. Should contain two
(StatToolsVariableList value variables if InteractionType is
Object) StatToolsInteractionTypeValues, one variable if
InteractionType is
StatToolsInteractionTypeValueAndCategory, and should be
empty if InteractionType is
StatToolsInteractionTypeCategories.
306
StatTools_Lags
StatTools_Lags
Property or Method Description
Variable (StatToolsVariable the variable object to generate lagged variables from.
Object)
StatTools_Lilliefors
Property or Method Description
DefaultDataFormat controls the default data format mode for the Lilliefors
(StatToolsDataFormat dialog. NOTE: This setting does not affect the
Enumerated Constant) analysis results in anyway. Must be of the following
enumerated constants:
o StatToolsDataFormatStacked
o StatToolsDataFormatUnstacked
StatTools_Logistic
Property or Method Description
LogisticRegressionType The type of logistic regression to perform. Must be one of
(StatToolsLogisticRegression the following enumerated constant values:
Type Enumerated Constant) StatToolsLogisticRegressionStandard - in this case, the
DependentVariable is a (0,1) response variable that
specifies whether each observation is a “success” or a
“failure.” The CountVariable is not used.
StatToolsLogisticRegressionSummary - in this case, the
DependentVariable is the number of “successes” in each
sample, while the CountVariable contains the size of each
sample.
308
StatTools_MannWhitneyTest
StatTools_MannWhitneyTest
Property or Method Description
DefaultDataFormat Controls the default data format mode for the analysis.
(StatToolsDataFormat NOTE: This setting does not affect the analysis results in
Enumerated Constant) any way. Must be one of the following enumerated
constants:
• StatToolsDataFormatStacked
• StatToolsDataFormatUnstacked
AnalysisType Determines the type of analysis to be performed. Must be
(StatToolsMannWhitneyAnalysi one of the following constant values:
sType Enumerated Constant) • StatToolsMannWhitneyAnalysisTypeGeneral
• StatToolsMannWhitneyAnalysisTypeMedian
VariableList The list of variables to analyze. There must be exactly two
(StatToolsVariableList Object) variable in this analysis.
AlternativeType Specifies the type of alternative hypothesis for the test.
(StatToolsMannWhitneyAlterna Must be one of the following constants:
tiveType Enumerated • StatToolsMannWhitneyAlternativeTypeEitherSma
Constant) ller – a two-tailed alternative
• StatToolsMannWhitneyAlternativeTypeFirstSmall
er - a one-tailed alterative with the first variable
in the VariableList smaller than the second.
• StatToolsMannWhitneyAlternativeTypeSecondS
maller – a one-tailed alternative with the second
variable in the VariableList smaller than the first
CorrectForTies (Boolean) Controls whether the analysis will automatically correct for
ties.
StatTools_OneVarSummary
Property or Method Description
DefaultDataFormat controls the default data format mode for the dialog.
(StatToolsDataFormat NOTE: This setting does not affect the analysis results in
Enumerated Constant) anyway. Must be of the following enumerated constants:
o StatToolsDataFormatStacked
o StatToolsDataFormatUnstacked
VariableList the list of variables to be analyzed. There must be
(StatToolsVariableList Object) between 1 and 100 variables to analyze. Either stacked or
unstacked variables may be specified.
ValueVariable When DataType is set to
(StatToolsVariable Object) StatToolsParetoChartDataTypeCategoryAndValue,
ValueVariable will contain the frequency (number of
occurrences) of each corresponding CategoryVariable
entry.
310
StatTools_ParetoChart
StatTools_ParetoChart
Property or Method Description
DataType Controls whether one or two variables will be used in
(StatToolsParetoChartDataTy constructing the Pareto chart. Must be one of the
pe Enumerated Constant) following enumerated constants:
StatToolsParetoChartDataTypeCategoryOnly – in this
case, CategoryVariable will contain individual
readings/reasons. For example, each entry might
correspond to the reason a batch of parts was rejected.
ValueVariable is not used.
StatToolsParetoChartDataTypeCategoryAndValue -- in
this case, CategoryVariable will contain unique categories,
and ValueVariable will contain the corresponding
frequencies (counts).
FixedCategoryValue (Double) Specifies the height of a “Misc” bar added to the extreme
right side of the Pareto chart. Only used when
OptionalCategoryType is set to
StatToolsParetoChartOptionalCategoryTypeFixedValue.
312
StatTools_SignTest
StatTools_SignTest
Property or Method Description
DefaultDataFormat Controls the default data format mode for the analysis.
(StatToolsDataFormat NOTE: This setting does not affect the analysis results in
Enumerated Constant) any way. Must be one of the following enumerated
constants:
• StatToolsDataFormatStacked
• StatToolsDataFormatUnstacked
AnalysisType Determines the type of analysis to be performed. Must be
(StatToolsSignTestAnalysisTyp one of the following constant values:
e Enumerated Constant) • StatToolsSignTestAnalysisTypeOneSample
• StatToolsSignTestAnalysisTypePairedSample
VariableList The list of variables to analyze. For one-sample analyses,
(StatToolsVariableList Object) this may be one or more variables. For paired-sample
analyses, the list must contain exactly two variables.
MedianNullValue (Double) The null-value of the median used in the hypothesis test.
MedianAlternativeType Specifies the type of alternative hypothesis for the test.
(StatToolsSignTestAlternativeT Must be one of the following constants:
ype Enumerated Constant) • StatToolsSignTestAlternativeNotEqual – a two-
tailed alternative
• StatToolsSignTestAlternativeLessThan – a one-
tailed alternative with the alternative less than the
null-value.
• StatToolsSignTestAlternativeGreaterThan – a
one-tailed alternative with the alternative greater
than the null-value.
StatTools_QQNormal
Property or Method Description
VariableList the list of variables to analyze. In the current release
(StatToolsVariableList Object) of StatTools, you can populate this list with only a
single variable. Future versions of StatTools may
expand this analysis to support more than a single
variable. The variables must be unstacked.
314
StatTools_RandomSample
StatTools_RandomSample
Property or Method Description
VariableList (StatToolsVariableList the list of variables to be analyzed. There must
Object) be between 1 and 32 variables to analyze. The
variables must be unstacked.
StatTools_Regression
Property or Method Description
RegressionType controls the type of regression to be performed. Must
(StatToolsRegressionType be one of the following enumerated constant values:
Enumerated Constant) StatToolsRegressionMultiple
StatToolsRegressionStepwise
StatToolsRegressionForward
StatToolsRegressionBackward
StatToolsRegressionBlock
316
StatTools_Regression
EnterExitMode controls what parameters are used to determine
(StatToolsRegressionEnter whether a variable (or a block of variables.) This
ExitMode Enumerated property has no effect if RegressionType is set to
Constant) StatToolsRegressionMultiple. Must be one of the
following enumerated constant values:
o StatToolsRegressionUsePValues with the p-
values controlled by the PValueToEnter and
PValueToLeave properties
o StatToolsRegressionUseFValues with the F-
values controlled by the FValueToEnter and
FValueToLeave properties.
318
StatTools_RunsTest
StatTools_RunsTest
Property or Method Description
VariableList the list of variables to be analyzed. There must be
(StatToolsVariableList Object) between 1 and 100 variables to analyze. The
variables must be unstacked.
CutoffType controls what type of cutoff value to use for the runs
(StatToolsRunsTestCutoffType test. Must be one of the following enumerated
Enumerated Constant) constant values:
o StatToolsRunsTestCutoffMean - uses the
mean of each variable as the cutoff.
o StatToolsRunsTestCutoffMedian - uses the
median of each variable as the cutoff.
o StatToolsRunsTestCutoffCustom - uses the
value specified in CustomCutoffValue as the
cutoff.
CustomCutoffValue (Double) specified a cutoff value to use for the runs test. This
value only has effect if the CutoffType property is set
to StatToolsRunTestCutoffCustom.
StatTools_SampleSize
Property or Method Description
ParameterType controls what type of sample size is to be determined.
(StatToolsSampleSizeParameter Must be one of the following enumerated constant
Type Enumerated Constant) values:
StatToolsSampleSizeMean
StatToolsSampleSizeProportion
StatToolsSampleSizeDifferenceOfMeans
StatToolsSampleSizeDifferenceOfProportions
320
StatTools_ScatterPlot
StatTools_ScatterPlot
Property or Method Description
XVariableList (StatToolsVariableList a list of variables to be used for the x-values of the
Object) scatter graphs. There must be between 1 and 10
unstacked variables. Note: There will be one graph
generated for every unique combination of values in the
XVariableList and YVariableList.
StatTools_Stack
Property or Method Description
VariableList a list of variables to stack. There must be between 2 and 100
(StatToolsVariableList unstacked variables specified. The total number of items in
Object) the final stacked variable can not exceed 65535 cells.
CategoryVariableName the name to use for the resulting stacked category variable.
(String)
ValueVariableName the name to use for the resulting stacked value variable.
(String)
322
StatTools_TimeSeriesGraph
StatTools_TimeSeriesGraph
Property or Method Description
DefaultUseLabelVariable controls whether the Time Series Graph Dialog defaults to
(Boolean) asking the user to specify a LabelVariable. NOTE: This
setting does not affect the analysis results in anyway.
StatTools_Transform
Property or Method Description
VariableList the list of variables to transform. Must be between 1 and
(StatToolsVariableList 100 unstacked variables.
Object)
Shift (Double) a shift applied to the source data before the transformation
function is applied. This property has no effect when the
TransformationType property is set to
StatToolsTransformationCustom.
324
StatTools_Unstack
StatTools_Unstack
Property or Method Description
ValueVariableList the value variable from which a group of unstacked
(StatToolsVariableList Object) variables will be created. Keep in mind, while the value
and category variables specified in this property and the
CategoryVariable property, when grouped together form
a stacking pair (that is, together they can make a whole
group of stacked variables) the value variable specified
here itself is an unstacked variable.
StatTools_WilcoxonRankTest
Property or Method Description
DefaultDataFormat Controls the default data format mode for the analysis.
(StatToolsDataFormat NOTE: This setting does not affect the analysis results in
Enumerated Constant) any way. Must be one of the following enumerated
constants:
• StatToolsDataFormatStacked
• StatToolsDataFormatUnstacked
AnalysisType Determines the type of analysis to be performed. Must be
(StatToolsWilcoxonAlternativeT one of the following constant values:
ype Enumerated Constant) • StatToolsWilcoxonAnalysisTypeOneSample
• StatToolsWilcoxonAnalysisTypePairedSample
VariableList The list of variables to analyze. For one-sample analyses,
(StatToolsVariableList Object) this may be one or more variables. For paired-sample
analyses, the list must contain exactly two variables.
MedianNullValue (Double) The null-value of the median used in the hypothesis test.
MedianAlternativeType Specifies the type of alternative hypothesis for the test.
(StatToolsWilcoxonAlternativeT Must be one of the following constants:
ype Enumerated Constant) • StatToolsWilcoxonAlternativeNotEqual – a two-
tailed alternative
• StatToolsWilcoxonAlternativeLessThan – a one-
tailed alternative with the alternative less than the
null-value.
• StatToolsWilcoxonAlternativeGreaterThan – a
one-tailed alternative with the alternative greater
than the null-value.
CorrectForTies (Boolean) Controls whether the analysis will automatically correct for
ties.
326