nag_tabulate_margin (g11bcc) computes a marginal table from a table computed by
nag_tabulate_stats (g11bac) or
nag_tabulate_percentile (g11bbc) using a selected statistic.
For a dataset containing classification variables (known as factors) the functions
nag_tabulate_stats (g11bac) and
nag_tabulate_percentile (g11bbc) 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
nag_tabulate_stats (g11bac) or
nag_tabulate_percentile (g11bbc),
nag_tabulate_margin (g11bcc) 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.
Only applicable when
. In this case a one pass algorithm is used as describe in
West (1979).
Please consult the
x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The sub-tables created by
nag_tabulate_margin (g11bcc) and stored in
sub_table and, depending on
stat, also in
comm_ar 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
where
The data, given by
John and Quenouille (1977), is for 3 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.