Estadística en Microcomputadores/Archivos BASIC/ESTAD2
10 ' ESTAD2 - Revision 6/11/88
21 GOSUB 1000
25 CHAIN "ESTAD"
200 ' EST91 Definicion de Variables
205 ' ---------------------------
210 GOSUB 500
215 IF NV=0 THEN 265
220 PRINT
225 KX=0 : GOSUB 730
255 INPUT " Definicion de Nuevas Variables ? (N) = ",A$
260 IF A$<>"S" AND A$<>"s" THEN RETURN
265 PRINT
270 K=0
273 IF KNV=0 THEN KNV=NC
275 WHILE K<=KNV-1
280 K=K+1 : NV=K
290 PRINT " Variable Nro.";K; : INPUT "= ",A$
295 IF LEN(A$)=0 AND K=1 THEN NV=0 : RETURN
300 IF LEN(A$)=0 THEN NV=K-1 : K=KNV : GOTO 320
305 J=VAL(A$)
310 IF J<1 OR J>NC THEN KE=4 : GOSUB 900 : GOTO 290
311 IF K=1 THEN 318
312 FOR M=1 TO K-1
313 IF J=JX(M) THEN PRINT CHR$(7) : PRINT :
INPUT "** VARIABLE REPETIDA",A$ : PRINT : GOTO 290
315 NEXT M
318 JX(K)=J
320 WEND
324 IF KDA=1 THEN JF=0 : KDA=0 : NX=NF : RETURN
325 PRINT
330 INPUT " Variable para Observaciones Agrupadas (No) = ",A$
335 IF LEN(A$)=0 THEN JF=0 : GOTO 350
340 JF=VAL(A$)
345 IF JF<1 OR JF>NC THEN KE=4 : GOSUB 900 : GOTO 330
347 IF JF=0 THEN NX=NF : RETURN
350 KE=0 : NX=0
355 FOR I=1 TO NF
370 ND=1 : IF JF>0 THEN ND=A(I,JF)
372 IF ND=XVF THEN 380
373 IF ND<0 THEN KE=1
375 NX=NX+ND
380 NEXT I
383 IF KE=1 THEN PRINT : PRINT CHR$(7) : PRINT "** VALOR <0 EN VARIABLE";JF; :
INPUT "",A$ : GOTO 325
385 RETURN
390 ' EST92 - Seleccion de Variable
395 ' ----------------------------
400 J=0
405 IF NC=0 OR KVA=1 THEN KVA=0 : GOTO 412
410 GOSUB 500
412 PRINT
415 INPUT " Posicion de Variable a utilizar = ",A$
420 IF LEN(A$)=0 THEN RETURN
425 X=VAL(A$)
430 IF X<1 OR X>NCM THEN KE=4 : GOSUB 900 : GOTO 415
435 IF LEN(TC$(X))=0 OR LEFT$(TC$(X),2)=" " THEN 455
440 PRINT : PRINT " Variable";X;" actual = ",TC$(X)
445 INPUT " Se utiliza ? (N) = ",A$
450 IF A$<>"S" AND A$<>"s" THEN 415
451 PRINT : INPUT " Borrado de Datos existentes ? (N) = ",A$
452 IF A$="S" OR A$="s" THEN FOR I=1 TO NFM : A(I,X)=0 : NEXT I
455 PRINT : PRINT " Nombre de la Variable";X; : INPUT " = ",A$
460 IF LEN(A$)=0 AND TC$(X)<>" " THEN 485
465 IF LEN(A$)=0 OR LEFT$(A$,8)=" " THEN 415
470 TC$(X)=LEFT$(A$,8)
485 IF NC<X THEN NC=X
490 J=X
495 RETURN
500 ' EST93 - Variables en memoria
505 ' ----------------------------
510 PRINT : PRINT " Variables en Memoria" : PRINT
515 I=1
520 FOR L=1 TO NC
525 IF LEFT$(TC$(L),2)=" " THEN 540
530 PRINT TAB(15*I-11);L;"-";TC$(L);
535 I=I+1 : IF I>5 THEN I=1 : PRINT
540 NEXT L
545 PRINT
550 RETURN
555 ' EST94 Encabezamiento Pantallas y Resultados
560 ' -------------------------------------------
565 IF DS$="SCRN:" THEN PRINT CHR$(12);
570 PRINT#3,"Proceso : ";TP$;TAB(70);DATE$
575 IF TSP$>"" THEN PRINT#3,TAB(11);TSP$ ELSE PRINT
577 A$=NA$ : IF NF=0 THEN A$="No hay Datos en Memoria"
580 PRINT#3,"Datos : ";A$;" - ";N$
583 IF JF>0 THEN PRINT#3,TAB(11);"Variable para Observaciones Agrupadas = ";
JF;"-";TC$(JF)
585 IF CD$>"" THEN PRINT#3,TAB(11);"Condicion de Seleccion = ";CD$
590 IF NX>0 THEN PRINT#3,TAB(11);"Numero de Observac.: ";
595 IF NX>0 THEN PRINT#3,"Totales =";NX;
597 IF NXX>0 THEN PRINT#3," / Consideradas =";NXX ELSE PRINT#3,
600 KA=1 : KB=79 : GOSUB 695
605 PRINT#3,
610 RETURN
650 ' EST95 Seleccion de Dispositivo de Salida
655 ' ----------------------------------------
660 CLOSE#3 : KS=0 : DS$="SCRN:"
665 PRINT : INPUT "Salida por Impresora/I/ o a un Archivo/Nombre/ (No) = ",A$
670 IF LEN(A$)=0 THEN OPEN DS$ FOR OUTPUT AS #3 : RETURN
673 KS=1 : DS$="LPT1:"
675 IF A$="i" OR A$="I" THEN OPEN DS$ FOR OUTPUT AS#3 : RETURN
680 DS$=A$
685 OPEN DS$+".TXT" FOR APPEND AS #3
690 RETURN
695 ' EST96 Subrayado
700 ' ---------------
705 PRINT#3,TAB(KA);
710 FOR S=KA TO KB : PRINT#3,TAB(S);"-"; : NEXT S : PRINT#3,
715 RETURN
730 ' EST97 - Variables definidas
735 ' ---------------------------
740 I=1
743 IF KX=0 THEN PRINT#3," Variables ya Definidas" : PRINT#3,
745 IF KX=1 THEN PRINT#3," Variables Consideradas" : PRINT#3,
750 FOR K=1 TO NV
755 J=JX(K)
760 PRINT#3,TAB(15*I-11);J;"-";TC$(J);
765 I=I+1 : IF I>5 THEN I=1 : PRINT#3,
770 NEXT K
773 PRINT#3, : PRINT#3, : KX=0
775 RETURN
900 ' EST99 - SUBRUTINA DE MENSAJES
905 ' -----------------------------
910 PRINT CHR$(7) : PRINT
911 IF KE=1 THEN INPUT "** NO HAY DATOS EN MEMORIA ",A$ : KE=0 : RETURN
912 IF KE=2 THEN INPUT "** NUMERO DE VARIABLES NO ADECUADO PARA EL PROCESO ",A$
- KE=0 : RETURN
915 IF KE=3 THEN INPUT "** NUMERO DE OBSERVAC.INSUFICIENTE PARA EL PROCESO ",A$
- KE=0 : RETURN
928 IF KE=9 THEN INPUT "** PROCESO NO ADECUADO A LOS DATOS CONSIDERADOS ",A$ :
KE=0 : RETURN
929 IF KE=4 THEN INPUT "** VARIABLE NO EXISTENTE O SIN DATOS ",A$ :
KE=0 : RETURN
930 IF KE=5 THEN PRINT "** VALOR ERRONEO - Debe ser ";B$ : INPUT " ",A$ :
KE=0 : RETURN
931 IF KE=6 THEN INPUT "** CAPACIDAD INSUFICIENTE DE MEMORIA DE TRABAJO",A$ :
KE=0 : RETURN
934 INPUT "Valor Erroneo ",A$
935 RETURN
936 IF ERR<>53 THEN PRINT CHR$(7) : PRINT
937 IF ERR<>53 THEN KE=KE+1 : IF KE>1 THEN RESUME 948
938 IF ERR=25 OR ERR=57 OR ERR=68 OR ERR=70 OR ERR=71 THEN PRINT "** DISPOSITIVO ";XDDA$;
" NO DISPONIBLE O ERROR E/S"; : INPUT " ",A$ : RESUME NEXT
939 IF ERR=61 THEN PRINT "** DISCO ";XDDA$;" LLENO" : INPUT " ",A$ : RESUME
940 IF ERR=53 THEN KAR=1 : RESUME NEXT
941 IF ERR=62 THEN PRINT "** FIN DE GRABACION O LECTURA EN DISP. ";XDDA$; : INPUT "
",A$ : RESUME NEXT
942 IF ERR=2 OR ERR=22 THEN PRINT "** ERROR DE SINTAXIS EN FUNCION "; : INPUT "O
CONDICION",A$ : RESUME NEXT
943 IF ERR=24 OR ERR=27 THEN INPUT "** PROBLEMA EN IMPRESORA",A$ : RESUME NEXT
944 IF ERR=64 OR ERR=75 OR ERR=76 THEN INPUT "** NOMBRE INCORRECTO ARCHIVO",A$ : RESUME
947 PRINT "Error";ERR;"en linea";ERL :STOP
948 CHAIN"ESTAD"
950 ' EST98 - Descripcion Archivo
952 ' ---------------------------
954 LD=0
956 IF MID$(A$,2,1)<>":" THEN XDDA$=DDA$+":" : GOTO 964
958 B$=LEFT$(A$,1)
960 'IF INSTR("ABCabc",B$)=0 THEN GOSUB 900 : RETURN
962 XDDA$="" : LD=2
964 B$=RIGHT$(A$,4)
966 IF LEFT$(B$,1)<>"." THEN EXT$=XA$ ELSE EXT$="" : LD=LD+4
968 'IF LEN(A$)-LD>8 THEN GOSUB 900
970 KAR=0 : KE=0
972 OPEN XDDA$+A$+EXT$ FOR INPUT AS#1
974 CLOSE#1
978 RETURN
980 ' EST9. - Presentacion Menu
982 ' -------------------------
983 PRINT : ISP=0 : A$=""
984 FOR K=1 TO KL
986 PRINT " ";K;"- ";TF$(K)
988 NEXT K
990 PRINT : PRINT "Opcion Elegida = "; : XX=CSRLIN : LOCATE XX,18,1
991 B$=INKEY$ : PRINT B$;
992 IF B$=CHR$(13) THEN 996
993 IF B$=CHR$(27) THEN A$="" : GOTO 996
994 A$=A$+B$ : GOTO 991
996 IF LEN(A$)=0 THEN RETURN
997 ISP=INT(VAL(A$))
998 IF ISP<1 OR ISP>KL THEN PRINT CHR$(7) : GOTO 983
999 RETURN
1000 ' EST2 - Analisis Descriptivo de Datos
1005 ' ------------------------------------
1010 DEFINT I-N
1015 COMMON ITE,NFM,NCM,A(),TC$(),NC,NF,NX,DDA$,NDE,NV,JX(),P(),DA$,NA$,CD$,
PAR1,PAR2,XVF
1020 ON ERROR GOTO 936
1025 DIM VX(NFM),VY(NFM),TF$(7),TG$(NCM),PM(NCM),DE(NCM),MX(2),IJ(2)
1030 DIM TI(PAR1+1,PAR2+1),TJ(PAR1+1,PAR2+1),TK(PAR1+1,PAR2+1)
1032 DIM VC(PAR1,2),NVC(2)
1035 DEF FNR(X,K)=INT(10^K*X+.5)/10^K
1036 NDD=NDE-1 : NDF=NDE+1
1037 AD$="." : FOR M=1 TO NDD : AD$=AD$+"#" : NEXT M
1038 AE$="." : FOR M=1 TO NDE : AE$=AE$+"#" : NEXT M
1039 AF$="." : FOR M=1 TO NDF : AF$=AF$+"#" : NEXT M
1040 CLOSE : DS$="SCRN:" : OPEN DS$ FOR OUTPUT AS#3
1045 WHILE KW=0
1050 TP$="ANALISIS DESCRIPTIVO DE DATOS" : TSP$=""
1053 NXX=0
1055 GOSUB 555
1060 PRINT TAB(70);FRE(0)
1065 PRINT "PROCESOS" : PRINT
1070 TF$(1)="Calculo de Estadisticas Descriptivas"
1075 TF$(2)="Clasificacion de Datos"
1080 TF$(3)="Calculo de Estadisticas de Datos Clasificados"
1085 TF$(4)="Graficacion de datos"
1090 TF$(5)="Manejo de Datos"
1095 KL=5 : GOSUB 980
1100 IF ISP=0 THEN RETURN
1105 IF ISP=5 THEN CHAIN "ESTAD1"
1110 IF NF=0 THEN KE=1 : GOSUB 900 : GOTO 1120
1115 ON ISP GOSUB 1125,1580,2130,5200
1120 WEND
1123 '
1125 ' EST21 - Calculo de Estadisticas Descriptivas
1130 ' --------------------------------------------
1135 TSP$="Calculo de Estadisticas Descriptivas"
1140 GOSUB 555
1141 PRINT " .Para Una Variable se calculan todas las Estadisticas" : PRINT
1142 PRINT " .Para Dos o mas Variables se calculan la Suma, Valor Medio,"
1143 PRINT " Desvio Estandar, Covariancias y Correlaciones"
1145 PRINT
1150 PRINT "DEFINICION DE VARIABLES (1 a";PAR2;")"
1155 KNV=PAR2 : GOSUB 200
1160 IF NV=0 THEN RETURN
1163 IF NV>KNV THEN KE=2 : GOSUB 900 : GOTO 1145
1165 PRINT : PRINT : PRINT TAB(25);"EN PROCESO"
1170 '
1175 WHILE NV=1
1180 J=JX(1)
1185 GOSUB 5480
1190 IF NXX<3 THEN KE=3 : KNM=3 : GOSUB 900 : RETURN
1195 GOSUB 5585
1200 KS=1
1205 WHILE KS=1
1210 GOSUB 555
1215 PRINT#3,"VARIABLE = ";J;" - ";TC$(J)
1220 PRINT#3,
1225 PRINT#3," Suma = ";SX
1230 PRINT#3," Valor Medio = ";FNR(PX,NDE)
1235 PRINT#3," Mediana = ";FNR(XMED,NDE)
1240 PRINT#3," Desvio Estandar Observac. = ";FNR(DEM,NDE)
1245 PRINT#3," Desvio Estandar Poblacion = ";FNR(DEX,NDE)
1250 PRINT#3," Valor Minimo / Maximo = ";XMI;" / ";XMA
1255 PRINT#3," Primer / Tercer Cuartil = ";FNR(PC,NDE);" / ";
FNR(TC,NDE)
1260 PRINT#3," Rango / Rango Intercuartil= ";(XMA-XMI);" / ";
FNR(TC-PC,NDE)
1265 PRINT#3," Coeficiente de Asimetria = ";FNR(AS,NDE)
1270 PRINT#3," Coeficiente de Curtosis = ";FNR(CU,NDE)
1280 IF PX>0 THEN
PRINT#3," Coefic.Variac.(Desv/V.Med)= ";FNR(DEX/PX,NDE)
1290 IF DEX>0 THEN
PRINT#3," Rango/Desvio Estd.Poblac. = ";FNR((XMA-XMI)/DEX,NDE)
1295 PRINT : GOSUB 650
1300 WEND
1305 RETURN
1310 WEND
1315 '
1320 WHILE NV>1
1325 GOSUB 5825
1327 IF NXX<3 THEN KE=3 : KNM=3 : GOSUB 900 : RETURN
1328 KS=1
1330 WHILE KS=1
1345 GOSUB 555
1350 PRINT#3, : PRINT#3," Variable Suma Observ.";
" Valor Medio Desvio Estd."
1355 FOR K=1 TO NV
1360 J=JX(K)
1365 KA=3 :KB=66 : GOSUB 695
1370 PRINT#3,TAB(3);J;"-"TC$(J);TAB(21);FNR(VX(K),NDE);TAB(37);
FNR(PM(K),NDE);TAB(53);FNR(DE(K),NDE)
1375 NEXT K
1380 KA=3 :KB=66 : GOSUB 695
1385 GOSUB 650
1390 WEND
1395 '
1400 WHILE KW=0
1405 GOSUB 555
1410 PRINT "RESULTADOS COMPLEMENTARIOS"
1415 TF$(1)="Matriz de Covariancias"
1420 TF$(2)="Matriz de Coeficientes de Correlacion"
1425 TF$(3)="Matriz de Signific.Coefic.Correlacion (%)"
1427 TF$(4)="Archivo con Coeficientes Correlacion"
1430 KL=4 : GOSUB 980
1435 IF ISP=0 THEN RETURN
1438 C$=TF$(ISP)
1440 IF ISP<4 THEN GOSUB 5974
1446 IF ISP=4 THEN KXX=2 : GOSUB 6560
1565 WEND
1570 WEND
1575 '
1580 ' EST22 - Clasificacion de Datos
1585 ' ------------------------------
1590 TSP$="Clasificacion de Datos"
1595 GOSUB 555
1605 PRINT "DEFINICION DE VARIABLES DE CLASIFICACION (1 o 2)"
1610 KNV=2 : GOSUB 200
1615 IF NV=0 THEN RETURN
1620 IF NV>2 THEN KE=2 : GOSUB 900 : GOTO 1595
1625 '
1630 PRINT : PRINT : PRINT "INGRESO VALORES DE CLASIFICACION"
1635 FOR K=1 TO NV
1640 J=JX(K)
1645 PRINT : PRINT " VARIABLE =";J;" - ";TC$(J)
1650 KX=0 : GOSUB 6010
1655 IF NVC(K)=0 THEN RETURN
1660 MX(K)=1
1665 NEXT K
1670 PRINT : PRINT : PRINT TAB(25);"EN PROCESO"
1675 '
1680 NVI=NV : KA=0
1685 GOSUB 6140
1690 IF NXX<2 THEN KE=3 : KNM=2 : GOSUB 900 : RETURN
1695 WHILE NVI=1
1700 KS=1 : IL=10
1705 WHILE KS=1
1710 GOSUB 555
1715 PRINT#3, : PRINT#3,"VARIABLE = ";JX(1);"-";TC$(JX(1))
1720 PRINT#3, : PRINT#3,TAB(3);"Valor Nro.Observ. % % Acum.";
1725 PRINT#3,TAB(38);"0%";TAB(57);"50%";TAB(75);"100%"
1730 KA=3 : KB=79 : GOSUB 695
1735 PRINT#3,TAB(38);"I";TAB(58);"I";TAB(78);"I"
1737 Y=0
1740 FOR M=MX(1) TO NVC(1)
1745 IF M=0 AND TI(M,1)=0 THEN 1780
1750 B$=">=" : IF M=0 THEN B$="< "
1755 IF MX(1)=1 THEN B$=" "
1760 X=TI(M,1)*100/NXX
1763 Y=Y+X
1764 PRINT#3,TAB(3);B$;VC(M,1);TAB(15);TI(M,1);TAB(20);
1765 PRINT#3,USING "###"+AD$;X; : PRINT#3,TAB(28);
1766 PRINT#3,USING "###"+AD$;Y;
1768 IF X=0 THEN PRINT#3,TAB(38);"."; : GOTO 1775
1770 PRINT#3,TAB(38);: FOR L=1 TO INT(X/2.5+.5) : PRINT#3,"*";: NEXT L
1775 IF Y>X THEN PRINT#3,TAB(INT(38.5+Y/2.5));"." ELSE PRINT#3,
1778 IL=IL+1 : IF IL=22 AND DS$="SCRN:" THEN IL=0 : INPUT "",A$
1780 NEXT M
1782 KA=3 : KB=79 : GOSUB 695
1785 GOSUB 650
1790 WEND
1795 NVI=0
1800 WEND
1805 '
1810 WHILE NVI=2
1815 PRINT : PRINT "TABULADOS OPTATIVOS"
1820 TF$(1)="En Numero de Observaciones"
1825 TF$(2)="En Numero de Observaciones (Estimado)"
1830 TF$(3)="En Porcentajes por Total"
1835 TF$(4)="En Porcentajes por Total (Estimados)"
1840 TF$(5)="En Porcentajes por Fila"
1845 TF$(6)="En Porcentajes por Columna"
1850 KL=6 : GOSUB 980
1855 KS=1 : IL=10
1860 IF ISP=0 THEN KS=0 : NVI=0
1865 WHILE KS=1
1870 GOSUB 555
1875 PRINT#3, : PRINT#3,"CLASIFICACION: ";TF$(ISP) : PRINT#3,
1880 KN=-1 : KP=9
1885 FOR L=0 TO NA STEP KP
1890 KM=KN+1 : KN=KM+KP-1
1895 IF KN>NA THEN KN=NA
1900 PRINT#3,TAB(3);"VAR.";JX(1);TAB(7*(KN-KM)/2+10);"VARIABLE";JX(2);"- ";
TC$(JX(2))
1905 PRINT#3,TAB(3);TC$(JX(1));
1910 FOR N=KM TO KN
1915 IF N=NA THEN PRINT#3,TAB(7*(N-KM)+16);"Total" : GOTO 1940
1920 B$=">=" : IF N=0 THEN B$=" <"
1925 IF MX(2)=1 THEN B$=" "
1927 IF N=0 AND TI(MA,N)=0 THEN 1935
1930 PRINT#3,TAB(7*(N-KM)+15);B$;VC(N,2);
1935 NEXT N
1937 PRINT#3,
1940 KA=3 : KB=7*(KN-KM)+21 : GOSUB 695
1945 FOR M=0 TO MA
1950 IF M=0 AND TI(M,NA)=0 THEN 2035
1955 B$=">=" : IF M=0 THEN B$="< "
1960 IF MX(1)=1 THEN B$=" "
1965 IF M<MA THEN PRINT#3,TAB(3);B$;VC(M,1); ELSE GOSUB 695:
PRINT#3,TAB(3);"Total";
1970 FOR N=KM TO KN
1975 IF N=0 AND TI(MA,N)=0 THEN 2030
1980 X=TI(M,N)
1985 IF ISP=2 OR IPC=4 THEN X=TI(MA,N)*TI(M,NA)/NXX
1990 IF ISP=3 AND TI(MA,NA)=0 THEN X=0 : GOTO 2025
1995 IF ISP=3 THEN X=100*X/TI(MA,NA)
2000 IF ISP=4 THEN X=100*X/NXX
2005 IF ISP=5 AND TI(M,NA)=0 THEN X=0 : GOTO 2025
2010 IF ISP=5 THEN X=100*X/TI(M,NA)
2015 IF ISP=6 AND TI(MA,N)=0 THEN X=0 : GOTO 2025
2020 IF ISP=6 THEN X=100*X/TI(MA,N)
2022 A$="#######" : IF ISP>1 THEN A$="#####.#"
2025 PRINT#3,TAB(7*(N-KM)+13); : PRINT#3,USING A$;X;
2030 NEXT N
2032 PRINT#3,
2033 IL=IL+1 : IF IL=22 AND DS$="SCRN:" THEN IL=0 : INPUT "",A$
2035 NEXT M
2036 KA=3 : KB=7*(KN-KM)+21 : GOSUB 695
2040 IF DS$="SCRN:" AND KN<NA THEN INPUT "Enter",A$ : PRINT#3,
2045 NEXT L
2050 GOSUB 650
2055 WEND
2060 WEND
2065 NVI=NV
2070 KZ=0
2075 WHILE KZ=0
2080 GOSUB 555
2085 PRINT "PROCESOS COMPLEMENTARIOS"
2090 TF$(1)="Verificacion Independencia Clasificacion"
2095 TF$(2)="Grabacion Archivo con Resultados Clasificacion"
2100 KL=2 : GOSUB 980
2105 IF ISP=0 THEN RETURN
2110 KXX=0 : ON ISP GOSUB 6350,6560
2115 WEND
2120 RETURN
2125 '
2130 ' EST23 - Calculo de Estadisticas de Datos Clasificados
2135 ' -----------------------------------------------------
2140 TSP$="Calculo de Estadisticas de Datos Clasificados"
2145 GOSUB 555
2155 PRINT "DEFINICION DE VARIABLES (2 o 3)"
2160 PRINT " Las Estadisticas se calculan para la ultima Variable"
2165 KNV=3 : GOSUB 200
2170 IF NV=0 THEN RETURN
2175 IF NV<2 OR NV>3 THEN KE=2 : GOSUB 900 : GOTO 2145
2185 JE=JX(NV)
2190 NVI=NV-1
2195 PRINT : PRINT : PRINT "INGRESO VALORES DE CLASIFICACION"
2200 FOR K=1 TO NVI
2205 J=JX(K)
2210 PRINT : PRINT " VARIABLE =";J;" - ";TC$(J)
2215 KX=0 : GOSUB 6010
2220 IF NVC(K)=0 THEN RETURN
2222 MX(K)=1
2225 NEXT K
2230 PRINT : PRINT : PRINT TAB(25);"EN PROCESO"
2235 '
2240 KA=1
2245 GOSUB 6140
2250 IF NXX<2 THEN KE=3 : KNM=2 : GOSUB 900 : RETURN
2255 KS=1
2260 WHILE KS=1
2265 GOSUB 555
2275 KX=0 : IL=7
2280 FOR N=0 TO NVC(2)+1
2281 IF N=0 AND TI(MA,N)=0 THEN 2435
2282 FOR M=0 TO NVC(1)+1
2283 IF M=0 AND TI(M,NA)=0 THEN 2420
2285 WHILE KX=0
2286 IF NVC(2)=0 THEN 2295
2288 B$=">=" : IF N=0 THEN B$="< "
2289 IF MX(2)=1 THEN B$=" "
2290 IF N<=NVC(2) THEN PRINT#3, : PRINT#3,TAB(3);"VARIABLE";JX(2);"- ";
TC$(JX(2));B$;VC(N,2) : PRINT#3,
2291 IF N>NVC(2) THEN PRINT#3, : PRINT#3,TAB(3);"TOTAL" : PRINT#3,
2295 PRINT#3," VARIABLE";TAB(28);"VARIABLE";JE;"- ";TC$(JE)
2297 PRINT#3,TAB(6);JX(1);"- ";TC$(JX(1));
2315 PRINT#3,TAB(23);"Nro Obs. Suma Obs. Valor Medio Desv.Estd."
2320 KA=6 : KB=69 : GOSUB 695
2325 IL=IL+5 : KX=1
2330 WEND
2360 NXC=TI(M,N)
2375 B$=">=" : IF M=0 THEN B$="< "
2380 IF MX(1)=1 THEN B$=" "
2385 IF M<=NVC(1) THEN PRINT#3,TAB(7);B$;VC(M,1);
ELSE PRINT#3," Total";
2390 CA=0 : IF NXC>0 THEN CA=TJ(M,N)/NXC
2395 CB=0 : IF NXC>1 THEN CB=SQR((TK(M,N)-NXC*CA^2)/(NXC-1))
2400 PRINT#3,TAB(24);NXC;TAB(34);FNR(TJ(M,N),NDE);TAB(47);
FNR(CA,NDE);TAB(58);FNR(CB,NDE)
2405 KA=6 : KB=69 : GOSUB 695 :IL=IL+2
2415 IF IL>21 AND DS$="SCRN:" THEN IL=5 : INPUT "",A$
2420 NEXT M
2425 IF NVC(2)=0 THEN N=1
2430 IF N<NVC(2)+1 AND DS$="SCRN:" THEN KX=0 : IL=7 : INPUT "Enter ",A$
2435 NEXT N
2440 GOSUB 650
2445 WEND
2450 PRINT : INPUT "Creacion Archivo Resultados ? (N) = ",A$
2455 IF A$="S" OR A$="s" THEN KXX=1 : GOSUB 6560
2460 RETURN
2465 '
2600 ' EST179 - Ordenamiento de un vector de valores
2605 ' ---------------------------------------------
2610 KM=INT(LOG(N)*(1!/.69314728#)+.00001)
2615 MM=N
2620 FOR NN=1 TO KM
2625 MM=INT(MM/2)
2630 K=N-MM
2635 FOR JJ=1 TO K
2640 I=JJ
2645 L=I+MM
2650 IF VX(L)>=VX(I) THEN 2675
2655 X=VX(I) : VX(I)=VX(L) : VX(L)=X
2660 X=VY(I) : VY(I)=VY(L) : VY(L)=X
2665 I=I-MM
2670 IF I>=1 THEN 2645
2675 NEXT JJ
2680 NEXT NN
2685 RETURN
2700 '
5200 ' EST24 - Graficacion
5205 ' -------------------
5210 TSP$="Graficacion"
5215 WHILE KW=0
5220 GOSUB 555
5222 PRINT "TIPO DE GRAFICACION"
5225 TF$(1)="Graficacion Normal"
5230 TF$(2)="Graficacion Codificada"
5235 KL=2 : GOSUB 980
5240 IF ISP=0 THEN RETURN
5245 KM=3 : IF ISP=2 THEN KM=1
5250 GOSUB 500
5255 PRINT
5260 FOR M=1 TO 2
5265 IF M>1 THEN 5305
5270 INPUT "Variable Independiente = ",A$
5275 IF LEN(A$)=0 THEN RETURN
5280 IF (A$="I" OR A$="i") THEN TG$(0)="Nro.Obs" : XMN(1)=0 : KX=0 :
XMX(1)=INT(NF/5+1)*5 : DEL(1)=XMX(1)/5 : GOTO 5460
5285 KX=VAL(A$) : J=KX
5288 IF J<1 OR J>NC OR TC$(J)=" " THEN KE=4 : GOSUB 900 :
PRINT : GOTO 5270
5290 GOSUB 5480
5293 IF NXX<1 THEN KE=3 : GOSUB 900 : RETURN
5295 XC=XMI : XD=XMA
5300 TG$(0)=TC$(KX) : GOTO 5380
5305 XC=1E+10 : XD=-1E+10
5310 PRINT
5315 FOR L=1 TO KM
5320 PRINT "Variable Dependiente";L;
5325 INPUT " = ",A$
5330 IF LEN(A$)=0 THEN NG=L-1 : L=KM : GOTO 5365
5335 NG=L
5340 JY(L)=VAL(A$) : J=JY(L)
5343 IF J<1 OR J>NC OR TC$(J)=" " THEN KE=4 : GOSUB 900 :
PRINT : GOTO 5320
5345 GOSUB 5480
5347 IF NXX<1 THEN KE=3 : GOSUB 900 : RETURN
5350 IF XMI<XC THEN XC=XMI
5355 IF XMA>XD THEN XD=XMA
5360 TG$(L)=TC$(JY(L))
5365 NEXT L
5370 IF NG=0 THEN RETURN
5375 PRINT
5377 A$="X" : IF M=2 THEN A$="Y"
5378 PRINT "ROTULACION DEL EJE ";A$
5380 PRINT " (Valores Maximo y Minimo de los Datos = ";XC;"-";XD;")"
5383 PRINT
5385 INPUT " Valor Minimo = ",A$
5390 IF LEN(A$)=0 THEN RETURN
5395 XMN(M)=VAL(A$)
5400 INPUT " Valor Maximo = ",A$
5405 IF LEN(A$)=0 THEN RETURN
5407 XMX(M)=VAL(A$)
5410 IF XMX(M)<=XMN(M) THEN KE=5 : B$=">"+STR$(XMN(M)) :
GOSUB 900 : PRINT : GOTO 5400
5415 INPUT " Intervalo = ",A$
5420 IF LEN(A$)=0 THEN RETURN
5425 DEL(M)=VAL(A$)
5430 IF DEL(M)>(XMX(M)-XMN(M)) THEN KE=5 : B$="<="+
STR$(XMX(M)-XMN(M)) : GOSUB 900 : PRINT : GOTO 5415
5435 IF ISP=1 OR M=1 THEN 5460
5440 PRINT : INPUT "Variable con Valores Codificados (No) = ",A$
5445 IF LEN(A$)=0 THEN ISP=1 : GOTO 5460
5450 IF A$="I" OR A$="i" THEN JV=0 : GOTO 5460
5455 JV=VAL(A$)
5457 IF JV<1 OR JV>NC OR TC$(JV)=" " THEN KE=4 : GOSUB 900 :
GOTO 5440
5460 NEXT M
5463 NPG=NF
5465 KA=0
5470 IF NG>0 THEN GOSUB 6745
5475 WEND
5477 '
5480 ' EST211 - Calculo de Valor Medio, Desv.Std.,Max.,Min.
5485 ' ----------------------------------------------------
5490 SX=0 : SCX=0 : NXX=0
5495 XMI=1E+10 : XMA=-1E+10
5500 FOR I=1 TO NF
5510 X= A(I,J)
5515 IF A(I,0)=1 OR X=XVF THEN 5550
5520 IF X<XMI THEN XMI=X
5525 IF X>XMA THEN XMA=X
5530 ND=1 : IF JF>0 THEN ND=A(I,JF)
5535 IF ND=XVF THEN 5550
5540 SX=SX+ND*X : SCX=SCX+ND*X^2
5545 NXX=NXX+ND
5550 NEXT I
5555 IF NXX<2 THEN RETURN
5560 PX=SX/NXX
5565 DEM=SQR((SCX-NXX*PX^2)/NXX)
5570 DEX=SQR((SCX-NXX*PX^2)/(NXX-1))
5575 RETURN
5580 '
5585 ' EST212 - Calculo de Mediana, Asimetria y Curtosis
5590 ' -------------------------------------------------
5595 N=0 : SCX=0 : AS=0 : CU=0
5600 FOR I=1 TO NF
5610 X=A(I,J)
5615 IF A(I,0)=1 OR X=XVF THEN 5645
5620 ND=1 : IF JF>0 THEN ND=A(I,JF)
5625 IF ND=XVF THEN 5645
5630 N=N+1 : VX(N)=X : VY(N)=I
5632 SCX=SCX+ND*(X-PX)^2
5635 AS=AS+ND*(X-PX)^3
5640 CU=CU+ND*(X-PX)^4
5645 NEXT I
5650 IF N<3 THEN RETURN
5655 AS=SQR(N)*AS/SCX^(1.5)
5660 CU=N*CU/SCX^2-3
5665 GOSUB 2600
5670 FOR M=1 TO 3
5672 PM(M)=M*(NXX+1)/4
5674 NEXT M
5676 FOR M=1 TO 3
5677 KX=PM(M)
5678 XX=PM(M)-KX
5679 IF JF=0 THEN XA=VX(KX) : XB=VX(KX+1) : GOTO 5686
5680 NXA=0
5681 FOR I=1 TO N
5682 NXA=NXA+A(VY(I),JF)
5683 IF NXA=KX THEN XA=VX(I) : XB=VX(I+1) : I=N
5684 IF NXA>KX THEN XA=VX(I) : XB=VX(I) : I=N
5685 NEXT I
5686 PM(M)=(1-XX)*XA+XX*XB
5687 NEXT M
5688 PC=PM(1) : XMED=PM(2) : TC=PM(3)
5690 RETURN
5727 '
5825 ' EST213 - Calculo de Matriz de Covariancias
5830 ' ------------------------------------------
5835 FOR K=1 TO NV
5840 PM(K)=0
5845 FOR L=1 TO K : TI(K,L)=0 :NEXT L
5850 NEXT K
5855 NXX=0
5860 FOR I=1 TO NF
5865 IF A(I,0)=1 THEN 5945
5870 ND=1 : IF JF>0 THEN ND=A(I,JF)
5875 IF ND=XVF THEN 5945
5880 KE=0
5885 FOR K=1 TO NV
5890 VX(K)=A(I,JX(K))
5895 IF VX(K)=XVF THEN KE=1 : K=NV
5900 NEXT K
5905 IF KE=1 THEN 5945
5910 FOR K=1 TO NV
5915 PM(K)=PM(K)+VX(K)*ND
5920 FOR L=1 TO K
5925 TI(K,L)=TI(K,L)+VX(K)*VX(L)*ND
5930 NEXT L
5935 NEXT K
5940 NXX=NXX+ND
5945 NEXT I
5950 IF NXX<2 THEN RETURN
5955 FOR K=1 TO NV
5960 VX(K)=PM(K)
5962 PM(K)=PM(K)/NXX
5964 DE(K)=SQR((TI(K,K)-NXX*PM(K)^2)/(NXX-1))
5966 FOR L=1 TO K
5968 TI(K,L)=(TI(K,L)-NXX*PM(K)*PM(L))/(NXX-1)
5970 TI(L,K)=TI(K,L)
5971 NEXT L,K
5972 RETURN
5973 '
5974 ' EST214 - Salida Covar. y Coef.Correlac.
5975 ' ---------------------------------------
5976 KS=1 : IL=10
5977 WHILE KS=1
5978 PRINT#3, : PRINT#3, : PRINT#3,C$
5979 PRINT#3, : KN=0 : KP=5 : KES=12 : IF ISP>1 THEN KP=7 : KES=8
5981 FOR M=1 TO NV STEP KP
5982 KM=KN+1 : KN=KM+KP-1
5983 IF KN>NV THEN KN=NV
5984 PRINT#3,"Variable";
5985 FOR K=KM TO KN : PRINT#3,TAB(KES*(K-KM+1)+12);JX(K); : NEXT K
5986 PRINT#3, : PRINT#3,
5987 FOR KT=1 TO KN : KST=KM : IF KT>=KM THEN KST=KT
5988 PRINT#3,TAB(3);JX(KT);TAB(7);"-";TC$(JX(KT));
5989 FOR L=KST TO KN
5990 CA=1 : IF ISP>1 THEN CA=DE(KT)*DE(L)
5991 IF CA>0 THEN X=TI(L,KT)/CA : TJ(L,KT)=X ELSE X=0
5992 IF ISP<3 THEN 5998
5993 IF X>.9999 THEN X=0 : GOTO 5998
5994 X=ABS(X*SQR((NXX-2)/(1-X*X)))
5995 P(1)=NXX-2
5996 IP=1 : GOSUB 8800
5997 X=200*(1-FP)
5998 A$="########"+AE$ : IF ISP=2 THEN A$="###"+AE$
5999 IF ISP=3 THEN A$="###"+AD$
6000 PRINT#3,TAB(KES*(L-KM)+17); : PRINT#3,USING A$;X;
6001 NEXT L
6002 PRINT#3, : IL=IL+1 : IF IL=22 AND DS$="SCRN:" THEN IL=0 : INPUT "",A$
6003 NEXT KT
6004 IF KN<NV AND DS$="SCRN:" THEN PRINT : INPUT "Enter ",A$ : PRINT#3,
6005 NEXT M
6006 GOSUB 650
6007 WEND
6008 RETURN
6009 '
6010 ' EST221 - Ingreso de Valores de Clasificacion
6015 ' --------------------------------------------
6017 IJ(1)=PAR1 : IJ(2)=PAR2
6020 IF NVC(K)=0 THEN 6045
6025 PRINT : PRINT " Valores Actuales" : PRINT TAB(4);
6030 FOR M=1 TO NVC(K) : PRINT VC(M,K);" - "; : NEXT M : PRINT
6035 PRINT : INPUT " Ingreso de Nuevos Valores ? (N) = ",A$
6040 IF A$<>"S" AND A$<>"s" THEN VC(0,K)=VC(1,K) : RETURN
6044 NVC(K)=0
6045 KW=0
6046 WHILE KW=0
6047 IF KX=1 THEN 6060
6050 GOSUB 5480
6055 PRINT " (Valores Maximo y Minimo de los Datos = ";XMI;"-";XMA;")"
6060 IF NVC(K)=0 THEN PRINT
6063 KE=0
6064 WHILE KE=0
6065 INPUT " Valor = ",A$
6070 IF LEN(A$)=0 THEN VC(0,K)=VC(1,K) : RETURN
6075 XB=VAL(A$)
6080 IF NVC(K)>0 AND XB<=X THEN KE=5 : B$=">="+STR$(X) :
GOSUB 900 : PRINT : GOTO 6065
6085 IF NVC(K)=0 THEN 6130
6090 INPUT " Incremento para obtener Valores intermedios (No) = ",A$
6091 PRINT
6093 IF LEN(A$)=0 THEN DI=0 : GOTO 6130
6095 DI=VAL(A$)
6100 IF DI<0 OR DI>XB-X THEN KE=5 : B$=">0 y <="+STR$(XB-X) :
GOSUB 900 : PRINT : GOTO 6090
6110 WHILE DI>0 AND X+DI<XB-.000001
6115 X=X+DI
6120 NVC(K)=NVC(K)+1
6121 IF NVC(K)>IJ(K)-1 THEN DI=0 : GOTO 6125
6122 VC(NVC(K),K)=X
6125 WEND
6130 NVC(K)=NVC(K)+1
6131 IF NVC(K)>IJ(K) THEN KE=5 : B$="Numero de Valores <= Parametro2 ("
+STR$(IJ(K))+")" : GOSUB 900 : KE=1 : NVC(K)=0 : GOTO 6133
6132 VC(NVC(K),K)=XB : X=XB
6133 WEND
6135 WEND
6140 ' EST222 - Clasificacion
6145 ' ----------------------
6150 IF NVI=1 THEN NVC(2)=0 : IJ(2)=0
6155 FOR M=0 TO NVC(1)+1
6160 FOR N=0 TO NVC(2)+1
6165 TI(M,N)=0
6170 IF KA>0 THEN TJ(M,N)=0 : TK(M,N)=0
6175 NEXT N,M
6180 NXX=0
6185 FOR I=1 TO NF
6190 IF A(I,0)=1 THEN 6300
6195 ND=1 : IF JF>0 THEN ND=A(I,JF) : IF ND=XVF THEN 6300
6200 IF ND=XVF THEN 6300
6205 KE=0
6210 FOR K=1 TO NVI
6215 VX(K)=A(I,JX(K))
6220 IF VX(K)=XVF THEN KE=1 : K=NV
6225 NEXT K
6230 IF KE=1 THEN 6300
6235 FOR K=1 TO NVI
6240 IJ(K)=NVC(K)
6245 FOR M=1 TO NVC(K)
6250 IF VX(K)<VC(M,K) THEN IJ(K)=M-1 : MX(K)=0 : M=NVC(K)
6255 IF VX(K)=VC(M,K) THEN IJ(K)=M : M=NVC(K)
6260 NEXT M
6265 NEXT K
6270 IF KA=1 THEN X=A(I,JE) : IF X=XVF THEN 6300
6275 TI(IJ(1),IJ(2))=TI(IJ(1),IJ(2))+ND
6280 IF KA=0 THEN 6295
6285 TJ(IJ(1),IJ(2))=TJ(IJ(1),IJ(2))+ND*X
6290 TK(IJ(1),IJ(2))=TK(IJ(1),IJ(2))+ND*X*X
6295 NXX=NXX+ND
6300 NEXT I
6305 MA=NVC(1)+1 : NA=NVC(2)+1
6310 FOR M=0 TO NVC(1)
6315 FOR N=0 TO NVC(2)
6320 TI(M,NA)=TI(M,NA)+TI(M,N)
6325 TI(MA,N)=TI(MA,N)+TI(M,N)
6327 TI(MA,NA)=TI(MA,NA)+TI(M,N)
6328 IF KA=0 THEN 6335
6329 TJ(M,NA)=TJ(M,NA)+TJ(M,N)
6330 TJ(MA,N)=TJ(MA,N)+TJ(M,N)
6331 TJ(MA,NA)=TJ(MA,NA)+TJ(M,N)
6332 TK(M,NA)=TK(M,NA)+TK(M,N)
6333 TK(MA,N)=TK(MA,N)+TK(M,N)
6334 TK(MA,NA)=TK(MA,NA)+TK(M,N)
6335 NEXT N,M
6340 RETURN
6345 '
6350 ' EST223 - Verificacion de Independencia de la Clasificacion
6355 ' ----------------------------------------------------------
6360 CHI=0 : KM=0 : KN=0 : KG=0
6365 NVX=NV
6370 WHILE NVX=1
6375 X=NXX/NVC(1) : KM=NVC(1)
6377 IF X<5 THEN KG=1
6380 FOR M=1 TO NVC(1)
6385 CHI=CHI+(TI(M,1)-X)^2/X
6390 NEXT M
6395 IGL=KM : NVX=0
6400 WEND
6405 WHILE NVX=2
6410 FOR M=0 TO NVC(1)
6415 IF TI(M,NA)=0 THEN 6450
6420 KM=KM+1
6425 FOR N=0 TO NVC(2)
6430 IF TI(MA,N)=0 THEN 6445
6435 X=TI(MA,N)*TI(M,NA)/NXX
6437 IF X<5 THEN KG=1
6440 CHI=CHI+(TI(M,N)-X)^2/X
6445 NEXT N
6450 NEXT M
6455 FOR N=0 TO NVC(2)
6460 IF TI(MA,N)>0 THEN KN=KN+1
6465 NEXT N
6470 IGL=(KM-1)*(KN-1)
6475 NVX=0
6480 WEND
6483 '
6485 KS=1
6490 WHILE KS=1
6495 CLS : PRINT#3,
6497 PRINT#3,"VERIFICACION DE INDEPENDENCIA DE LA CLASIFICACION"
6500 PRINT#3,
6505 PRINT#3," Chi^2 = ";FNR(CHI,NDE)
6510 PRINT#3," Grados de Libertad = ";IGL
6515 IF IGL<1 THEN PRINT#3," Grados de Libertad < 1" : RETURN
6520 P(1)=IGL
6525 IP=1 : X=CHI : GOSUB 8704
6530 PRINT#3,
6535 PRINT#3," Nivel de Significacion de Chi^2 = ";FNR((1-FP)*100,2);"%"
6537 IF KG=1 THEN PRINT#3," (Hay Grupos con Frecuencias Esperadas < 5)"
6540 PRINT : GOSUB 650
6545 WEND
6550 RETURN
6555 '
6560 ' EST224 - Creacion de Archivo con Resultados
6565 ' -------------------------------------------
6570 GOSUB 555
6575 XA$=".EST"
6577 KAR=0 : PRINT : PRINT "Archivos en Disco ";DDA$
6578 PRINT : FILES DDA$+":*"+XA$
6579 IF KAR=1 THEN PRINT " No Existen" : KAR=0
6580 PRINT: PRINT "Nombre del Archivo a Grabar (";DDA$;":---";XA$; : INPUT ") =
6585 IF LEN(A$)=0 THEN RETURN
6590 KE=0
6595 GOSUB 950
6597 XNA$=A$
6598 IF KAR=0 THEN PRINT : INPUT "Archivo Existente - Se Reemplaza ? (N) = ",A$
6599 IF KAR=0 AND (A$<>"S" AND A$<>"s") THEN 6580
6600 IF KE=1 THEN 6580
6605 OPEN XDDA$+XNA$+EXT$ FOR OUTPUT AS #1
6607 WHILE KXX=0 OR KXX=1
6610 IF KXX=0 THEN PRINT#1,"Resultados Clasificacion"
6615 IF KXX=1 THEN PRINT#1,"Resultados Estadisticas Datos Clasificados"; "
Variable ";TC$(JX(NV))
6620 KM=NVC(1) : IF TI(0,NA)>0 THEN KM=MA
6625 KN=NVC(2) : IF TI(MA,0)>0 THEN KN=NA
6630 PRINT#1,KM*KN,NVI+2+KXX
6635 PRINT#1,TC$(JX(1))
6640 IF NVI=2 THEN PRINT#1,TC$(JX(2))
6645 IF KXX=0 THEN PRINT#1,"NumObs" : PRINT#1,"PorcObs"
6650 IF KXX=1 THEN PRINT#1,"NumObs" : PRINT#1,"ValMed" : PRINT#1,"DesvEst"
6655 FOR M=0 TO NVC(1)
6660 IF M=0 AND TI(M,NA)=0 THEN 6725
6665 XA=VC(M,1) : IF M=0 THEN XA=-1E+10
6670 FOR N=0 TO NVC(2)
6675 IF N=0 AND TI(MA,N)=0 THEN 6720
6680 XB=VC(N,2) : IF N=0 THEN XB=-1E+10
6685 XC=TI(M,N)
6690 IF KXX=0 THEN XD=FNR(100*XC/TI(MA,NA),2)
6695 IF KXX=1 THEN IF XC>0 THEN XD=TJ(M,N)/XC ELSE XD=0
6700 IF KXX=1 THEN IF XC>1 THEN XE=SQR((TK(M,N)-XC*XD^2)/(XC-1))
ELSE XE=0
6705 PRINT#1,XA; : IF NVI=2 THEN PRINT#1,XB;
6710 PRINT#1,XC;XD;
6715 IF KXX=1 THEN PRINT#1,XE ELSE PRINT#1,
6720 NEXT N
6725 NEXT M
6726 KXX=-1
6727 WEND
6728 WHILE KXX=2
6729 PRINT#1,"Coeficientes de Correlacion"
6730 PRINT#1, NV*(NV-1)/2,3
6731 PRINT#1,"Var1" : PRINT#1,"Var2" : PRINT#1,"CoefCorr"
6732 FOR K=1 TO NV-1
6733 FOR L=K+1 TO NV
6734 CA=DE(K)*DE(L)
6735 IF CA>0 THEN X=TI(L,K)/CA ELSE X=0
6736 PRINT#1,K;L;X
6737 NEXT L,K
6738 KXX=0
6739 WEND
6740 CLOSE#1
6741 PRINT : INPUT "Grabacion Terminada - Enter ",A$
6742 RETURN
6743 '
6745 ' EST241 - Proceso de Graficacion
6750 ' -------------------------------
6755 DEF FNC(X)=60*(X-XMN(1))/(XMX(1)-XMN(1))
6760 DEF FNF(X)=20*(X-XMN(2))/(XMX(2)-XMN(2))
6765 CLS
6770 X=21-FNF(0) : KC=0
6775 IF X>0 AND X<21 THEN KC=1
6780 FOR I=1 TO 60
6785 IF KC=1 THEN LOCATE X,I+20 : PRINT "."
6790 LOCATE 1,I+20 : PRINT "-"
6795 LOCATE 21,I+20 : PRINT "-"
6800 NEXT I
6805 FOR X=XMN(1) TO XMX(1) STEP DEL(1)
6810 XC=FNC(X)
6815 LOCATE 1,XC+20 : PRINT "+"
6820 LOCATE 21,XC+20 : PRINT "+"
6825 IF X<XMX(1) THEN LOCATE 22,XC+18 : PRINT FNR(X,2)
6830 NEXT X
6835 LOCATE 23,70 : PRINT TG$(0)
6840 X=FNC(0)+20 : KC=0
6845 IF X>20 AND X<80 THEN KC=1
6850 FOR I=1 TO 20
6855 IF KC=1 THEN LOCATE I,X : PRINT "."
6860 LOCATE I,20 : PRINT CHR$(124)
6865 LOCATE I,80 : PRINT CHR$(124)
6870 NEXT I
6875 FOR X=XMN(2) TO XMX(2) STEP DEL(2)
6880 XF=21-FNF(X)
6885 LOCATE XF,20 : PRINT "+"
6890 LOCATE XF,80 : PRINT "+"
6895 LOCATE XF,13 : PRINT FNR(X,2)
6900 NEXT X
6905 TF$(1)="*" : TF$(2)="+" : TF$(3)="x"
6910 IF KTG=2 THEN C$="ABCDEFGHIJKLMNOPQRTSUVWXYZ"
6915 FOR J=1 TO NG
6920 LOCATE 3+3*J,1 : IF KTG=1 THEN PRINT TF$(J)
6925 PRINT TG$(J)
6930 NEXT J
6935 IF KTG=2 THEN PRINT : PRINT : PRINT "Var.Codif=" : PRINT JV;" - ";TC$(JV)
6940 NXX=0
6945 FOR I=1 TO NPG
6950 IF KA=0 THEN IF A(I,0)=1 THEN 7105
6955 IF KX=0 THEN X=I : GOTO 6975
6960 IF KA=0 THEN X=A(I,KX)
6965 IF KA=0 AND X=XVF THEN 7105
6970 IF KA=1 THEN X=TI(I,0)
6975 XC=FNC(X)+20
6980 IF XC<20 OR XC>80 THEN 7100
6985 FOR J=1 TO NG
6990 IF KA=0 THEN Y=A(I,JY(J))
6995 IF KA=0 AND Y=XVF THEN 7105
7000 IF KA=1 THEN Y=TI(I,JY(J))
7005 YF=21-FNF(Y)
7010 IF YF<1 OR YF>21 THEN 7090
7015 FOR XF=YF TO 21
7020 LOCATE XF,XC
7025 A$=TF$(J)
7030 IF KTG=1 THEN 7075
7035 IF JV>0 THEN X=A(I,JV)
7040 IF JV>0 AND X=XVF THEN XF=21 : GOTO 7085
7045 IF JV>0 THEN X=INT(X)
7050 IF JV=0 THEN X=I
7055 IF X<0 THEN A$="-"
7060 IF X>=0 AND X<10 THEN A$=STR$(X)
7065 IF X>=10 AND X<35 THEN A$=MID$(C$,X-9,1)
7070 IF X>35 THEN A$="+"
7075 PRINT A$
7080 IF KB(J)=0 THEN XF=21
7085 NEXT XF
7090 NEXT J
7095 NXX=NXX+1
7100 LOCATE 23,1
7105 NEXT I
7107 IF KB(1)=0 AND KA=0 THEN LOCATE 2 : PRINT "Nro.Observ." : PRINT "
Tot. :";NF : PRINT " Graf.:";NXX
7110 LOCATE 24 : INPUT "Enter ",A$
7115 RETURN
8140 ' EST302 - Dist.Normal
8144 '
8148 XMU=P(1) : SIG=P(2)
8152 ON IP GOTO 8156,8196,8208
8156 U=(X-XMU)/SIG
8160 MXA=0 : IF U<0 THEN U=-U : MXA=1
8164 FD=.39894228#*EXP(-U*U/2)
8168 C=1/(1+.2316419*U)
8172 FP=FD*C*(.3193815+C*(-.3565638+C*(1.781478+C*(-1.821256+1.330274*C))))
8176 IF MXA=0 THEN FP=1-FP
8180 IF FP>1 THEN FP=1
8184 IF FP<0 THEN FP=0
8188 FD=FD/SIG
8192 RETURN
8196 IF KF(1)=1 THEN P(1)=PX
8200 IF KF(2)=1 THEN P(2)=DEX
8204 RETURN
8208 X=SIG*SQR(-2*LOG(RND))*COS(6.283185*RND)+XMU
8212 RETURN
8216 '
8704 ' EST307 - Dist.Chi^2
8708 '
8712 K=P(1)
8716 ON IP GOTO 8720,8768,8780
8720 XMU=K : SIG=SQR(2*K)
8724 IF X=0 AND K=1 THEN FD=1E+30 : FP=0 : RETURN
8728 IF X=0 AND K=2 THEN FD=.5 : FP=0 : RETURN
8732 IF X<=0 THEN FD=0 : FP=0 : RETURN
8736 XA=X : X=(X/K)^(1/3)
8740 P(1)=1-2/9/K : P(2)=SQR(2/9/K)
8744 GOSUB 8140
8748 XN=(K/2-1) : GOSUB 9860
8752 FD=EXP((K/2-1)*LOG(X)-X/2-.3465735*K-FA)
8756 X=XA : P(1)=K
8760 XMU=K : SIG=SQR(2*K)
8764 RETURN
8768 IF KF(1)=1 THEN P(1)=INT(PX+.5)
8772 IF P(1)<1 THEN P(1)=1
8776 RETURN
8780 P(1)=1-2/9/K : P(2)=SQR(2/9/K)
8784 GOSUB 8140
8788 X=(K*X)^3 : P(1)=K
8792 RETURN
8796 '
8800 ' EST308 - Distribucion t
8804 K=P(1)
8808 ON IP GOTO 8812,8896,8908
8812 WHILE K>0 AND K<250
8816 XN=(K-1)/2 : GOSUB 9860 : FD=FA
8820 XN=(K-2)/2 : GOSUB 9860 : FD=FD-FA
8824 FDZ=EXP(FD-.5*LOG(3.14159265#*K)-.5*(K+1)*LOG(1+X*X/K))
8828 'IF X=0 THEN FP=.5 : FD=FDZ : RETURN
8832 XA=X : Y=X*X
8836 XKA=SQR((2/9/K)*Y^(2/3)+2/9)
8840 U=((1-2/9/K)*(Y^(1/3))-7/9)/XKA
8844 X=U : P(1)=0 : P(2)=1 : GOSUB 8140
8848 X=XA : P(1)=K
8852 FP=.5+.5*FP
8856 IF X<0 THEN FP=1-FP
8860 FD=FDZ : K=0
8864 WEND
8868 WHILE K>=250
8872 P(1)=0 : P(2)=1 : GOSUB 8140
8876 P(1)=K : K=0
8880 WEND
8884 K=P(1) : XMU=0
8888 SIG=0 : IF K>2 THEN SIG=SQR(K/(K-2))
8892 RETURN
8896 IF KF(1)=1 THEN P(1)=INT(2*DEX^2/(DEX^2-1)+.5)
8900 IF KF(1)=1 AND P(1)<3 THEN P(1)=3
8904 RETURN
8908 P(1)=0 : P(2)=1 : GOSUB 8140
8912 U=X : P(1)=K
8916 GOSUB 8704
8920 X=U/SQR(X/K)
8924 RETURN
9856 '
9860 ' EST320 - Calculo de Log(Factorial)
9864 '
9868 WHILE XN>=-.5 AND XN<=4 AND INT(2*XN)=2*XN
9872 IF XN=-.5 THEN FA=.57236494#
9876 IF XN=0 THEN FA=0
9880 IF XN=.5 THEN FA=-.12078224#
9884 IF XN=1 THEN FA=0
9888 IF XN=1.5 THEN FA=.28468287#
9892 IF XN=2 THEN FA=.693147181#
9896 IF XN=2.5 THEN FA=1.2009736#
9900 IF XN=3 THEN FA=1.79175947#
9904 IF XN=3.5 THEN FA=2.45373657#
9908 IF XN=4 THEN FA=3.17805383#
9912 RETURN
9916 WEND
9920 Y=1/(XN*XN)
9922 XX=Y*(1/1260-Y/1680)
9924 Y=(XN+.5)*LOG(XN)-XN*(1-Y*(1/12-Y*(1/360-XX)))
9928 FA=Y+.91893853#
9932 RETURN
9999 '