NAG FL Interface
g02jgf (lmm_​init_​combine)

1 Purpose

g02jgf combines output from multiple calls to g02jff or g02jcf.

2 Specification

Fortran Interface
Subroutine g02jgf ( hlmm, xrcomm, xlrcomm, xicomm, xlicomm, yrcomm, yicomm, ifail)
Integer, Intent (In) :: xlrcomm, xlicomm, yicomm(*)
Integer, Intent (Inout) :: xicomm(xlicomm), ifail
Real (Kind=nag_wp), Intent (In) :: yrcomm(*)
Real (Kind=nag_wp), Intent (Inout) :: xrcomm(xlrcomm)
Type (c_ptr), Intent (In) :: hlmm
C Header Interface
#include <nag.h>
void  g02jgf_ (void **hlmm, double xrcomm[], const Integer *xlrcomm, Integer xicomm[], const Integer *xlicomm, const double yrcomm[], const Integer yicomm[], Integer *ifail)
The routine may be called by the names g02jgf or nagf_correg_lmm_init_combine.

3 Description

Let Dx and Dy denote two sets of data, each with m variables and nx and ny observations respectively. Let Cx and Cy denote two sets of communication arrays constructed by g02jff or g02jcf from datasets Dx and Dy respectively. Then, given Cx and Cy, g02jgf constructs a set of communication arrays, Cw, as if a dataset Dz, with m variables and nx+ny observations were supplied to g02jff or g02jcf, with Dz constructed as
Dz = Dx Dy .  
Splitting, and then recombining, the data in this manner allows for datasets with an arbitrarily large number of observations (n) to be analysed and the preprocessing routines, g02jff or g02jcf, to be run in parallel.
It should be noted that, while the information in Cz, should be consistent with the information in the communication arrays obtained by supplying Dz to g02jff or g02jcf, the ordering of that information may change. In practice, this means that whilst an analysis run using a set of communication arrays constructed using g02jgf should give similar results to an analysis run using a set of communication arrays constructed directly from g02jff or g02jcf they will not necessarily be identical. In addition, the order of the parameter estimates, ν and β may differ.

4 References

None.

5 Arguments

1: hlmm Type (c_ptr) Input
On entry: if the two sets of communication arrays were generated using g02jff, then a G22 handle as generated by one of the calls to g02jff.
If the two sets of communication arrays were generated using g02jcf, then this argument is not referenced and need not be set.
2: xrcommxlrcomm Real (Kind=nag_wp) array Communication Array
On entry: communication array as returned by g02jff or g02jcf for the dataset, Dx.
On exit: communication array for the combined dataset, DW.
3: xlrcomm Integer Input
On entry: the dimension of the array xrcomm as declared in the (sub)program from which g02jgf is called. Ideally this should be large enough to hold the information for the combined dataset Dw.
If xlicomm or xlrcomm are not large enough to hold the information for the combined dataset then ifail=52 is returned and the minimum size for xicomm is returned in xicomm1 and the minimum size for xrcomm in xicomm2. In this case xicomm and xrcomm must be reallocated to these new sizes, preserving their contents, for example by allocating two new arrays and copying the old values across, and the routine called again.
4: xicommxlicomm Integer array Communication Array
On entry: communication array as returned by g02jff or g02jcf for the dataset, Dx.
On exit: communication array for the combined dataset, Dz.
5: xlicomm Integer Input
On entry: the dimension of the array xicomm as declared in the (sub)program from which g02jgf is called. Ideally this should be large enough to hold the information for the combined dataset Dw.
If xlicomm or xlrcomm are not large enough to hold the information for the combined dataset then ifail=52 is returned and the minimum size for xicomm is returned in xicomm1 and the minimum size for xrcomm in xicomm2. In this case xicomm and xrcomm must be reallocated to these new sizes, preserving their contents, for example by allocating two new arrays and copying the old values across, and the routine called again.
6: yrcomm* Real (Kind=nag_wp) array Communication Array
On entry: communication array as returned by g02jff or g02jcf for the dataset, Dy.
7: yicomm* Integer array Communication Array
On entry: communication array as returned by g02jff or g02jcf for the dataset, Dy.
8: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=11
hlmm has not been initialized or is corrupt.
ifail=12
hlmm is not a G22 handle as generated by g02jff.
ifail=31
On entry, xlrcomm=value and k=value.
Constraint: xlrcomm is not compatible with information stored in xicomm, was expecting xlrcommk.
ifail=41
On entry, xicomm has not been initialized correctly.
ifail=42
On entry, the information stored in xicomm and yicomm is not compatible.
Check that the same model was used when generating xicomm and yicomm.
ifail=51
On entry, xlicomm=value and k=value.
Constraint: xlicomm is not compatible with information stored in xicomm, was expecting xlicommk.
ifail=52
On entry, xlicomm=value and xlrcomm=value
Constraint: xlicommvalue and xlrcommvalue.
The communication arrays must be large enough to hold the information for the combined dataset Dw. The minimum size for xicomm is returned in xicomm1 and the minimum size for xrcomm in xicomm2. The parameters xicomm and xrcomm must be reallocated to these new sizes, preserving their contents, and the routine called again.
ifail=53
On entry, xlicomm=value and xlrcomm=value
Constraint: xlicommvalue and xlrcommvalue.
The communication arrays must be large enough to hold the information for the combined dataset Dw. In addition, xlicomm<2 and so the minimum sizes cannot be returned.
ifail=71
On entry, yicomm has not been initialized correctly.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

g02jgf is not threaded in any implementation.

9 Further Comments

The data preprocessing routines, g02jcf and g02jff return the quantities, fnlsv, nff, rnlsv, nrf and nvpr. These values are data dependent and therefore the values obtained when preprocessing the datasets, Dx and Dy are likely to be different to those obtained if you had preprocessed the combined dataset Dz. In order to obtain these values for Dz you can call g02zlf after the call to g02jgf. Valid values for optstr are:

10 Example

This example fits a random effects model to a simulated dataset. The dataset is split into four blocks, with 10,31, 40 and 9 observations respectively. Each block is read in, processed by g02jff and then combined using g02jgf. Once all four blocks have been processed the model is fitted using g02jhf and the results are printed.

10.1 Program Text

Program Text (g02jgfe.f90)

10.2 Program Data

Program Data (g02jgfe.d)

10.3 Program Results

Program Results (g02jgfe.r)