/* nag_sign_test (g08aac) Example Program. * * Copyright 2000 Numerical Algorithms Group. * * Mark 6, 2000. */ #include #include #include #include int main (void) { double p, *x=0, *y=0; Integer i, s, n, non_tied; Integer exit_status=0; NagError fail; INIT_FAIL(fail); Vprintf("g08aac Example Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); n=17; if (!(x=NAG_ALLOC(n, double)) || !(y=NAG_ALLOC(n, double))) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } for (i=1; i<=n; i++) Vscanf("%lf", &x[i-1]); for (i=1; i<=n; i++) Vscanf("%lf", &y[i-1]); Vprintf("\n%s\n\n", "Sign test"); Vprintf("%s\n\n", "Data values"); for (i=1; i<=n; i++) Vprintf("%3.0f%s", x[i-1], i%n?"":"\n"); Vprintf("\n"); for (i=1; i<=n; i++) Vprintf("%3.0f%s", y[i-1], i%n?"":"\n"); Vprintf("\n"); g08aac(n, x, y, &s, &p, &non_tied, &fail); if (fail.code != NE_NOERROR) { Vprintf("Error from g08aac.\n%s\n", fail.message); exit_status = 1; goto END; } Vprintf("%s%5ld\n", "Test statistic ", s); Vprintf("%s%5ld\n", "Observations ", non_tied); Vprintf("%s%5.3f\n", "Lower tail prob. ", p); END: if (x) NAG_FREE(x); if (y) NAG_FREE(y); return exit_status; }