The routine may be called by the names g11bcf or nagf_contab_tabulate_margin.
For a dataset containing classification variables (known as factors) the routines g11bafandg11bbf compute a table using selected statistics, for example the mean or the median. The table is indexed by the levels of the selected factors, for example if there were three factors A, B and C with , and levels respectively and the mean was to be tabulated the resulting table would be with each cell being the mean of all observations with the appropriate combination of levels of the three factors. In further analysis the table of means averaged over C for A and B may be required; this can be computed from the full table by taking the mean over the third dimension of the table, C.
In general, given a table computed by g11baforg11bbf, g11bcf computes a sub-table defined by a subset of the factors used to define the table such that each cell of the sub-table is the selected statistic computed over the remaining factors. The statistics that can be used are the total, the mean, the median, the variance, the smallest and the largest value.
John J A and Quenouille M H (1977) Experiments: Design and Analysis Griffin
Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin
West D H D (1979) Updating mean and variance estimates: An improved method Comm. ACM22 532–555
1: – Character(1)Input
On entry: indicates which statistic is to be used to compute the marginal table.
On entry: the number of levels for each dimension of table as returned by g11baforg11bbf.
, for .
6: – Integer arrayInput
On entry: indicates which dimensions of table are to be included in the sub-table. If the dimension or factor indicated by is to be included in the sub-table, otherwise it is excluded.
7: – Real (Kind=nag_wp) arrayOutput
On exit: the first mcells elements contain the sub-table computed using the statistic indicated by stat. The table is stored in a similar way to table with the mcells cells stored so that for any two dimensions the index relating to the dimension given later in idim changes faster. For further details see Section 9.
8: – IntegerInput
On entry: the maximum size of sub-table to be computed.
the product of the levels of the dimensions of table included in the sub-table, stable.
9: – IntegerOutput
On exit: the number of cells in the sub-table in stable.
10: – IntegerOutput
On exit: the number of dimensions to the sub-table in stable.
11: – Integer arrayOutput
On exit: the first mdim elements contain the number of levels for the dimensions of the sub-table in stable. The remaining elements are not referenced.
12: – Real (Kind=nag_wp) arrayOutput
Note: the dimension of the array auxt
must be at least
if , and at least otherwise.
On exit: if auxt contains the sub-table of means corresponding to the sub-table of variances in stable. Otherwise auxt is not referenced.
13: – Integer arrayWorkspace
14: – Real (Kind=nag_wp) arrayWorkspace
15: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, .
Constraint: , , , , or .
On entry, all elements of .
On entry, and .
On entry, and minimum value for .
Constraint: of the levels of the dimensions of the table included in the sub-table, stable.
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
Only applicable when . In this case a one pass algorithm is used as describe in West (1979).
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g11bcf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
The sub-tables created by g11bcf and stored in stable and, depending on stat, also in auxt are stored in the following way. Let there be dimensions defining the table with dimension having levels, then the cell defined by the levels of the factors is stored in th cell given by
The data, given by John and Quenouille (1977), is for blocks of a factorial experiment. The data can be considered as a table (i.e., blocks treatment with levels treatment with levels). This table is input and the table of treatment means for over blocks is computed and printed.