楼主: saiyasaibing
9823 15

SAS 如何实现积分运算? [推广有奖]

  • 0关注
  • 0粉丝

已卖:207份资源

硕士生

54%

还不是VIP/贵宾

-

威望
0
论坛币
1913 个
通用积分
0.9100
学术水平
3 点
热心指数
4 点
信用等级
1 点
经验
1109 点
帖子
116
精华
0
在线时间
167 小时
注册时间
2008-6-16
最后登录
2025-10-24

楼主
saiyasaibing 发表于 2010-11-3 03:12:44 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
如何用sas来计算双重积分呢?
我有看过sas document, 用iml quad call来做积分。
可是,我计算的情况是,dxdy, 内部积分的上限里有y。
实在是不知道怎么处理了...
高手帮帮忙。
二维码

扫码加我 拉你入群

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

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

关键词:如何实现 Document DOCUME call quad document 如何

本帖被以下文库推荐

沙发
saiyasaibing 发表于 2010-11-3 05:25:44
有人有这方面的经验吗?还是说干脆用matlab算了...

藤椅
gzjb 发表于 2010-11-3 10:43:20
saiyasaibing 发表于 2010-11-3 03:12
如何用sas来计算双重积分呢?
我有看过sas document, 用iml quad call来做积分。
可是,我计算的情况是,dxdy, 内部积分的上限里有y。
实在是不知道怎么处理了...
高手帮帮忙。
It's extremely easy.
MC-method

step1 determine a rectangle or square which bounds the integral region
step2. Generate the random number pairs (points in 2D)
step3. Calculate the probability P of points located in the integral region
step4. integral=P*area of rectangle or square

For 3 dimension to n>3 dimension , same idea.


MCMC works very well. Easy to program  in SAS  or other language . I did integral from 1D to 3D many years ago.

I will send you programs if I have time and can find it.

板凳
saiyasaibing 发表于 2010-11-3 21:22:52
3# gzjb
十分感谢您的帮助,我的邮箱wzyznn@gmail.com,如果您能发一段程序让我参考一下那就更好了!

报纸
jingju11 发表于 2010-11-4 01:42:24
saiyasaibing 发表于 2010-11-3 03:12
如何用sas来计算双重积分呢?
我有看过sas document, 用iml quad call来做积分。
可是,我计算的情况是,dxdy, 内部积分的上限里有y。
实在是不知道怎么处理了...
高手帮帮忙。
Show your integral and I may have a try on that. JingJu

地板
saiyasaibing 发表于 2010-11-4 03:12:28
5# jingju11
QQ截图未命名.png

只有s和t是变量,其余的定义的。所以如果您试着计算的话,其余参数随便赋值就好。

7
jingju11 发表于 2010-11-4 05:56:24
saiyasaibing 发表于 2010-11-4 03:12
5# jingju11


只有s和t是变量,其余的定义的。所以如果您试着计算的话,其余参数随便赋值就好。

  1. proc iml;
  2. start inner(t) global(x, u,v, B, gamma, n, m);
  3.   _uv =v/u;  _gn =(n-1)*gamma;
  4.   _t =t*_uv; **here a very awkward transformation;
  5.   z =1 /B *(_t **(gamma -1) *(1-_t) **(_gn -1)) *_uv  *(1-x) **(m -2) *(m -1);
  6.     return(z);
  7. finish;                        
  8. start outer(s) global(x);
  9.   x =s;
  10.     t_interval = 0 ||x;
  11.     call quad(w, "inner", t_interval);
  12.     return (w);
  13. finish;
  14. /* when u <=v*/
  15. u =1; v =1.5; B = 0.010; gamma =3; n =10; m =5;
  16. s_interval= {0 1};
  17. call quad(R0, "outer", s_interval);
  18. print R0;
  19. /* when u >v*/
  20. u =1.5; v =1; v_u =v/u; m =15;
  21. s_interval= 0 ||v_u;
  22. call quad(R1, "outer", s_interval);
  23. R1 =R1  +v_u**(m-1) -1;
  24. print R1;
  25. quit;
