>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_NCTRENDS



The IMSL_NCTRENDS function performs the Noether test for cyclical trend (Noether 1956) for a sequence of measurements.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

In this test, the observations are first divided into sets of three consecutive observations. Each set is then inspected, and if the set is monotonically increasing or decreasing, the count variable is made incremental.

The count variables, NSTAT(1), NSTAT(2), and NSTAT(3), differ in the manner in which ties are handled. A tie can occur in a set (of size three) only if the middle element is tied with either of the two ending elements. Tied ending elements are not considered. In NSTAT(1), tied middle observations are eliminated, and a new set of size 3 is obtained by using the next observation in the sample. In NSTAT(2), the original set of size three is used, and tied middle observations are counted as nonmonotonic. In NSTAT(3), tied middle observations are counted as monotonic.

The probabilities of occurrence of the counts are obtained from the binomial distribution with p = 1/3, where p is the probability that a random sample of size three from a continuous distribution is monotonic. The binomial sample size is, of course, the number of sequences of size three found (adjusted for ties).

Hypothesis test:

H0 : q = Pr(Xi > Xi - 1 > Xi - 2) + Pr(Xi < Xi - 1 < Xi - 2) ≤ 1/3

H1: q > 1/3

Reject if Result(0)—or Result(1) or Result(2) depending on the method used for handling ties—is less than the significance level of the test.

Assumption: The observations are independent and are from a continuous distribution.


A test for cyclical trend in a sequence of 1000 randomly generated observations is performed. Because of the sample used, there are no ties and all three test statistics yield the same result.

IMSL_RANDOMOPT, set	=	123457
x	=	IMSL_RANDOM(1000, /Uniform)
pval	=	IMSL_NCTRENDS(x, Nstat = nstat)
PM, pval
PM, nstat

IDL prints:



Result = IMSL_NCTRENDS(X [, /DOUBLE] [, FUZZ=value] [, NMISSING=variable] [, NSTAT=variable])

Return Value

One-dimensional array of length 3 containing the probabilities of NSTAT(1) or more, NSTAT(2) or more, or NSTAT(3) or more monotonic sequences. If NSTAT(0) is less than 1, Result(0) is set to NaN (not a number).



One-dimensional array containing the data in chronological order.


DOUBLE (optional)

If present and nonzero, double precision is used.

FUZZ (optional)

Nonnegative constant used to determine ties in computing ranks in the combined samples. A tie is declared when two observations in the combined sample are within FUZZ of each other. The default value is 0.0.

NMISSING (optional)

Named variable containing the number of missing values in x.

NSTAT (optional)

Named variable into which the one-dimensional array of length 6 containing the statistics below is stored:

  • NSTAT(0): The number of consecutive sequences of length three used to detect cyclical trend when tying middle elements are eliminated from the sequence, and the next consecutive observation is used.
  • NSTAT(1): The number of monotonic sequences of length three in the set defined by NSTAT(0).
  • NSTAT(2): The number of nonmonotonic sequences where tied threesomes are counted as nonmonotonic.
  • NSTAT(3): he number of monotonic sequences where tied threesomes are counted as monotonic.
  • NSTAT(4): The number of middle observations eliminated because they were tied in forming the NSTAT(0) sequences.
  • NSTAT(5): The number of tied sequences found in forming the NSTAT(2) and NSTAT(3) sequences. A sequence is called a tied sequence if the middle element is tied with either of the two other elements.

Version History



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us