1 3 PRINT "UNISTA"
2 5 REM REVISED FEB 5, 1975
3 6 REM THE SORT USED IN THIS PROGRAM IS SLOW
4 10 REM: UNISTA DO NOT RESEQUENCE
5 12 PRINT "DO YOU WANT INSTURCTIONS? YES OR NO"
6 13 INPUT Q1$
7 14 IF Q1$ = "YES" THEN 20
8 15 IF Q1$ = "yes" THEN 20
9 16 IF Q1$ = "no" THEN 700
10 17 IF Q1$ = "NO" THEN 700
11 18 PRINT "ANSWER EITHER ""YES"" OR ""NO"""
12 19 GO TO10
13 20 PRINT "LINE NUMBERS 50-699 ARE FREE FOR USE AS DATA STATEMENTS, AS REQUIRED"
14 22 PRINT "ALL VALUES FOR ONE VARIABLE ARE GIVE IN DATA STATEMENTS, FOLLOWED BY"
15 24 PRINT "ALL VALUES FOR A SECOND VARIABLE, AND SO ON."
16 26 PRINT "THE WAY TO ARRANGE INPUT IS TO PUT ALL VALUES OF VARIABLE 1 AT LINES"
17 28 PRINT "100-199, ALL FOR VARIABLE 2 AT LINES 200-299, ECT."
18 30 PRINT "UNISTA ACCEPTS UP TO 300 OBSERVATIONS ON ONE VARIABLE."
19 32 PRINT
20 34 STOP
21 700 PRINT
22 730 RESET
23 740 PRINT
24 750 PRINT"TYPICAL INTERVAL FOR FREQUENCY DISTRIBUTIONS:";
25 760 PRINT" L,U =";
26 770 INPUT W1,W2
27 780 PRINT
28 790 PRINT
29 800 DIM X300,S4,Y4,Z4
30 810 DIM C50,G50,E50,F50
31 820 DEF FNRM=.001*INT1000*M+.5
32 830 DATA 1E38,0,0,0,0,0,0,0
33 840 LET I = 0
34 850 LET I = I+1
35 860 READ XI
36 870 IF XI <> 1E38 THEN 850
37 880 LET N1 = I-1
38 890 LET N = N1-1
39 900 FOR I=1 TO 4
40 910 LET SI = 0
41 920 NEXT I
42 930 FOR I = 1 TO N1
43 940 LET Y1 = XI
44 950 LET Y2 = XI^2
45 960 LET Y3 = Y1*Y2
46 970 LET Y4 = Y2^2
47 980 FOR J=1 TO 4
48 990 LET SJ=SJ+YJ
49 1000 NEXT J
50 1010 NEXT I
51 1020 LET S = S1
52 1030 FOR I = 1 TO 4
53 1040 LET YI=1/N1*SI
54 1050 NEXT I
55 1060 LET S2 = Y2 - Y1^2
56 1070 LET S3 = Y3 - 3*Y1*Y2 + 2*Y1^3
57 1080 LET S4 = Y4 - 4*Y3*Y1 + 6*Y2*Y1^2 - 3*Y1^4
58 1090 LET Y2 = SQRS2
59 1100 LET Y3 = S3 / S2*Y2
60 1110 LET Y4 = S4/S2^2 - 3
61 1120 PRINT
62 1130 PRINT "S U M M A R Y S T A T I S T I C S"
63 1140 PRINT
64 1150 PRINT" NUMBER OF VARIATES =";N1
65 1160 PRINT" ARITHMETIC MEAN =";Y1
66 1170 PRINT" STANDARD DEVIATION =";Y2
67 1180 PRINT" VARIANCE =";S2
68 1190 PRINT" COEFF OF VAR PCT = ";FNR100*Y2/Y1
69 1200 PRINT" STANDARD SKEWNESS = ";FNRY3
70 1210 PRINT" STANDARD EXCESS = ";FNRY4
71 1220 PRINT
72 1230 PRINT
73 1240 REM SORT
74 1250 FOR I = 1 TO N
75 1260 FOR J = I+1 TO N1
76 1270 IF XI<XJ THEN 1310
77 1280 LET Y1=XI
78 1290 LET XI=XJ
79 1300 LET XJ=Y1
80 1310 NEXT J
81 1320 NEXT I
82 1330 PRINT"O R D E R S T A T I S T I C S"
83 1340 PRINT
84 1350 PRINT" SMALLEST VARIATE =";X1
85 1360 LET P1=10
86 1370 GOSUB 2360
87 1380 LET T1=P2
88 1390 PRINT" LOWER DECILE =";T1
89 1400 LET P1=25
90 1410 GOSUB 2360
91 1420 LET T2=P2
92 1430 PRINT" FIRST QUARTILE =";T2
93 1440 LET P1=50
94 1450 GOSUB 2360
95 1460 PRINT" MEDIAN =";P2
96 1470 LET P5=P2
97 1480 LET P1=75
98 1490 GOSUB 2360
99 1500 LET T3=P2
100 1510 PRINT" THIRD QUARTILE =";T3
101 1520 LET P1=90
102 1530 GOSUB 2360
103 1540 LET T4=P2
104 1550 PRINT" UPPER DECILE =";T4
105 1560 PRINT" LARGEST VARIATE =";XN1
106 1570 PRINT
107 1580 LET U=XN1-X1
108 1590 PRINT" TOTAL RANGE =";U
109 1600 PRINT" DECILE RANGE =";T4-T1
110 1610 PRINT" SEMI-QUARTILE RANGE =";T3-T2/2
111 1620 PRINT" BOWLEY'S SKEWNESS = ";FNRT3+T2-2*P5/T3-T2
112 1630 PRINT" PEARSON SKEWNESS = ";FNR3*Y1-P5/Y2
113 1640 PRINT
114 1650 PRINT
115 1660 PRINT
116 1670 LET D=ABSW2-W1
117 1680 IF D=0 THEN 2510
118 1690 LET Y1=W1-INTW1-X1/D+ 1.99999*D
119 1700 LET L=INTXN1-Y1+.00001/D+1
120 1710 IF L>50 THEN 2450
121 1720 FOR I=1 TO L+2
122 1730 LET CI=Y1+ I-1*D
123 1740 LET FI=0
124 1750 LET EI=0
125 1760 NEXT I
126 1770 PRINT" F R E Q U E N C Y D I S T R I B U T I O N"
127 1780 PRINT
128 1790 PRINT" UP TO BUT"," "," PERCENT"
129 1800 PRINT" FROM NOT INCLUDING FREQUENCY"," FREQUENCY"
130 1810 PRINT
131 1820 FOR I = 1 TO N1
132 1830 LET H=INT1+1E-8*XI-C1/D + 2
133 1840 LET FH=FH+1
134 1850 LET EH=EH+XI
135 1860 NEXT I
136 1870 LET J = 1
137 1880 LET J=J+1
138 1890 LET GJ=100*FJ/N1
139 1900 PRINT CJ-1,CJ,FJ,FNRGJ
140 1910 IF J=L+2 THEN 1930
141 1920 GOTO 1880
142 1930 FOR J = 3 TO L+1
143 1940 LET FJ=FJ-1+FJ
144 1950 LET GJ=100*FJ/N1
145 1960 LET EJ=EJ-1+EJ
146 1970 NEXT J
147 1980 PRINT
148 1990 PRINT
149 2000 PRINT" C U M U L A T I V E D I S T R I B U T I O N"
150 2010 PRINT
151 2020 PRINT" NUMBER LESS % LESS VARIATE SUM %"
152 2030 PRINT" VALUE THAN VALUE THAN VALUE LESS THAN VALUE"
153 2040 PRINT
154 2050 LET J = 1
155 2060 LET J=J+1
156 2070 LET EJ=100*EJ/S
157 2080 PRINT CJ,FJ,FNRGJ,FNREJ
158 2090 IF J=L+1 THEN 2110
159 2100 GOTO 2060
160 2110 PRINT
161 2120 PRINT
162 2130 PRINT"O R D E R E D A R R A Y"
163 2140 PRINT
164 2150 LET M=INTN1/4-.05+1
165 2160 LET H=4*M-1
166 2170 LET L=N1-H
167 2180 FOR I = 1 TO M-1
168 2190 LET K1=I+M
169 2200 IF L=1 THEN 2230
170 2210 LET K2=I+2*M
171 2220 GOTO 2240
172 2230 LET K2=I+2*M-1
173 2240 IF L-1*L-2=0 THEN 2270
174 2250 LET K3=I+3*M
175 2260 GOTO 2280
176 2270 LET K3=I+3*M-2/L
177 2280 PRINT XI,XK1,XK2,XK3
178 2290 NEXT I
179 2300 FOR I = 2 TO L+1
180 2310 PRINT XI-1*M,
181 2320 NEXT I
182 2330 PRINT
183 2340 STOP
184 2350 REM "SUBROUTINE"
185 2360 LET G5 = P1*N1+1/100
186 2370 LET P2 = X1
187 2380 IF G5<1 THEN 2440
188 2390 LET P2=XN1
189 2400 IF G5>N1 THEN 2440
190 2410 LET Q5 = INTG5
191 2420 LET H5=G5-Q5
192 2430 LET P2=H5*XQ5+1+1-H5*XQ5
193 2440 RETURN
194 2450 PRINT
195 2460 PRINT"INTERVAL IS TOO SMALL. MAXIMUM IS 50 CLASSES"
196 2470 PRINT"RESPECIFY L,U";
197 2480 INPUT W1,W2
198 2490 GOTO 1640
199 2510 END