Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0096/tbfdoc.fil
There is 1 other file named tbfdoc.fil in the archive. Click here to see a list.



                    DOCUMENTATION FOR PROGRAM

			    TBF.BAS





		JAMES FENNESSEY AND SUSAN RADIUS

		DEPARTMENT OF SOCIAL RELATIONS
		THE JOHNS HOPKINS UNIVERSITY
		BALTIMORE, MARYLAND  21218


		VERSION:  17 NOVEMBER 1975













	DISCLAIMER:
	ALTHOUGH THIS PROGRAM HAS BEEN CHECKED WITH REASONABLE
	CARE, IT IS NOT GUARANTEED.  THE USER EMPLOYS IT BASED
	ON HIS OWN INSPECTION OF THE CODE.  NEITHER THE AUTHORS
	NOR JOHNS HOPKINS UNIVERSITY ARE LIABLE FOR INCIDENTAL
	OR CONSEQUENTIAL DAMAGES.


1.	IMPLEMENTATION

THIS PROGRAM IS WRITTEN IN THE LANGUAGE 'BASIC', AND IS AT
PRESENT AVAILABLE FOR THREE DIFFERENT MACHINES: THE DECSYS- 
TEM-10, DARTMOUTH TIME-SHARING SYSTEM HONEYWELL 635 AND
THE WANG LABORATORIES 2200B SYSTEM.

THE PROGRAM IS DISTRIBUTED FOR USE WITH A 72 CHARACTER LINE
TERMINAL.  HOWEVER, THIS PARAMETER CAN BE CHANGED BY MAKING  
MINOR MODIFICATIONS IN THE 'BASIC' CODE.  SEE NOTE #1.   

THIS DOCUMENTATION REFERS SPECIFICALLY TO THE DECSYSTEM-10
VERSION, BUT IS GENERALLY APPLICABLE TO THE OTHER VERSIONS
AS WELL.


2.	PURPOSE

THE PROGRAM EVALUATES THE PROBABILITY DENSITY VALUES AND THE
CUMULATIVE PROBABILITIES OF EITHER A STUDENT'S -T- DISTRIBUTION
OR A BEHRENS DISTRIBUTION, FOR A LIST OF INPUT VALUES SPECIFIED
BY THE USER.  THE PROGRAM ALSO PROVIDES A PLOTTED GRAPH OF THE
DENSITY CURVE.  


3.	DESCRIPTION

AT THE BEGINNING OF THE RUN, THE USER IS ASKED TO TYPE "2" IF ONLY
A PLOT OF THE DENSITY CURVE IS WANTED.  OTHERWISE, THE USER 
TYPES "1" TO OBTAIN A TABULATION.  IN THE LATTER CASE, THE
PROGRAM WILL LATER ASK THE USER IF A PLOT IS ALSO WANTED.

NEXT, THE USER IS ASKED TO SPECIFY EITHER: (1) THE STUDENT'S -T-
DISTRIBUTION TO DESCRIBE A SINGLE MEAN; (2) THE STUDENT'S -T-
DISTRIBUTION TO DESCRIBE THE DIFFERENCE OF TWO MEANS; OR (3) THE
BEHRENS DISTRIBUTION TO DESCRIBE THE DIFFERENCE OF TWO MEANS, 
WHERE THE TWO VARIANCES ARE UNKNOWN AND NOT ASSSUMED EQUAL.

IN EACH OF THE ABOVE THREE ANALYSIS SITUATIONS, THE PROGRAM THEN
ASKS THE USER TO TYPE IN THE NUMBER(S) OF CASES, THE SAMPLE MEAN(S),
AND THE SAMPLE VARIANCE(S).  THE SAMPLE VARIANCE ( "V" ) IS
DEFINED AS FOLLOWS:
   V = ( SUM( X(I) - M)^2 )/(N-1)
WHERE M IS THE SAMPLE MEAN,  N IS THE NUMBER OF CASES IN THE
SAMPLE, AND X(I) DENOTES THE I-TH CASE  (I RANGES FROM 1 TO N).

