/* nag_2_sample_t_test (g07cac) Example Program. * * Copyright 1996 Numerical Algorithms Group. * * Mark 4, 1996. * * Mark 6 revised, 2000. */ #include #include #include #include int main(void) { /* Local variables */ double prob, xstd, ystd; double t; double xmean, ymean, df, dl, du; double clevel; Integer nx, ny; Vprintf("nag_2_sample_t_test (g07cac) Example Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld %ld", &nx, &ny); Vscanf("%lf %lf %lf %lf", &xmean, &ymean,&xstd, &ystd); Vscanf("%lf",&clevel); /* nag_2_sample_t_test (g07cac). * Computes t-test statistic for a difference in means * between two Normal populations, confidence interval */ nag_2_sample_t_test(Nag_TwoTail, Nag_PopVarEqual, nx, ny, xmean, ymean, xstd, ystd, clevel, &t, &df, &prob, &dl, &du, NAGERR_DEFAULT); Vprintf("\nAssuming population variances are equal.\n\n"); Vprintf("t test statistic = %10.4f\n",t); Vprintf("Degrees of freedom = %8.1f\n",df); Vprintf("Significance level = %8.4f\n", prob); Vprintf("Lower confidence limit for difference in means = %10.4f\n", dl); Vprintf("Upper confidence limit for difference in means = %10.4f\n\n",du); /* nag_2_sample_t_test (g07cac), see above. */ nag_2_sample_t_test(Nag_TwoTail, Nag_PopVarNotEqual, nx, ny, xmean, ymean, xstd, ystd, clevel, &t, &df, &prob, &dl, &du, NAGERR_DEFAULT); Vprintf("\nNo assumptions about population variances.\n\n"); Vprintf("t test statistic = %10.4f\n",t); Vprintf("Degrees of freedom = %8.4f\n",df); Vprintf("Significance level = %8.4f\n", prob); Vprintf("Lower confidence limit for difference in means = %10.4f\n",dl); Vprintf("Upper confidence limit for difference in means = %10.4f\n",du); return EXIT_SUCCESS; }