可能是我没有说清楚,这是我的毕业论文。我是把GARCH模型的扰动项由一般标准正态分布或标准t分布换成广义pareto 分布处理,GARCH的阶用的是1阶。现把似然函数和程序在附件,麻烦各位大哥给看一下。
data t1;
input a,b,c.;
datalines;
-0.070905 0.005027519 0.0140444
0.050845 0.002585214 0.007411531
0.100575 0.010115331 0.001236536
0.06686 0.00447026 0.000568351
-0.052708 0.002778133 0.007148253
0.037072 0.001374333 0.004030224
-0.020015 0.0004006 0.001629463
0.041423 0.001715865 0.001887314
0.086304 0.00744838 0.001007152
0.140626 0.019775672 0.00147544
-0.018331 0.000336026 0.012633664
0.030687 0.000941692 0.001201382
0.124745 0.015561315 0.004423454
-0.052901 0.002798516 0.015779051
-0.090776 0.008240282 0.000717258
0.027624 0.000763085 0.00700928
-0.007561 5.71687E-05 0.000618992
-0.05693 0.003241025 0.001218649
0.170772 0.029163076 0.0259241
0.121279 0.014708596 0.001224779
-0.098372 0.00967705 0.024123281
-0.033027 0.001090783 0.002134985
-0.010385 0.000107848 0.00025633
-0.076431 0.005841698 0.002181037
0.08131 0.006611316 0.012441112
0.060887 0.003707227 0.000208549
0.083806 0.007023446 0.00026264
0.034445 0.001186458 0.001218254
0.210418 0.044275735 0.015483248
-0.051767 0.002679822 0.034370487
0.033834 0.00114474 0.003663766
-0.088467 0.00782641 0.007478767
-0.047333 0.002240413 0.000846003
0.155429 0.024158174 0.020556214
-0.619211 0.383422263 0.300033565
0.041378 0.001712139 0.218188913
0.157433 0.024785149 0.006734382
-0.043362 0.001880263 0.020159316
0.043601 0.001901047 0.003781282
-0.074444 0.005541909 0.006967311
0.104807 0.010984507 0.016065461
-0.046651 0.002176316 0.011469763
-0.058805 0.003458028 7.38599E-05
0.05496 0.003020602 0.006471238
-0.006534 4.26932E-05 0.001890756
0.108267 0.011721743 0.006589635
0.012908 0.000166616 0.004546669
-0.024221 0.000586657 0.000689281
0.142243 0.020233071 0.013855132
-0.163625 0.026773141 0.046777617
0.130848 0.017121199 0.043357174
0.143595 0.020619524 8.1243E-05
0.105087 0.011043278 0.000741433
0.109205 0.011925732 8.47896E-06
-0.007209 5.19697E-05 0.00677611
-0.077586 0.006019587 0.002476461
0.042173 0.001778562 0.007171109
0.16462 0.027099744 0.007496634
-0.590714 0.34894303 0.285264726
0.107097 0.011469767 0.243470096
-0.028991 0.000840478 0.009259972
-0.010092 0.000101848 0.000178586
-0.030058 0.000903483 0.000199321
-0.209337 0.04382198 0.01607048
0.046735 0.00218416 0.032786435
0.044554 0.001985059 2.37838E-06
0.03874 0.001500788 1.69013E-05
-0.089491 0.008008639 0.008221595
0.140455 0.019727607 0.026437581
-0.060852 0.003702966 0.020262254
-0.039364 0.001549524 0.000230867
0.019689 0.000387657 0.001743628
0.023195 0.000538008 6.14602E-06
0.161164 0.025973835 0.009517722
-0.159995 0.0255984 0.051571552
-0.135024 0.018231481 0.000311775
-0.053156 0.00282556 0.003351185
-0.096371 0.00928737 0.000933768
0.274786 0.075507346 0.068878759
-0.11539 0.013314852 0.076118655
-0.03901 0.00152178 0.002916952
0.178866 0.031993046 0.023734976
-0.030499 0.000930189 0.021916852
0.01403 0.000196841 0.000991416
-0.075956 0.005769314 0.00404874
-0.0533 0.00284089 0.000256647
-0.086991 0.007567434 0.000567542
0.162977 0.026561503 0.031242001
0.066209 0.004383632 0.004682023
0.044349 0.001966834 0.00023893
-0.115409 0.013319237 0.012761309
-0.095982 0.009212544 0.000188704
0.057138 0.003264751 0.011722867
-0.217497 0.047304945 0.037712192
-0.041381 0.001712387 0.015508423
-0.112031 0.012550945 0.002495711
-0.023534 0.000553849 0.00391586
0.067287 0.00452754 0.004124227
-0.25783 0.066476309 0.052850532
0.301853 0.091115234 0.15662253
0.095239 0.009070467 0.021344672
-0.115772 0.013403156 0.022262821
0.00793 6.28849E-05 0.007651092
-0.004263 1.81732E-05 7.43346E-05
0.005078 2.57861E-05 4.36271E-05
0.078206 0.006116178 0.002673852
0.035256 0.001242986 0.000922351
-0.066054 0.004363131 0.005131858
-0.016329 0.000266636 0.001236288
0.008249 6.8046E-05 0.000302039
0.073177 0.005354873 0.002107823
0.011874 0.000140992 0.001879029
0.010715 0.000114811 6.7164E-07
0.0223 0.00049729 6.71061E-05
0.067226 0.004519335 0.001009173
-0.028959 0.000838624 0.004625777
-0.050556 0.002555909 0.000233215
-0.042183 0.001779405 3.50536E-05
0.004031 1.6249E-05 0.001067867
-0.00604 3.64816E-05 5.07125E-05
-0.013389 0.000179265 2.70039E-05
-0.028776 0.000828058 0.00011838
0.011261 0.00012681 0.000801481
0.047755 0.00228054 0.000665906
0.043962 0.001932657 7.19342E-06
-0.054824 0.003005671 0.004879337
-0.010094 0.000101889 0.001000386
-0.014108 0.000199036 8.0561E-06
-0.180367 0.032532255 0.013821028
-0.011987 0.000143688 0.014175912
0.116542 0.013582038 0.008259852
-0.035682 0.001273205 0.011586073
-0.006035 3.64212E-05 0.000439472
0.019421 0.000377175 0.000324004
0.081196 0.00659279 0.001908075
-0.079418 0.006307219 0.012898428
-0.012071 0.000145709 0.002267809
-0.014185 0.000201214 2.2345E-06
0.026351 0.000694375 0.000821584
-0.002639 6.96432E-06 0.00042021
-0.031142 0.000969824 0.000406211
-0.040372 0.001629898 4.25965E-05
0.00659 4.34281E-05 0.001102715
0.043901 0.001927298 0.000696055
0.010847 0.000117657 0.000546283
0.118321 0.013999859 0.00577533
-0.005512 3.03821E-05 0.007667306
0.054276 0.002945884 0.001787302
0.019316 0.000373108 0.000611101
-0.065741 0.004321879 0.003617347
0.013042 0.000170094 0.003103381
0.079911 0.006385768 0.002235732
0.040993 0.001680426 0.000757305
-0.013806 0.000190606 0.001501465
0.048972 0.002398257 0.001970539
0.052087 0.002713056 4.85161E-06
0.008406 7.06608E-05 0.000954015
-0.015425 0.000237931 0.000283958
-0.100012 0.0100024 0.00357748
0.026322 0.000692848 0.00798014
-0.010262 0.000105309 0.000669195
0.060052 0.003606243 0.002472029
0.010118 0.000102374 0.001246702
0.046098 0.002125026 0.00064728
0.068771 0.00472945 0.000257032
-0.089035 0.007927231 0.012451367
0.075647 0.005722469 0.013560081
-0.05113 0.002614277 0.008036204
-0.041035 0.001683871 5.09545E-05
-0.230616 0.053183739 0.017970478
-0.131509 0.017294617 0.004911099
0.029829 0.000889769 0.013014975
0.084196 0.007088966 0.001477885
0.003076 9.46178E-06 0.003290227
0.0504 0.00254016 0.00111978
0.062128 0.003859888 6.8773E-05
0.02825 0.000798063 0.000573859
;
proc nlp data=t1;
max logf;
parms alpha0=0,alpha1=0.8,beta=0.1,epsilon=1/2,beta=1.;
bounds epsilon>0,delta>0;
f=1/(SQART(alpha0+alpha1*b**2+beta*c**2)*beta(1+(epsilon*a)/beta)**(1+1/epsilon));
logf=log(f);
run;
运行错误:
1885 data t1;
1886 input a,b,c;
-
22
76
ERROR 22-322: Syntax error, expecting one of the following: [, {.
ERROR 76-322: Syntax error, statement will be ignored.
1887 datalines;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.T1 may be incomplete. When this step was stopped there were 0
observations and 0 variables.
WARNING: Data set WORK.T1 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
2065 ;
2066
2067 proc nlp data=t1;
2068 f=1/(sqart(alpha0+alpha1*b**2+beta*c**2)*beta(1+(epsilon*a)/beta)**(1+1/epsilon));
ERROR: The function BETA requires at least 2 arguments. There are too few arguments for the function
BETA at line 2068 column 46.
2069 parms alpha0=0,alpha1=0.8,beta=0.1,epsilon=1/2,beta=1.;
-
22
-
200
ERROR 22-322: Syntax error, expecting one of the following: a numeric constant, a datetime constant,
;, ',', TO.
ERROR 200-322: The symbol is not recognized and will be ignored.
2070 bounds epsilon>0,delta>0;
2071 logf=log(f);
2072 max logf;
2073 run;
NOTE: Your code contains 0 program statements.
NOTE: PROCEDURE NLP used (Total process time):
real time 0.32 seconds
cpu time 0.06 seconds
哪位大哥知道麻烦帮小弟改改!!
本人菜鸟,现有几个问题向各位大哥请教:
1.在Editor中,如果次方不是正整数该怎么输入?
2.在用SAS做极大似然估计时,如果不想使用SAS默认的高斯牛顿迭代法,例如想用BHHH算法或遗传算法,又该如何编程?
3.如何将C语言编写函数,转化到SAS中?
谢谢各位了!