楼主: 3554699
5936 4

[问答] sas如何作两尾为一定概率的正态分布图 [推广有奖]

  • 0关注
  • 0粉丝

已卖:263份资源

教授

34%

还不是VIP/贵宾

-

威望
0
论坛币
44710 个
通用积分
347.9796
学术水平
5 点
热心指数
10 点
信用等级
5 点
经验
28091 点
帖子
179
精华
0
在线时间
2490 小时
注册时间
2005-8-24
最后登录
2025-12-24

楼主
3554699 发表于 2011-8-26 16:54:07 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
想问一下sas如何作下面这样的正态分布图:
normal.jpg
或者中间为曲线,两尾阴影的曲线。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:正态分布图 正态分布 分布图 如何 正态分布

沙发
guoluo 发表于 2011-8-27 12:06:41
  1. data test;
  2.   retain q975 q95 q90 q10 q05 q025;
  3.   if _n_ = 1 then do;
  4.     q975 = quantile('NORMAL',.975);
  5.     q95 = quantile('NORMAL',.95);
  6.     q90 = quantile('NORMAL',.90);
  7.     q10 = -q90
  8.     q05 = -q95;
  9.     q025 = -q975;
  10.     q50 = 0;
  11.   end;
  12.   do x = -3 to 3 by 0.001;
  13.     y = sqrt(2*constant('PI'))*exp((-0.5)*x**2);
  14.     y05 = y * (x > q975 or x < q025);
  15.     y10 = y * (q95< x < q975 or q025 < x < q05);
  16.     y20 = y * (q90< x < q95 or q05 < x < q10);
  17.     y80 = y * (q10< x < q90);
  18.     output;
  19.   end;
  20. run;

  21. proc sgplot data=test noautolegend;
  22. series x=x y=y;
  23. band x=x lower=0 upper=y05/TRANSPARENCY=0.5;
  24. band x=x lower=0 upper=y10/FILLATTRS=(COLOR='Blue') TRANSPARENCY=0.5;
  25. band x=x lower=0 upper=y20/FILLATTRS=(COLOR='DarkSlateBlue') TRANSPARENCY=0.6;
  26. band x=x lower=0 upper=y80/FILLATTRS=(COLOR='DarkSlateBlue') TRANSPARENCY=0.3;
  27. vector x=q025 y=y05/xorigin=q025 yorigin=0 noarrowheads;
  28. vector x=q05 y=y10/xorigin=q05 yorigin=0 noarrowheads;
  29. vector x=q10 y=y20/xorigin=q10 yorigin=0 noarrowheads;
  30. vector x=q50 y=y/xorigin=q50 yorigin=0 noarrowheads;
  31. vector x=q90 y=y20/xorigin=q90 yorigin=0 noarrowheads;
  32. vector x=q95 y=y10/xorigin=q95 yorigin=0 noarrowheads;
  33. vector x=q975 y=y05/xorigin=q975 yorigin=0 noarrowheads;
  34. run;
复制代码
已有 1 人评分学术水平 热心指数 收起 理由
jingju11 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1   查看全部评分

藤椅
jingju11 发表于 2011-8-29 23:31:14

It looks like so hard to exactly match the original color. JingJu

  1. /*create normal density data*/
  2. data have;
  3.          do x =0 to 100 by .1;
  4.                 call missing(x1, y1, y2);
  5.                 i ++1;
  6.              y =pdf('normal', x, 50, 10);               
  7.                 if mod(i-1, 100) =0 then x1 =x; /*define needle plot variable*/               
  8.                 if 30 <=x         <=70 then y1 =y;        /*define band plot variable*/
  9.                 if 40 <=x <=60 then y2 =y;
  10.            output;
  11.   end;
  12. run;

  13. ods html ; title;
  14. ods graphics / reset width=600px height=400px imagename="nor" imagefmt=jpg;
  15. proc sgplot data =have noautolegend;        
  16.          ....
  17.         xaxis values =(0 to 100 by 10) label='Height (cm)';
  18.          yaxis values =(0 to 0.04 by 0.01) label='Frequency';
  19. run;
  20. ods _all_ close; ods listing;
复制代码

nor.JPG (49.6 KB)

normal density plot

normal density plot

已有 1 人评分学术水平 热心指数 信用等级 收起 理由
hopewell + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

板凳
3554699 发表于 2011-8-30 10:47:19
很不错,谢谢你们二位,好好学习一下!

报纸
zkymath 在职认证  发表于 2011-8-30 22:26:49
强人呐! 看来还要深入学习

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-24 21:24