THE PROGRAM ACCEPTS THE DATA INPUT (EITHER A SET OF N, M, AND V
OR TWO SETS OF N, M, AND V, AS APPROPRIATE TO THE TYPE OF PROBLEM
BEING DONE), AND THEN PROVIDES THE USER WITH A TRIAL LOWER
BOUND, DENSITY, AND CUMULATIVE PROBABILITY.  IF THE USER WISHES
TO EMPLOY THIS LOWER BOUND AND A SYMMETRIC UPPER BOUND, HE
RESPONDS BY TYPING THE SAMPLE MEAN, AS INSTRUCTED BY THE PROGRAM.
IF THE USER WISHES TO EMPLOY A DIFFERENT LOWER OR UPPER BOUND, HE
TYPES THE LOWER BOUND HE WISHES TO EMPLOY.  THE PROGRAM NEXT  
ASKS FOR THE UPPER BOUND DESIRED, AND THEN SHOWS THE DENSITY AND
CUMULATIVE PROBABILITY FOR THE LATEST LOWER BOUND.  IF THE USER
IS SATISFIED WITH THIS SET OF BOUNDS, HE TYPES THE SAMPLE MEAN, AS
INSTRUCTED BY THE PROGRAM.  THE PROGRAM NEXT ASKS FOR THE WIDTH
OF THE INTERVAL BETWEEN POINTS.  MOST FREQUENTLY THE INTERVAL
WILL BE CHOSEN SO THAT THERE ARE APPROXIMATELY 20 TO 40 POINTS
TABULATED AND APPROXIMATELY 40 TO 50 POINTS PLOTTED.  THE 
INTERVAL ALSO IS USUALLY CHOSEN SO THAT THE RESULTING POINTS
ARE SIMPLE NUMBERS.

IF A TABULATION HAS BEEN REQUESTED, THE PROGRAM TYPES IT ON
THE TERMINAL.  ALSO, A DISK FILE OF THE OUTPUT IS CREATED
FOR SUBSEQUENT TYPING ON THE TERMINAL OR PRINTING ON A LINE
PRINTER.

THE USER IS THEN ASKED TO SPECIFY THE LOWER AND UPPER BOUNDS AND 
THE STEP WIDTH FOR THE DENSITY PLOT.  IF BOTH THE TABULATION
AND THE DENSITY PLOT ARE BEING OBTAINED, THESE PLOTTING
LIMITS AND STEP WIDTH ARE INDEPENDENT OF THOSE USED FOR THE
TABULATION.  THIS ALLOWS THE USER TO OBTAIN THE TABULATION
ONLY FOR A PORTION OF THE RANGE, OR AT WIDELY SPACED
POINTS, AND THEN TO OBTAIN THE DENSITY PLOT ACROSS THE
ENTIRE RANGE, OR AT MORE NARROWLY SPACED POINTS.
THE PROGRAM THEN TYPES THE DENSITY PLOT ON THE TERMINAL
AND ADDS THE PLOTTING OUTPUT TO THE DISK FILE SO THAT IT
MAY LATER BE TYPED ON THE TERMINAL OR PRINTED ON A LINE
PRINTER.


4.	OPERATING LIMITS AND ACCURACY

THERE ARE SEVERAL RESTRICTIONS ON THE INPUT ALLOWED, BUT THESE
DO NOT CONSTITUTE A LIMITATION ON THE PROGRAM'S UTILITY.

THE NUMBER OF CASES ENTERED AND THE VARIANCES ENTERED MUST BE
GREATER THAN ZERO.

THE MAXIMUM DEGREES OF FREEDOM IN THE STUDENT'S -T- DISTRIBUTION
THAT IS ACTUALLY EVALUATED BY THE CUMULATIVE PROBABILITY ROUTINE
IS 2812.  THIS NUMBER IS SO LARGE THAT THE NORMAL APPROXIMATION
TO THE STUDENT'S -T- DISTRIBUTION IS PERFECTLY ADEQUATE IF THE
DEGREES OF FREEDOM IS GREATER THAN 2812.

