/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "chi.p" */ #include /* chi: estimates chi squared from degrees of freedom Tom Schneider, 1988 */ /* end of program */ /* begin module version */ #define version 1.04 /* of chi.p 1994 Sep 5 origin 1988 July 12 */ /* end module version */ /* begin module describe.chi */ /* name chi: estimates chi squared from degrees of freedom synopsis chi(input, output); files input: degrees of freedom output: messages to the user description estimates chi squared, given degrees of freedom. documentation @book{Finberg1978, author = "S. Finberg", title = "Analysis of Cross Classified Catagorical Data", publisher = "MIT Press", address = "Cambridge, Mass?", year = "1978", comment = "from Chip Lawrence, S=Steven"} appendix iii author Thomas Dana Schneider bugs it's only an estimate */ /* end module describe.chi */ /* begin module chi.themain */ Static Void themain() { /* the main procedure of the program */ long df; /* degrees of freedom */ double TEMP; printf("chi %4.2f\n", version); printf("give degrees of freedom: \n"); scanf("%ld%*[^\n]", &df); getchar(); if (df <= 6) printf("WARNING: degrees too small\n"); if (df > 100) printf("WARNING: degrees too big\n"); printf("\nNOTE: result is around 1.3%% off\n\n"); printf("for chi squared is\n"); printf("significance \n"); TEMP = sqrt((double)df) + 0.833; printf("0.1 %8.2f\n", TEMP * TEMP); TEMP = sqrt((double)df) + 1.115; printf("0.05 %8.2f\n", TEMP * TEMP); TEMP = sqrt((double)df) + 1.365; printf("0.025 %8.2f\n", TEMP * TEMP); TEMP = sqrt((double)df) + 1.662; printf("0.010 %8.2f\n", TEMP * TEMP); TEMP = sqrt((double)df) + 1.867; printf("0.005 %8.2f\n", TEMP * TEMP); } /* end module chi.themain */ main(argc, argv) int argc; Char *argv[]; { PASCAL_MAIN(argc, argv); themain(); _L1: exit(EXIT_SUCCESS); } /* End. */