复制代码

As you can see, I use a very awkward transformation for t that may not be necessary. You can ask someone, such as Bobguy, for help about that. JingJu

8
bobguy 发表于 2010-11-4 06:33:52
gzjb 发表于 2010-11-3 10:43
saiyasaibing 发表于 2010-11-3 03:12
如何用sas来计算双重积分呢?
我有看过sas document, 用iml quad call来做积分。
可是,我计算的情况是,dxdy, 内部积分的上限里有y。
实在是不知道怎么处理了...
高手帮帮忙。
It's extremely easy.
MC-method

step1 determine a rectangle or square which bounds the integral region
step2. Generate the random number pairs (points in 2D)
step3. Calculate the probability P of points located in the integral region
step4. integral=P*area of rectangle or square

For 3 dimension to n>3 dimension , same idea.


MCMC works very well. Easy to program  in SAS  or other language . I did integral from 1D to 3D many years ago.

I will send you programs if I have time and can find it.
MC method is the last solution if there is no way to integral. I am not sure how SAS calculates the integral. It certianly is a lot of faster than MC.

Here is an example of integal of 4xy on x=[0,1] and y=[0,x];

****integal of 4xy on x=[0,1] and y=[0,x];

proc iml;
start integal_Y (y) global(a);
   return(4#a#y);
finish;


start integal_X (x) global(a);
   a = x;
   RY = 0 || a;
   call quad(w, "integal_Y", RY);
   return (w);
finish;

RX= {0 1};
call quad(v, "integal_X", RX);
print v;

RX= {0 2};
call quad(v, "integal_X", RX);
print v;

RX= {0 4};
call quad(v, "integal_X", RX);
print v;

quit;

9
saiyasaibing 发表于 2010-11-4 08:35:02
Thank you very much!

10
gzjb 发表于 2010-11-4 08:41:53
bobguy 发表于 2010-11-4 06:33
gzjb 发表于 2010-11-3 10:43
saiyasaibing 发表于 2010-11-3 03:12
如何用sas来计算双重积分呢?
我有看过sas document, 用iml quad call来做积分。
可是,我计算的情况是,dxdy, 内部积分的上限里有y。
实在是不知道怎么处理了...
高手帮帮忙。
It's extremely easy.
MC-method

step1 determine a rectangle or square which bounds the integral region
step2. Generate the random number pairs (points in 2D)
step3. Calculate the probability P of points located in the integral region
step4. integral=P*area of rectangle or square

For 3 dimension to n>3 dimension , same idea.


MCMC works very well. Easy to program  in SAS  or other language . I did integral from 1D to 3D many years ago.

I will send you program if I have time and can find it.
MC method is the last solution if there is no way to integral. I am not sure how SAS calculates the integral. It certianly is a lot of faster than MC.

Here is an example of integal of 4xy on x=[0,1] and y=[0,x];

****integal of 4xy on x=[0,1] and y=[0,x];

proc iml;
start integal_Y (y) global(a);
   return(4#a#y);
finish;


start integal_X (x) global(a);
   a = x;
   RY = 0 || a;
   call quad(w, "integal_Y", RY);
   return (w);
finish;

RX= {0 1};
call quad(v, "integal_X", RX);
print v;

RX= {0 2};
call quad(v, "integal_X", RX);
print v;

RX= {0 4};
call quad(v, "integal_X", RX);
print v;

quit;
Point is IT's totally a mathematical problems, not SAS issues.

You can programs using any language.

If you don't need high accuracy, MC is the 1st choice.

Otherwise, you'd better try good numerical methods .

There's some issues:

1) Convergence rate
2)Accuracy
3)CPU time
4)stable

It's simple if you know basic math


If you want to calculate, it's better not to use SAS.

SAS can do everything, sometimes it's extremely inefficient.

It's not smart to use SAS as a tool for calculation.

SAS--Satatistical Analysis Software/system

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

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