THE MAXIMUM NUMBER OF POINTS THAT MAY BE TABULATED OR PLOTTED
IN A SINGLE PROBLEM IS 200.  THIS LIMIT IS ARBITRARY AND MAY  
BE ALTERED BY MINOR ADJUSTMENT TO THE BASIC CODE IN LINES
#2330 AND #3000,  CHANGING 'W1<=200' TO 'W1<=' <THE 
DESIRED VALUE>.

THE ACCURACY OF THE ALGORITHM FOR THE CUMULATIVE STUDENT'S -T-
DISTRIBUTION IS APPROXIMATELY 4 DECIMAL PLACES FOR ALL VALUES
OF THE DEGREES OF FREEDOM AND OF -T- TABULATED IN TABLE 9 OF
PEARSON AND HARTLEY (1966).  SEE FENNESSEY AND RADIUS (1975).
THE ALGORITHM USED FOR THE CUMULATIVE -T- PROBABILITY DOES NOT
DEPEND UPON ANY PRIOR CALCULATIONS.  THUS, ONE MAY SPECIFY
THAT CUMULATIVE PROBABILITIES BEGIN AT ANY POINT.

THE ACCURACY OF THE APPROXIMATION USED FOR THE BEHRENS DISTRIB-
UTION IS SATISFACTORY FOR MOST PURPOSES PROVIDED
THE DEGREES OF FREEDOM FOR EACH OF THE TWO SAMPLES IS AT
LEAST 7.  IF ONE OR BOTH OF THE DEGREES OF FREEDOM IS LESS THAN
7,  THE DENSITIES AND/OR CUMULATIVE PROBABILITIES IN THE TAILS  
ARE LIKELY TO BE IN ERROR BY MORE THAN 20 PERCENT.  SEE
FENNESSEY AND RADIUS (1975) FOR MORE DETAILED DISCUSSION.


5.	ALGORITHMS

THE ALGORITHMS USED ARE AS FOLLOWS:

	FOR THE APPROXIMATION OF THE BEHRENS DISTRIBUTION,
        A FORMULA DUE TO PATIL IS USED.  THIS FORMULA
        CREATES A "DILATED" STUDENT'S -T- AS THE APPROXI-
        MATION OF THE BEHRENS DISTRIBUTION. SEE V. K. PATIL,
        APPROXIMATION TO THE BEHRENS-FISHER DISTRIBUTION,
	BIOMETRIKA, 1965, VOL. 52, PP. 267-271.  SEE ALSO
	G. E. P. BOX AND G. C. TIAO, BAYESIAN INFERENCE IN
	STATISTICAL ANALYSIS (ADDISON-WESLEY, 1973) P. 107.
	SEE ALSO V. K. PATIL, BEHRENS-FISHER DISTRIBUTIONS,
	(UNPUBLISHED PH. D. DISSERTATION, THE UNIVERSITY OF
	MICHIGAN, 1963)  MICROFILM ORDER #63-6937.

	FOR THE CUMULATIVE PROBABILITY OF THE STUDENT'S -T- DIS-
        TRIBUTION, AN ALGORITHM BY A. SCHLEIFER BASED UPON
        THE INCOMPLETE BETA FUNCTION RATIO IS USED.  IT
        WAS CODED ORIGINALLY IN 'FORTRAN' AS PART OF THE
        'MANECON' PACKAGE.  'MANECON' WAS DEVELOPED BY
        R. SCHLAIFER AT THE HARVARD BUSINESS SCHOOL.
        THIS ALGORITHM IS INCORPORATED IN THE 'MANECON' ROUTINES:
	'DBETCU' AND 'SPCASE'.  THE FORMULAS ARE DESCRIBED IN
	THE BOOK 'COMPUTER PROGRAMS FOR ELEMENTARY DECISION
	ANALYSIS' (HARVARD, 1971), PP. 200-205.  THE ADAPTATION WAS  
        MADE WITH THE PERMISSION OF THE PRESIDENT AND FELLOWS
	OF HARVARD COLLEGE.

        FOR LN(GAMMA(X)), AN ALGORITHM USING A STIRLING ASYMPTOTIC
        APPROXIMATION IS USED.  SEE ABRAMOWITZ AND STEGUN,
        P. 257, EQ. 6.1.41.


