SAS中文论坛

标题: 请问如何用SAS画 scaled t distribution of means? [打印本页]

作者: shiyiming    时间: 2008-9-28 14:24
标题: 请问如何用SAS画 scaled t distribution of means?
图形请见下图.

大概原理:

假设 小组均值y1, y2,...yn 服从t 分布,自由度n-1, 位置参数(mu)为mean(y), 峰度(sigma)为sqrt(Mse/n). 要在图上画出y1,...yn点的位置(x轴),以及相关t分布的density plot. 请问如何用sas实现? 谢谢

(实在不行的话,请推荐些用sas画图的资料给我,谢~)  

[img:35c8gy93]http://down8928.pinggu.org/UploadFile_20082009/2008-9/20089251550096702.jpg[/img:35c8gy93]
作者: shiyiming    时间: 2008-9-28 16:11
标题: Re: 请问如何用SAS画 scaled t distribution of means?
我不太理解你的意思,不过SAS画图可用proc plot 或proc gplot. 下面是t分布的gpolt code.
[code:2q3rpjrf]data aa;
     do x=-5 to 5 by 0.2;
            v=8;
                pi=3.1415926;
            y1=gamma((v+1)/2);
        y2=(1+x**2/v)**-(v+1)/2;
                y3=sqrt(v*pi)*gamma(v/2);
                y=y1*y2/y3;
                output;
         end;
run;

goptions reset=global gunit=in htext=0.1 htitle=0.1 ftext=simplex ftitle=simplex ;

title1 j=l 'T distribution';
axis1 order=(-5 to 5 by 0.2) label=(j=c 'X value');
axis2 order=(0 to 0.2 by 0.01) label=(j=c a=90 'Y value');

symbol1 i=join value=dot color=black h=0.1;

proc gplot data=aa;
     plot y*x/haxis=axis1 vaxis=axis2 noframe;
run;
quit;[/code:2q3rpjrf]
作者: shiyiming    时间: 2008-9-28 16:54
标题: Re: 请问如何用SAS画 scaled t distribution of means?
不好意思,刚才T分布公式写错了[code:3uf26nk7]data aa;
     do x=-5 to 5 by 0.2;
       v=8;
      pi=3.1415926;
       y1=gamma((v+1)/2);
        y2=(1+x**2/v)**(-(v+1)/2);
      y3=sqrt(v*pi)*gamma(v/2);
      y=y1*y2/y3;
      output;
    end;
run;

data aa;
     set aa;
         if -0.1<x<1E-12 then x=0;
run;

goptions reset=global gunit=in htext=0.1 htitle=0.1 ftext=simplex ftitle=simplex ;

title1 j=l 'T distribution';
axis1 order=(-5 to 5 by 0.2) label=(j=c 'X value');
axis2 order=(0 to 0.5 by 0.05) label=(j=c a=90 'Y value');

symbol1 i=join value=dot color=black h=0.1;

proc gplot data=aa;
     plot y*x/haxis=axis1 vaxis=axis2 noframe;
run;
quit;[/code:3uf26nk7]
作者: shiyiming    时间: 2008-10-30 04:39
标题: Re: 请问如何用SAS画 scaled t distribution of means?
好人啊~太感谢了!!!




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2