home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!gatech!paladin.american.edu!auvm!OREGON.BITNET!JOE
- X-Envelope-to: SAS-L@UGA.BITNET
- X-VMS-To: IN%"SAS-L@UGA"
- MIME-version: 1.0
- Content-transfer-encoding: 7BIT
- Message-ID: <01GQSA73SE4O8WX0EA@OREGON.UOREGON.EDU>
- Newsgroups: bit.listserv.sas-l
- Date: Thu, 5 Nov 1992 08:10:32 -0800
- Reply-To: Joe St Sauver <JOE@OREGON.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Joe St Sauver <JOE@OREGON.BITNET>
- Subject: Hoetellings T**2
- Lines: 86
-
- Date: 05 Nov 1992 15:34:00 -0500 (EST)
- From: "Michael R. Wechtaluk (607) 974-6569" <WECHTALUK_MR@CORNING.COM>
- Subject: Hotelling's T**2
-
- > Summary: Need a method for calculating Hotelling's T**2
-
- You can easily run a 1 sample Hoetellings T**2 using:
-
- PROC GLM;
- MODEL Y1 Y2 Y3 Y4=;
-
- however Hoetellings is also a nice "starter problem" to work through via
- PROC IML (assuming your site has SAS/IML). Sample SAS/IML code for that
- test, complete with a little sample dataset, appears below.
-
- I make no claim to the robustness of the SAS/IML solution shown for real,
- live, messy data (since this morning's unrelated project is to port some
- current SAS/IML code over to Mathematica for a user who has just recently
- learned that no, SAS/IML doesn't do all of its calculation in infinite
- precision and yes, roundoff/truncation/overflow are all nasty problems for
- some numerical procedures which looked so clean in matrix form, now aren't
- they?).
-
- Regards,
-
- Joe "We All Live in Arkansas Now" St Sauver (joe@oregon.uoregon.edu)
-
- hoetellings.sas follows --------------------------------------------------------
-
- data hypo;
- input u1 u2 u3 u4 @@;
- cards;
- 43 21 39 19
- ;
-
- data exprmnt;
- input x1 x2 x3 x4 @@;
- cards;
- 45 20 39 18 43 22 41 21 40 25 44 20 42 26 40 22 38 24 41 23
- 40 22 40 19 38 23 44 30 32 27 42 25 50 40 30 40 45 25 40 25
- 44 23 34 20 42 24 43 27 33 28 41 23 44 37 32 28 46 27 38 28
- 41 21 38 20 41 25 41 28 37 24 40 24 43 38 34 25 41 26 39 26
- 39 24 37 18 40 24 43 29 35 25 40 22 41 35 33 24 40 24 37 27
- ;
-
- proc iml;
- reset print; /* print the output of each operation */
-
- print "SAS PROC IML Hoetelling''s 1-Sample T**2 Test ....";
-
- use exprmnt; /* now read in the experimental data */
-
- print "X Matrix Follows ....";
- read all var _all_ into X;
-
- print "X Bar Follows ....";
- XBAR = X(|:,|);
-
- print "Expanded X Bar Follows ....";
- EXBAR = REPEAT(XBAR,NROW(X),1);
-
- print "S Follows ....";
- S = (X`*X) - (EXBAR`*EXBAR);
-
- print "Inverse S Follows ....";
- SINV = INV(S);
-
- use hypo; /* read in the hypothetical means */
-
- print "MU0 Follows ....";
- read all var _all_ into MU0;
-
- print "N Follows ....";
- N = NROW(X);
-
- print "P Follows ....";
- P = NCOL(X);
-
- print "T**2 Follows ....";
- T2 = N*(N-1)*(XBAR-MU0)*INV(S)*(XBAR-MU0)`;
-
- print "Adjusted T**2 Follows ....";
- ADJT2 = (N-P)/((N-1)*P)*T2;
-
- print "P of Obtaining (Adj T**2) > (Adj T**2 Actually Obtained) Follows ....";
- PROB = 1-PROBF(ADJT2,P,(N-P));
-