Next: , Previous: statistics, Up: statistics


13.1 gsmirn

exact Smirnov Two-Sample tests for arbitrary distributions.

Synopsis

     #include <suplib/stats.h>
     
     
     
int gsmirn( int nx, int ny, int kind, int *m, double dstat, double *q );

Parameters

int nx
The number of observations in the first sample
int ny
The number of observations in the second sample
int kind
The hypothesis tested
int *m
The number of observations falling into each of K categories (with ascending order of category values)
double dstat
The statistic
double *q
output: p-value

Description

gsmirn generates the P-value for the generalized two-sample Smirnov tests. It calculates the probability of the null hypothesis (that the two samples are the same) based upon one of three statistics

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

The input parameter kind indicates which of these should be calculated. The input parameters m and dstat are calculated by the stcalc subroutine.

See Applied Statistics, Vol. 43, No. 1 (1994), 265-270.

Returns

0
no error
1
the nx < 1 or ny < 1
2
kind != 1, 2 or 3
3
q is not positive
4
m is inconsistent with nx and ny or has non-positive elements
5
allocation of workspace failed

Warning

This code returns incorrect values for large nx and ny for nx != ny for various ratios. See gsmirn2 for a slower version which does not suffer from these problems.

Author

Original by Andrei M. Nikiforov C transcription by Diab Jerius