SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1069|回复: 7
打印 上一主题 下一主题

Hotelling T在sas的那个过程中?

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2004-12-22 22:05:51 | 只看该作者

Hotelling T在sas的那个过程中?

RT
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2004-12-23 12:36:13 | 只看该作者

one example

[quote:79b97]DATA exp2_1;
INPUT id IgG IgA IgM group @@;
CARDS;
  1  1810   246   292   1           1  1654   196   243   2
  2  1744   213   286   1           2  1568   208   272   2
  3  1806   226   297   1           3  1743   214   276   2
  4  1712   238   265   1           4  1584   168   274   2
  5  1642   227   307   1           5  1649   242   289   2
  6  1685   260   246   1           6  1543   198   265   2
  7  1728   138   312   1           7  1624   212   288   2
  8  1695   196   266   1           8  1500   207   262   2
  9  1760   233   243   1           9  1340   179   259   2
10  1690   256   334   1          10  1454   196   296   2
11  1667   297   285   1          11  1453   209   263   2
12  1703   212   296   1          12  1564   223   274   2
13  1715   228   249   1          13  1644   237   260   2
14  1699   236   266   1          14  1543   205   262   2
15  1733   202   308   1          15  1684   197   288   2
;
PROC ANOVA;
CLASS id group;
MODEL IgG IgA IgM=id group;
MANOVA H=id group;
RUN;[/quote:79b97]
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
板凳
 楼主| 发表于 2004-12-23 13:50:13 | 只看该作者

hoho

三军医大的。呵呵,被我识破了。
我有同学在那里当老师,呵呵
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
地板
 楼主| 发表于 2004-12-23 16:50:25 | 只看该作者

识破什么啦?我可不是那里的。咱两互换过名片,忘了吗?

网上很多的,陈峰《医用多元统计分析》的部分例题SAS程序.
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
5#
 楼主| 发表于 2004-12-23 23:01:50 | 只看该作者

我是三军医大啊

我查了资料,知道了一些。SAS不专门提供Hotelling's T统计量的值,但它与hotelling-lawley trace统计量等价,转化公式为T=(n-1)×hotelling-lawley trace,这是对于单样本而言,n为样本的容量;对于双样本的比较T=(n1+n2-2)×hotelling-lawley trace,n1、n2分别为两个样本的容量。相应的F值都相同。
另外,我的确是三军医大啊,统计研究生
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
6#
 楼主| 发表于 2004-12-24 11:12:30 | 只看该作者

to collen

哥们,我是说发贴子的是三军医大的,呵呵
你我当然知道了。上次我去听讲座迟到了一会,所以只和你谈了一会。当然不会忘了。
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
7#
 楼主| 发表于 2004-12-29 04:36:18 | 只看该作者

Handout

This is from the handout of my course. Hope it is useful for you.

