source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIXC.m@ 1042

Last change on this file since 1042 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1DIXC ;SFISC/GFT-DESCRIPTIVE STATS, CORRELATION MATRIX ;11:36 AM 12 Jul 1999;
2 ;;22.0;VA FileMan;**2**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4D N SZ,SZT,DJ,DN,DHDR,DS
5 D DESC G DESCX
6 ;
7C D CORR G CORRX
8 ;
9SQR S Y=0 Q:X'>0 S Y=1+X/2
10L S T=Y,Y=X/T+T/2 G L:Y<T
11 K T Q
12 ;
13DLCOR S DJ=IO(0),U="^",SZ=0
14 F SZT=1:1 S:$D(^DOSV(0,DJ,"CP",SZT)) SZ=SZT Q:'$D(^DOSV(0,DJ,0,SZT,"S")) Q:'$D(^DOSV(0,DJ,"F",SZT)) S DN(SZT)=$E($P(^(SZT),U,3),1,8)
15 S SZT=SZT-1 Q
16 ;
17DESC ;CALCULATE THE DESCRIPTIVE STATISTICS
18 D DLCOR K DS F I=1:1:SZT I $D(^DOSV(0,DJ,0,I,"Q")) S X=^("Q")-((^("S")*^("S"))/^("N"))/(^("N")) D SQR S ^("D")=Y
19 Q
20 ;
21DESCX ;PRINT DESCRIPTIVE STATS
22 K DHDR S DHDR="77CUST",DHDR(1)="DESCRIPTIVE STATISTICS" D DHDR^DIX G Q:POP,QUE:$D(IO("Q"))
23D1 D:SZT G KL:'$D(^DOSV(0,DJ,1))&'$D(^(2))&'$D(^(3)) D STATS^DIG($NA(^DOSV(0,DJ))) Q
24 .W !!,?13,"N OF",?39,"STANDARD"
25 .W !,?13,"CASES",?25,"MEAN",?39,"DEVIATION",?54,"MINIMUM",?69,"MAXIMUM"
26 .F I=1:1:SZT D
27 ..W !,DN(I),?10
28 ..I $D(^DOSV(0,DJ,0,I,"N")) W $J(^("N"),6) W:^("N") $J(^("S")/^("N"),15,4)
29 ..F X="D","L","H" W $S($D(^(X)):$J(^(X),15,4),1:$J("",15))
30 .D EOP^DIG Q
31 ;
32CORR ;CALCULATE THE CORRELATION MATRIX
33 K ^UTILITY($J),ERR I $O(^DOSV(0,IO(0),1))'>0 W !!,"***** AT LEAST TWO VARIABLES MUST BE DEFINED *****" S ERR=1 Q
34 D DLCOR ;F I=1:1:SZ I ^DOSV(0,IO(0),"BY",I,"H")=^("L") W $C(7),!,"CAN'T COMPUTE CORRELATION MATRIX--",DN(I+100)," IS SINGLE-VALUED" S ERR=1 G KL
35 F I=2:1:SZ S N=^DOSV(0,DJ,0,I,"N"),S=^("S"),C=^DOSV(0,DJ,"CP",I,I) F J=1:1:I-1 I $D(^DOSV(0,DJ,"CP",I,J)) D C1
36 G KL
37C1 S X=N*C-(S*S)*(N*^DOSV(0,DJ,"CP",J,J))-(^DOSV(0,DJ,0,J,"S")*^("S"))
38 D SQR S (^UTILITY($J,J,I),^UTILITY($J,I,J))=(N*^DOSV(0,DJ,"CP",I,J))-(S*^DOSV(0,DJ,0,J,"S"))/Y
39 Q
40CORRX ;OUTPUT THE CORRELATION MATRIX
41 G:$D(ERR) KL K DHDR S DHDR="72TSU",DHDR(1)="CORRELATION MATRIX",DHDR(2)="" D DHDR^DIX G Q:POP
42 F I=1:1:SZ S ^UTILITY($J,I,I)=1 I $D(^UTILITY($J,I,I)) W ?I*10-2,$J(DN(I),10)
43 F I=1:1:SZ I $D(^UTILITY($J,I,I)) W !,DN(I) F J=1:1:I I $D(^UTILITY($J,I,J)) W ?J*10,$J(^UTILITY($J,I,J),8,4)
44 W !!
45KL W:$E(IOST)'="C"&($Y) @IOF I IO(0)'=IO D CLOSE^DIO4
46Q U IO(0) K C,DHDR,I,II,J,JJ,N,POP,S,X,Y,Z,DJ,DN,SZ,SZT,DIFF
47 Q
48QUE ;
49 F I="DHDR*","^DOSV(0,$I,","SZT","DN*" S ZTSAVE(I)=""
50 S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL,ZTRTN="DQ^DIXC"
51 D ^%ZTLOAD G KL
52 ;
53DQ S DJ=$I D DQ^DIX G D1
Note: See TracBrowser for help on using the repository browser.