DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T c

⟦6e665a9eb⟧ TextFile

    Length: 1435 (0x59b)
    Types: TextFile
    Names: »critf.c«

Derivation

└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
    └─ ⟦this⟧ »cph85dist/stat/src/critf.c« 

TextFile

/*LINTLIBRARY*/
#include "unixstat.h"
FUN(critf,probability to F-ratio conversion,5.0,1985)
/* Copyright (c) 1982 Gary Perlman (see Copyright file) */

double
critf (p, df1, df2) double p;
	{
	double	fval = 5.0;
	char	goingup = 1;
	double	step = 4.0;
	double	holdp = 1.1;
	double	fabs ();
	double	pof ();
	if (p <= 0.0 || p > 1.0) return (0.0);
	while (fabs (p-holdp) > 0.00001)
		{
		if ((holdp = pof (fval, df1, df2)) > p)
			{
			if (!goingup) step /= 2;
			goingup = 1;
			fval += step;
			}
		else
			{
			if (goingup) step /= 2;
			goingup = 0;
			fval -= step;
			}
		}
	fval += goingup ? step : -step;
	return (fval);
	}

#ifdef STANDALONE
#include "unixstat.h"
PGM(critf, Probability to F-Ratio Conversion,5.0,3/5/85)

main (argc, argv) int argc; char **argv;
	{
	double	F;
	double	p;
	double	critf ();
	double	atof ();
	int 	df1;
	int 	df2;
	ARGV0;
	if (argc != 4)
		USAGE (p df1 df2)
	if (!number (argv[1]))
		ERRNUM (argv[1],probability of F-ratio)
	if (!INTEGER (argv[2]))
		ERRNUM (argv[2],numerator degrees of freedom)
	if (!INTEGER (argv[3]))
		ERRNUM (argv[3],denominator degrees of freedom)
	if ((p = atof (argv[1])) <= 0.0 || p >= 1.0)
		ERRMSG0 (probability must be between 0.0 and 1.0)
	df1 = atoi (argv[2]);
	df2 = atoi (argv[3]);
	if (df1 <= 0 || df2 <= 0)
		ERRMSG0 (degrees of freedom must be positive)
	F = critf  (p, df1, df2);
	printf ("F(%d,%d) = %4.3f, p = %4.3f\n", df1, df2, F, p);
	exit (0);
	}
#endif