楼主: emily.jiang
1284 0

高手救命啊! [推广有奖]

  • 0关注
  • 0粉丝

学前班

10%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
120 点
帖子
1
精华
0
在线时间
0 小时
注册时间
2009-11-1
最后登录
2009-11-1

楼主
emily.jiang 发表于 2009-11-1 13:43:53 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
小偶倒腾了好久这个程序,怎么都有问题,下周又要见老师了,大家帮帮忙 吧!!!谢谢谢谢了!!!
/* Macro ARMALOOP for simulations of MLE for an ARMA(1,1) model,
which will then be collected to data file ARMA11. The statitistics
of the data set of simulations are output to data SIMSTAT  */


%macro armaloop(mu=, sigma=, phi=, theta=, sim=, n=, seed=);
data ARMA11 ;    /* initialize data set */
run;


/******* Macro do-loop for simulations and their MLE starts *******/
/* where macro variable &j is only for conuting, not as an input */

%do j=1 %to ∼

  proc iml; /*start iml software */
  n = &n;
  seed=&seed;
  mu = μ
  sigma = σ
  phi = {1 &phi };         /* exact AR coefficients on LHS of model */
  theta = {1 &theta };     /* exact MA coefficients on RHS of model */
  yt = armasim(phi, theta, mu, sigma, n, seed);         /* generate series*/
  create yt from yt [colname='yt'];   /* store it in data set for analysis */
  append  from yt;
  close yt;

  proc arima data=yt;
  identify var=yt noprint ;
  estimate p=1 q=1 method=ml maxiter=100 outest=EST noprint /* ar=&phi  ma=&theta */ ;
  run;

  data EST;
  seed=&seed;
  set EST (where=(_type_="EST"));
  dev_ar=abs(ar1_1- (-&phi)) / abs(-&phi) ;                                      这里为什么是-&phi和-&theta呢?
  dev_ma=abs(ma1_1 - (-&theta)) / abs(&theta) ;
  drop _type_ ;

  data ARMA11 ;     /* add new estimates to ARMA11 */
  set ARMA11  EST;
  if seed=. then delete;
  run;

  %let seed=%eval(1+&seed);     /* add 1 to seed number */
%end;

/*********** macro do-loop ends *********/

proc capability data=ARMA11 noprint;


  par = (1-(&theta)*(&phi))/((&theta)-(&phi));
  sig_ar = sqrt((1-(&phi)**2) /(&n))*par;
  cdfplot ar1_1 / normal(mu=&phi sigma=sig_ar color=red);
run;

%mend armaloop;

/******* macro armaloop ends  ***********/
/****** macro COLLECTION for repeating macro ARMALOOP begins *******/

%macro collect;

data simstat;  run;  /* initialize data SIMATAT for collecting statistics  */

%do n=60 % to 80 %by 10;
  %armaloop (mu=10, sigma=1, phi=-0.1, theta=0.1, sim=2, n=&n, seed=3307);
  /*data simstat; set simstat statARMA11; if sim=. then delete;  run;*/
%end;

%mend collect;

/******macro COLLECTION ends*******/


%collect  /*run macro COLLECTION*/



关于蓝色字体部分,run出的结果如下:
NOTE: Line generated by the invoked macro "ARMALOOP".
11    proc capability data=ARMA11 noprint;    par = (1-(&theta)*(&phi))/((&theta)-(&phi));

---

180
NOTE: Line generated by the invoked macro "ARMALOOP".
12       sig_ar = sqrt((1-(&phi)**2) /(&n))*par;   cdfplot ar1_1 / normal(mu=&phi sigma=sig_ar color=red); run;
         -----                                                                         ----- -----
         180                                                                           22    202

ERROR 180-322: Statement is not valid or it is used out of proper order.

ERROR 22-322: Syntax error, expecting one of the following: a numeric constant, a datetime constant.

ERROR 202-322: The option or parameter is not recognized and will be ignored.
不明白啊不明白啊。。。要怎么办好呀。。。。
二维码

扫码加我 拉你入群

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

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

关键词:coefficients Simulations coefficient Collection Simulation 高手 救命

吃掉sas~

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

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