Page Contents

Include JavaScript file: MathymaStats.js.

dataBlockObject = new mathyma.stats.DataBlock( filename )

- (mathyma.stats.DataBlock) dataBlockObject
- the new instance of a mathyma.stats.DataBlock object created.
- (string) filename
- the name of the XML file containing the data.

This method defines variables in the data to be included in the DataBlock.

Include JavaScript file: MathymaStats.js.

dataBlockObject.AddVariables ( variable_definitions )

- (string) variable_definitions
- Defines the variables required in the data. The string can consist of many variable definitions, each separated by a semi-colon (;). The syntaxt of each definition is:
- XML-tag;
- variable = XML-tag;
- variable = function(XML-tags);

- XML-tag is a tag name in the XML input data. The variable name will be the same as the tag name.
- variable is the name of the variable being defined.
- function(XML-tags) is any function defined in JavaScript syntaxt including any arithmetic operators and Math methods, where the variables are XML tag names.

- WT;
- height=HGT;
- bodyIndex = Math.pow(HGT,2)/WT;

This method defines factors in the data to be included in the DataBlock.

Include JavaScript file: MathymaStats.js.

dataBlockObject.AddFactors ( factor_definitions )

- (string) factor_definitions
- Defines the factors required in the data. The string can consist of many factor definitions, each separated by a semi-colon (;). The syntaxt of each definition is:
- XML-tag;
- factor = XML-tag;
- XML-tag * XML-tag [ * XML-tag [ ... ] ];
- factor = XML-tag * XML-tag [ * XML-tag [ ... ] ];
- factor = XML-tag : value-chain ;

- XML-tag is a tag name in the XML input data.
- factor is the name of the factor, if this is not specified the factor name will be the same as the tag name.
- value-chain is a chain of the form levelName1 , boundary1 , levelName2 ... which defines the levels (categories) into which the data is split, according to the rule:

levelName1 if value < boundary1

levelName2 if boundary1 ≤ value < boundary2

. . .

levelNameN if boundaryN-1 ≤ value

- SEX;
- gender=SEX;
- sex*ageGroup=SEX*AGRP;
- heightCat=HEIGHT:short,160,tall;

Defines which XML tag serves as a count or frequency.

Include JavaScript file: MathymaStats.js.

dataBlockObject.DefineCount ( Count_tag )

- (string) Count_tag
- the name of the XML-tag whose content is the count or frequency of the current observation.

Provides a button on the page which, on clicking, dispalys the input XML file in a separate window.

Include JavaScript file: MathymaStats.js.

dataBlockObject.ViewXML ( )

Produces a contingency table (pivot table) for one or two factors.

Include JavaScript file: MathymaStats.js.

dataBlockObject.Tabulate ( factors , independence_test )

- (string) factors
- Defines which factors are to be tabulated. The definition has the syntaxt:
- factor1 [ : factor2 ]

- factor1 level counts in the columns of the table.
- factor2 level counts in the rows of the table.

- (boolean) independence_test
- For two-factor tables, if this is set to 'true', the expected counts, given the row and column totals are displayed, and the chi-squared statistic and significance probability calculated.

Produces a summary of totals, mean, standard deviation and quartiles for a variable. The summary is by level for all factors.

Include JavaScript files: MathymaStats.js .

dataBlockObject.Summary ( variable )

- (string) variable
- Defines which variable is to be summarized.

Produces a scatter plot (for two variables) or box-plots for one variable. A plot for each level of a factor can be produced.

Include JavaScript files: MathymaStats.js and MathymaGraph.js.

dataBlockObject.Plot ( plot_definition , fit_regression_line )

- (string) plot_definition
- Defines what is to be plotted. The definition has the syntaxt:
- variable1 [ : variable2 ] [ / factor ]

- variable1 is the "dependent" variable (y-axis).
- variable2 is the "explanatory" variable (x-axis).
- factor if this is specified, a separate plot (or box-plot) will be drawn for each level of the factor.

- (boolean) fit_regression_line
- if 'true' draws the best-fit regression line (scatter charts) or the mean level (box-plots).

Draws the empiric cumulative distribution function for the data. A plot for each level of a factor can be produced on the same graph.

Include JavaScript files: MathymaStats.js and MathymaGraph.js.

dataBlockObject.CDF ( plot_definition )

- (string) plot_definition
- Defines what is to be plotted. The definition has the syntaxt:
- variable [ / factor ]

