The routine may be called by the names g10zaf or nagf_smooth_data_order.
Given a set of observations , for , with corresponding weights , g10zaf rearranges the observations so that the are in ascending order.
For any equal in the ordered set, say , a single observation is returned with a corresponding and , calculated as
Observations with zero weight are ignored. If no weights are supplied by you, then unit weights are assumed; that is , for .
In addition, the within group sum of squares is computed for the tied observations using West's algorithm (see West (1979)).
Draper N R and Smith H (1985) Applied Regression Analysis (2nd Edition) Wiley
West D H D (1979) Updating mean and variance estimates: An improved method Comm. ACM22 532–555
1: – Character(1)Input
On entry: indicates whether user-defined weights are to be used.
If , user-defined weights are to be used and must be supplied in wt.
If , the data is treated as unweighted.
2: – IntegerInput
On entry: , the number of observations.
3: – Real (Kind=nag_wp) arrayInput
On entry: the values,
, for .
4: – Real (Kind=nag_wp) arrayInput
On entry: the values
, for .
5: – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array wt
must be at least
On entry: if , wt must contain the weights. Otherwise wt is not referenced and unit weights are assumed.
, for ;
if , .
6: – IntegerOutput
On exit: the number of distinct observations.
7: – Real (Kind=nag_wp) arrayOutput
On exit: the first nord elements contain the ordered and distinct .
8: – Real (Kind=nag_wp) arrayOutput
On exit: the first nord elements contain the values corresponding to the values in xord.
9: – Real (Kind=nag_wp) arrayOutput
On exit: the first nord elements contain the values corresponding to the values of xord and yord.
10: – Real (Kind=nag_wp)Output
On exit: the within group sum of squares for tied observations.
11: – Integer arrayWorkspace
12: – 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, . Constraint: .
On entry, .
Constraint: or .
On entry, all weights are zero.
On entry, and .
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.
For a discussion on the accuracy of the algorithm for computing mean and variance see West (1979).