/* nag_rank_ci_2var (g07ebc) Example Program. * * Copyright 2001 Numerical Algorithms Group. * * Mark 7, 2001. */ #include #include #include #include int main(void) { /* Scalars */ double clevel, estcl, theta, thetal, thetau, ulower, uupper; Integer exit_status, i, m, n; NagError fail; /* Arrays */ double *wrk=0, *x=0, *y=0; Integer *iwrk=0; INIT_FAIL(fail); exit_status = 0; Vprintf("nag_rank_ci_2var (g07ebc) Example Program Results\n"); /* Skip Heading in data file */ Vscanf("%*[^\n] %ld%ld%*[^\n] ", &n, &m); /* Allocate memory */ if ( !(wrk = NAG_ALLOC(600, double)) || !(x = NAG_ALLOC(n, double)) || !(y = NAG_ALLOC(m, double)) || !(iwrk = NAG_ALLOC(300, Integer)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } Vscanf(" %*[^\n] "); for (i = 1; i <= n; ++i) Vscanf("%lf", &x[i - 1]); Vscanf(" %*[^\n] "); for (i = 1; i <= m; ++i) Vscanf("%lf", &y[i - 1]); Vscanf(" %*[^\n] "); Vscanf(" %lf%*[^\n] ", &clevel); /* nag_rank_ci_2var (g07ebc). * Robust confidence intervals, two-sample */ nag_rank_ci_2var(Nag_RCI_Approx, n, x, m, y, clevel, &theta, &thetal, &thetau, &estcl, &ulower, &uupper, &fail); if (fail.code != NE_NOERROR) { Vprintf("Error from nag_rank_ci_2var (g07ebc).\n%s\n", fail.message); exit_status = 1; goto END; } Vprintf("\n"); Vprintf(" Location estimator Confidence Interval\n"); Vprintf("\n"); Vprintf(" %10.4f ( %6.4f , %6.4f )\n", theta, thetal, thetau); Vprintf("\n"); Vprintf(" Corresponding Mann-Whitney U statistics\n"); Vprintf("\n"); Vprintf(" Lower : %8.2f\n Upper : %8.2f\n", ulower, uupper); END: if (wrk) NAG_FREE(wrk); if (x) NAG_FREE(x); if (y) NAG_FREE(y); if (iwrk) NAG_FREE(iwrk); return exit_status; }