Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0025/mandsd.bas
There are 2 other files named mandsd.bas in the archive. Click here to see a list.
00001	GO TO 570
00300	LET H=0
00301	PRINT "MODIFIED 05/29/68"
00305	PRINT
00310	PRINT
00315	PRINT "ARITHMETIC MEAN, VARIANCE, AND"
00320	PRINT "      STANDARD DEVIATION"
00325	PRINT
00330	READ C
00335	LET H=H+1
00340	IF C=1E37 THEN 795
00345	LET S1=0
00350	LET S2 = 0
00355	IF C <> 0 THEN 435
00360	PRINT
00365	PRINT "FOR GROUPED DATA SET";H
00370	PRINT
00375	READ Q
00380	LET N = 0
00385	PRINT "X-VALUE","FREQUENCY"
00390	PRINT
00395	FOR P = 1 TO Q
00400	READ X, M
00405	LET N = N + M
00410	LET S1 = S1 + M*X
00415	LET S2 = S2 + M*X*X
00420	PRINT X, M
00425	NEXT P
00430	GOTO 500
00435	PRINT
00440	PRINT
00445	PRINT "INDIVIDUAL SET NUMBER";H
00450	PRINT
00455	PRINT "INPUT VALES:  ";
00460	LET N = C
00465	FOR P = 1 TO N
00470	READ X
00475	LET S1 = S1 + X
00480	LET S2 = S2 + X*X
00485	PRINT X;
00490	NEXT P
00495	PRINT
00500	LET A = S1/N
00505	LET V=(S2-A*S1)/N
00506	LET D1=SQR(V)
00510	LET V1=V*N/(N-1)
00512	LET V2=V1/N
00514	LET V3=SQR(V2)
00515	LET D=SQR(V1)
00520	PRINT
00525	PRINT "      NUMBER OF VALUES = ";N
00530	PRINT "       ARITHMETIC MEAN = ";A
00531	PRINT"     STD DEV OF SAMPLE = ";D1
00535	PRINT "    STANDARD DEVIATION = ";D
00540	PRINT "       SAMPLE VARIANCE = ";V
00545	PRINT "     EST TRUE VARIANCE = ";V1
00546	PRINT"         ST ERROR MEAN = ";V3
00550	PRINT
00555	PRINT
00560	GOTO 330
00565	PRINT
00570	PRINT "THIS PROGRAM CALCULATES THE MEAN, VARIANCE, AND STANDARD"
00575	PRINT "DEVIATION FOR EACH OF SEVERAL SETS OF INDIVIDUAL VALUES"
00580	PRINT "OR FREQUENCY DISTRIBUTIONS."
00585	PRINT
00590	PRINT "DATA FOR EACH SET OF INDIVIDUAL VALUES IS ENTERED INTO"
00595	PRINT "THE PROGRAM AS FOLLOWS:"
00600	PRINT
00605	PRINT "   1 DATA  N, X(1), X(2), X(3),....., X(N)"
00610	PRINT
00615	PRINT "WHERE THE N VALUES OF THE SET ARE X(1) THRU X(N).  IF"
00620	PRINT "NEEDED, ADDITIONAL DATA STATEMENTS MAY BE USED TO GIVE"
00625	PRINT "THE ENTIRE LIST OF VALUES.   ADDITIONAL CASES MAY BE"
00630	PRINT "GIVEN IN SUBSEQUENT DATA STATEMENTS IN THE SAME FORMAT."
00635	PRINT
00640	PRINT "THE INPUT FOR GROUPED VALUES HAS THE FOLLOWING FORMAT:"
00645	PRINT
00650	PRINT "   1 DATA 0, N, X(1), F(1), X(2), F(2),..., X(N), F(N)"
00655	PRINT
00660	PRINT "WHERE THE INITIAL ZERO SIGNALS GROUPED DATA, THE N IS"
00665	PRINT "THE NUMBER OF DIFFERENT VALUES TO BE GIVEN, AND THE F(I)"
00670	PRINT "ARE THE NUMBER OF TIMES THE X(I) OCCUR.  DATA STATEMENTS"
00675	PRINT "FOLLOWING MAY BE USED TO EXTEND THE LIST AS NECESSARY,"
00680	PRINT "AND BLOCKS OF GROUPED DATA MAY BE INTERMIXED FREELY"
00685	PRINT "WITH STRAIGHT LISTS DESCRIBED ABOVE."
00690	PRINT
00695	PRINT "AS AN EXAMPLE, SUPPOSE WE WERE INTERESTED IN THE MEAN"
00700	PRINT "AND STANDARD DEVIATION OF THE NUMBERS 1,5,4,2,6,7,4,7"
00705	PRINT "AND ALSO FOR THE DISTRIBUTION CONSISTING OF 5-1'S,"
00710	PRINT "3-4'S, 6-7'S, AND 2-11'S.  THESE TWO CASES COULD BE RUN"
00715	PRINT "BY TYPING THE FOLLOWING:"
00720	PRINT
00725	PRINT "   1 DATA 8,1,5,4,2"
00730	PRINT "   2 DATA 6,7,4,7"
00735	PRINT "   3 DATA 0,4,5,1,3,4"
00740	PRINT "   4 DATA 6,7,2,11"
00745	PRINT "   RUN"
00750	PRINT
00755	PRINT "OR EQIVALENTLY:"
00760	PRINT
00765	PRINT "   1 DATA 8,1,5,4,2,6,7,4,7,0,4,5,1,3,4,6,7,2,11"
00770	PRINT "   RUN"
00775	PRINT
00780	PRINT "NOTE THAT STATEMENT NUMBERS 1 THRU 299 ARE AVAILABLE"
00785	PRINT "FOR CONTINUATION OF THE DATA FIELD."
00790	DATA 1E37
00795	END