************************************************************;
* Hotelling T^2-test for two samples:
*
* Assume that we are given two d-dimensional VECTOR-VALUED samples
*
*   X1 X2 X3 ... Xm     where Xi are independent N(muX,Sigma)
*
*   Y1 Y2 Y3 ... Yn     where Yj are independent N(muY,Sigma)
*
* and we want to test
*
*   H0:muX=muY   for VECTOR-VALUED means muX and muY
*
* If d=1, we could try the classical 2-sample t-test, which uses the
* statistic
*
*   t = Root((mn/(m+n)) (Ybar-Xbar)/Root(s^2)    where
*
*   s^2 = (1/(m+n-2))(Sum_i (Xi-Xbar)^2 + Sum_j (Yj-Ybar)^ )
*
* Here s^2 is the POOLED VARIANCE of the two samples and Ybar and
* Xbar are the two sample means. The factor mn/(m+n) comes from the
* identity Var(Ybar-Xbar)=Var(Ybar)+Var(Xbar)=((1/n)+(1/m))sigma^2.
*
* Given H0:muX=muY and d=1, t has a Student's t distribution with
* L=m+n-2 degrees of freedom.
*
* For vector-valued data, a possible generalization of t (or t^2) is
* the quadratic form
*
*   T^2 = mn/(m+n) (Ybar-Xbar)'S^{-1}(Ybar-Xbar)   (*)
*
* where
*
*   S = (1/(m+n-2)) SumXY   for
*
*   SumXY = Sum (Xi-Xbar)(Xi-Xbar)' + Sum (Yj-Ybar)(Yj-Ybar)'
*
* Here S is the pooled covariance matrix of the two samples, which
* came up in discriminant analysis (dferns.sas), but T2 is a number.
* If d=1. T2=t^2. The dxd matrix S replaces s^2 in the univariate
* case.
*
* Exactly as in the univariate case, we can rotate Xi,Yj (more
* precisely, we rotate the rows of the nxd matrix X and the rows of
* the mxd matrix Y) so that
*
*   SumXY = Sum(k=1,k=L) Zk Zk'       (W)
*
* where L=m+n-2 and Z1,..ZL are independent N(0,Sigma).
*
* A random dxd matrix with the distribution (W) is said to have a
* WISHART DISTRIBUTION with parameters Sigma and L (symbolically,
* SumXY is W(Sigma,L)).
*
* Also as in the univariate case, the random vector
*
*   Q = Root(mn/(m+n)) (Ybar-Xbar)    is  N(muY-muX,Sigma)
*
* and is independent of the rotated Z1,Z2,...,ZL.  In general,
* if Q,Z1,Z2,..,ZL are independent N(0,Sigma), the random variable
*
*   T2 = Q'((1/L)(Sum(k=1,k=L) ZkZk'))^{-1}Q   (**)
*
* is said to have a HOTELLING T2 DISTRIBUTION (T2(d,L)). If d=1,
* note that this is the square of a Student-t distribution.
*
* Since N(0,Sigma) has the same distribution as Sigma^{1/2}N(0,I_d),
* the distribution of T2 in (**) does not depend on Sigma.
* (Exercise: Prove this.)
*
* Thus, given H0:muY=muX, The statistic T2 defined in (*) for the
* two d-dimensional samples Xi,Yj has distribution T2(d,m+n-2).
*
* Amazingly enough, if d<=L, T2(d,L) can be expressed in terms of
* F distributions:
*
*   T2(d,L) has the same distr. as  (L*d)/(L-d+1) F(d,L-d+1)
*
* This makes P-values for the Hotelling T^2 test easy to find. Note
* that if d=1 the right-hand side above reduces to F(1,L), which is
* the square of Student t distribution with L degrees of freedom.
* If d>L, the matrix in (W) cannot be invertible (Exercise: prove
* this), so that T2(d,L) cannot be defined if d>L.
*
* SAS NOTES FOR THE PROGRAM BELOW:
*  (1) `infile' says to read from a file, not from a datalines block
*     Add an explicit path to `infile' if needed.
*  (2) `firstobs' tells say to ignore the first `firstobs'-1 lines
*     of `infile', which are in fact comments in this case.
*  (3) `proc format' allows you to attach descriptive text to the
*     VALUES of a variable, while `label' does the same for the
*     NAMES of variables.
************************************************************;

proc glm;
     title3 'HOTELLING T^2 TEST FOR TWO LIZARD CLASSES';
     class Type;
     model lnMass lnSVL = Type / nouni;
     manova h = Type / printe;
     run;


OUTPUT:

                MANOVA Test Criteria and Exact F Statistics
               for the Hypothesis of No Overall Type Effect
                     H = Type III SSCP Matrix for Type
                           E = Error SSCP Matrix
                                      
                           S=1    M=0    N=27.5

Statistic                       Value   F Value   Num DF   Den DF   Pr > F

Wilks' Lambda              0.20266269    112.13        2       57   <.0001
Pillai's Trace             0.79733731    112.13        2       57   <.0001
[color=red:a1e9a]Hotelling-Lawley Trace     3.93430737    112.13        2       57   <.0001[/color:a1e9a]
Roy's Greatest Root        3.93430737    112.13        2       57   <.0001
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
8#
 楼主| 发表于 2004-12-29 04:40:17 | 只看该作者

BTW

BTW: I come from the medical school of Washington University in St. Louis.
I know little about SAS, but I'm studying it now.
Can we help each other?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-6-8 19:47 , Processed in 0.070097 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表