Next: , Previous: gsmirn2, Up: statistics


13.3 stcalc

calculate classical or weighted Smirnov statistic

Synopsis

     #include <suplib/stats.h>
     
     
     
int stcalc( int icw, int nx, int ny, double *x, double *y, int *k, int **m, double *dstats );

Parameters

int icw
classical (1) or weighted (2) Smirnov statistic
int nx
The number of observations in the first sample
int ny
The number of observations in the second sample
double *x
input: The first sample
double *y
input: The second sample
int *k
output: The number of categories in the pooled sample
int **m
output: The number of observations in each category.
double *dstats
output: the calculated statistics

Description

stcalc calculates statistics, number of categories (i.e. unique values in the sample) in the pooled sample and numbers of observations falling into each category for the two-sample Smirnov tests for arbitrary distributions.

The following statistics are calculated.

  1. sup | X - Y |
  2. sup ( X - Y )
  3. sup ( Y - X )

Returns

The number of categories is returned via the k argument. The address of an integer array with *k elements holding the number of observations per category is returned via m. stcalc allocates the array; the calling routine must free it. The statistics are written to the dstats parameter, which is a caller-allocated array of minimum length 3. The return value of the subroutine may have the following possible values.

0
no error
1
the nx < 1 or ny < 1
2
allocation of workspace failed

Author

Original by Andrei M. Nikiforov C transcription by Diab Jerius

Copyright

This code is copyrighted by the Royal Statistical Society. It may be distributed provided that no fee is charged.