naginterfaces.library.smooth.data_​order

naginterfaces.library.smooth.data_order(x, y, wt=None)[source]

data_order orders and weights data which is entered unsequentially, weighted or unweighted.

For full information please refer to the NAG Library document for g10za

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g10/g10zaf.html

Parameters
xfloat, array-like, shape

The values, , for .

yfloat, array-like, shape

The values , for .

wtNone or float, array-like, shape , optional

If , must contain the weights. Otherwise is not referenced and unit weights are assumed.

Returns
nordint

The number of distinct observations.

xordfloat, ndarray, shape

The first elements contain the ordered and distinct .

yordfloat, ndarray, shape

The first elements contain the values corresponding to the values in .

wtordfloat, ndarray, shape

The first elements contain the values corresponding to the values of and .

rssfloat

The within group sum of squares for tied observations.

Raises
NagValueError
(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, all weights are zero.

(errno )

On entry, and .

Constraint: .

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

Given a set of observations , for , with corresponding weights , data_order 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

and

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)).

References

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. ACM (22), 532–555