- variable is the variable for which the plot is to be drawn.
- factor if this is specified, a separate plot (or box-plot) will be drawn for each level of the factor.

Draws a box-plot (displaying quartiles) for the data. A plot for each level of a factor can be produced on the same graph.

Include JavaScript files: MathymaStats.js and MathymaGraph.js.

dataBlockObject.BoxPlot ( plot_definition )

- (string) plot_definition
- Defines what is to be plotted. This has the same syntaxt as the plot definition for CDF.

Draws a Histogram for the data. A plot for each level of a factor can be produced on separate graph.

Include JavaScript files: MathymaStats.js and MathymaGraph.js.

dataBlockObject.Histogram ( plot_definition [, interval [, fixed_point ]])

- (string) plot_definition
- Defines what is to be plotted. This has the same syntaxt as the plot definition for CDF.
- (number) interval
- The width of the columns of the histogram (in the units the variable has been measured). [Default: 10% of total range].
- (number) fixed_point
- A fixed point somewhere in the range of the variable which will be the boundary between two columns of the histogram, thus fixing the position of the columns. [Default: the minimum value of the variable].

Draws a Normal Plot (the cumulative distribution of the data drawn on a normal scale) for the data. A plot for each level of a factor can be produced on separate graph.

Include JavaScript files: MathymaStats.js and MathymaGraph.js.

dataBlockObject.NormalPlot ( plot_definition )

- (string) plot_definition
- Defines what is to be plotted. This has the same syntaxt as the plot definition for CDF.

Creates and returns a new mathyma.stats.Model object based on the input parameters. The object can subsequently be used with mathyma.stats.Model methods described below.

Include JavaScript file: MathymaStats.js and MathymaLinMod.js.

modelObject = dataBlockObject.Model ( model_definition )

- (mathyma.stats.Model) modelObject
- the new instance of a mathyma.stats.Model object created.

- (string) model_definition
- A formatted textual description of the model to be built. This has two basic forms:
- For a linear regression model:

- variable1 = [ _c ] [ + variable2 [ + variable3 [ ... ] ] ] [ / factor ]

- variable1 is the response variable.
- _c (underscore c) the constant term. Omitting this means that the theoretical regression line passes through the origin (i.e. null intercept)
- variable2 [ + variable3 [ ... ] ] are the explanatory variables
- factor if this is specified, an analysis will be done for each level of the factor.

- For an analysis of variance (factorial) model:

- variable1=factor1+factor2 ...

- variable1 is the response variable.
- factor1+factor2 ...are the factors (categorical variables) to be included in the model.

- For a linear regression model:

Prints out a table of the sum of squares, degrees of freedom, and mean squares for each factor defined in the dataBlock, their residuals and totals, for the given variable.

This is useful in the analysis of a factorial model, as it gives the components of the sum of squares etc. of the model, i.e. the model sum of squares will be the sum of the factor sum of squares for each factor in the model (ditto degrees of freedom).

Include JavaScript files: MathymaStats.js, MathymaLinMod.js, MathymaMatrix.js and MathymaDistr.js.

dataBlockObject.ModelReduction ( Model1 , Model2 )

- (mathyma.stats.Model) Model1
- the mathyma.stats.Model object representing the full model.
- (mathyma.stats.Model) Model2
- the mathyma.stats.Model object representing the reduced model.

A mathyma.stats.Model object is always constructed on a mathyma.stats.DataBlock object, see mathyma.stats.DataBlock.Model.

For both a linear regression model and an analysis of variance (factorial) model:

Prints out the ANOVA table for the model, showing the sums of squares, degrees of freedom, mean square for the model, residuals and total, together with the ratio (F-statistic) for the model and the probability, under the hypothesis of no model effect (i.e. all null gradients), of a higher (i.e. "worse") F-statistic

In addition, for a linear regression model only:

Prints a table of the estimates of the gradients for each explanatory variable, together with the t-statistic and the probability of a worse t-statistic under the hypothesis of a null gradient for this variable, and an estimate of the intercept.

Include JavaScript files: MathymaStats.js, MathymaLinMod.js, MathymaMatrix.js and MathymaDistr.js.

modelObject.Display ( )

Prints out a table of the correlation between the explanatory variables in a regression model.

Note: Use this on the model with the greatest number of explanatory variables as the figures will be the same on any sub-model.

Include JavaScript files: MathymaStats.js and MathymaGraph.js.

modelObject.CorrelMatrix ( )