6.	SAMPLE PROBLEMS

SAMPLE OUTPUT FOR PROBLEMS INVOLVING EACH OF THE THREE KINDS OF
EVALUATION (I.E., SINGLE -T-;  DUAL -T-; AND BEHRENS) IS PROVIDED
IN A SEPARATE DOCUMENT.


7.	INSTRUCTIONS FOR USE ON THE DECSYSTEM-10
        AT THE JOHNS HOPKINS UNIVERSITY

  1.	LOG INTO THE DECSYSTEM-10
  2.	TYPE "R BASIC" TO INITIATE BASIC MONITOR PROGRAM
  3.	WHEN BASIC TYPES "READY", TYPE "OLD TBF"
  4.	WHEN BASIC TYPES "READY", TYPE "RUN"
  5.	ANSWER QUESTIONS AS THEY ARE ASKED.  BE PREPARED TO
	SUPPLY LOWER AND UPPER LIMITS BETWEEN WHICH THE
	VALUES TO BE EVALUATED LIE.  NOTE THAT OFTEN IT IS
	DESIRABLE TO MAKE THE PLOT SYMMETRIC ABOUT THE
	MEAN, BUT THAT FOR THE TABULATION IT IS OFTEN 
	SUFFICIENT TO EVALUATE VALUES ON ONE OR THE OTHER
	SIDE OF THE MEAN.


8.	REFERENCES


M. ABRAMOWITZ AND I.A. STEGUN (EDS.),HANDBOOK OF
MATHEMATICAL FUNCTIONS  (NATIONAL BUREAU OF STANDARDS,
APPLIED MATHEMATICS SERIES, 55;  U.S. GOVERNMENT
PRINTING OFFICE, 1968).


G.E.P. BOX AND G.C. TIAO,  BAYESIAN INFERENCE IN STATISTICAL
ANALYSIS. (READING, MASS., ADDISON-WESLEY, 1973).


J. FENNESSEY AND S. RADIUS,  "THE PRESENTATION OF STATIS-
TICAL RESULTS CONCERNING MEANS AND DIFFERENCES OF MEANS",
TECHNICAL REPORT,  DEPARTMENT OF SOCIAL RELATIONS, THE
JOHNS HOPKINS UNIVERSITY,  NOVEMBER 1975.


V. K. PATIL, "APPROXIMATIONS TO THE BEHRENS-FISHER DISTRIBUTION",
BIOMETRIKA, VOL. 52, 1965, PP. 267-271.


V. K. PATIL, THE BEHRENS-FISHER DISTRIBUTIONS. (UNPUBLISHED
PH. D. DISSERTATION, THE UNIVERSITY OF MICHIGAN, 1963)
MICROFILM ORDER #63-6937.


R. SCHLAIFER,  COMPUTER PROGRAMS FOR ELEMENTARY DECISION
ANALYSIS. (HARVARD UNIVERSITY, 1971).


9.	NOTES

  1.    TO ADAPT THE PRINT LINE TO A DIFFERENT WIDTH,
        CHANGE THE TWO STATEMENTS THAT NOW READ MARGIN 80
        AND MARGIN#1,80 TO THE DESIRED MARGIN.  ALSO,
        CHANGE THE STATEMENTS IN WHICH Y9/50 APPEARS TO
        USE A NEW DIVISOR.  THESE STATEMENTS APPEAR IN THE
        DENSITY PLOT SUBROUTINE.  IN ADDITION, IT IS
        NECESSARY TO CHANGE THE TWO STATEMENTS DIRECTING
        THE PRINTING OF THE DOTTED Y-AXIS.  AS CURRENTLY
        WRITTEN, THE LAST CHARACTER OF THE DOTTED AXIS
        PRINTS IN COLUMN 72.


IIIAAAA>>AAA>						AA@@@@IIIAIII6			AAA>>AAA>>AAAA``			AA@@@@*U*73