tieStatistics

Compute tie statistics for a sample of observations.

Synopsis

tieStatistics (x)

Required Arguments

float x[] (Input)
Array of length nObservations containing the observations. x must be ordered monotonically increasing with all missing values removed.

Return Value

Array of length 4 containing the tie statistics.

ties[0]=τj=1[tj(tj1)]/2ties[1]=τj=1[tj(tj1)(tj+1)]/12ties[2]=τj=1[tj(tj1)(2tj+5)]ties[3]=τj=1[tj(tj1)(tj2)]

where tj is the number of ties in the j-th group (rank) of ties, and τ is the number of tie groups in the sample.

Optional Arguments

fuzz, float (Input)

Value used to determine ties. Observations i and j are tied if the successive differences

x[k + 1] x[k] between observations i and j, inclusive, are all less than fuzz. fuzz must be nonnegative.

Default: fuzz = 0.0

Description

Function tieStatistics computes tie statistics for a monotonically increasing sample of observations. “Tie statistics” are statistics that may be used to correct a continuous distribution theory nonparametric test for tied observations in the data. Observations i and j are tied if the successive differences X(k + 1) - X(k), inclusive, are all less than fuzz. Note that if each of the monotonically increasing observations is equal to its predecessor plus a constant, if that constant is less than fuzz, then all observations are contained in one tie group. For example, if fuzz = 0.11, then the following observations are all in one tie group.

0.0, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00

Example

We want to compute tie statistics for a sample of length 7.

from numpy import *
from pyimsl.stat.tieStatistics import tieStatistics
from pyimsl.stat.writeMatrix import writeMatrix

ties = []
fuzz = .001
x = array([1.0, 1.0001, 1.0002, 2., 3., 3., 4.])

ties = tieStatistics(x, fuzz=fuzz)

writeMatrix("TIES", ties, writeFormat="%5.2f")

Output

 
           TIES
    1      2      3      4
 4.00   2.50  84.00   6.00