/* nag_prob_students_t (g01ebc) Example Program. * * Copyright 1996 Numerical Algorithms Group. * * Mark 4, 1996. * Mark 5 revised, 1998. * Mark 7 revised, 2001. * */ #include #include #include #include int main(void) { double df, prob, t; int i; static Nag_TailProbability tail[4] = {Nag_LowerTail, Nag_UpperTail, Nag_TwoTailSignif, Nag_TwoTailConfid}; static const char *tailmess[] = { "Nag_LowerTail", "Nag_UpperTail", "Nag_TwoTailSignif", "Nag_TwoTailConfid"}; Vprintf("nag_prob_students_t (g01ebc) Example Program Results\n\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf(" t df prob tail\n\n"); while (scanf("%lf %lf %d\n", &t, &df, &i) != EOF) { /* nag_prob_students_t (g01ebc). * Probabilities for Student's t-distribution */ prob = nag_prob_students_t(tail[i], t, df, NAGERR_DEFAULT); Vprintf(" %6.3f%8.3f%8.4f %s\n", t, df, prob, tailmess[i]); } return EXIT_SUCCESS; }