|
楼主

楼主 |
发表于 2011-3-23 01:13:40
|
只看该作者
做最大似然估计时候报错,求助。
大家好,本人刚接触sas没有多久,现在遇到一个问题,想要实现一个最大似然估计,代码如下:
data A;
input pvment$ thickness ESAL rain @@;
datalines;
DGAC 48.96170255 544810 144.53
DGAC 52.62549946 236000 261.07
DGAC 54.35712505 310000 212.7
DGAC 54.41309566 284780 492.96
DGAC 36.66229293 3481320 157.99
DGAC 55.07167785 136250 531.11
DGAC 54.14445697 122000 513.33
OGAC 41.52548462 236000 261.07
OGAC 44.31461605 236000 261.07
OGAC 42.19031228 236000 261.07
OGAC 45.38567824 236000 261.07
OGAC 27.66625307 1662940 415.4
OGAC 33.64522296 210865 535.49
OGAC 26.56858947 89000 1187.11
OGAC 30.89045698 89000 1187.11
other 52.42478719 236000 261.07
other 50.30363374 236000 261.07
other 49.21335293 236000 261.07
other 50.01384679 236000 261.07
other 48.2134075 81070 21.3
other 44.08889863 81070 21.3
other 47.08160511 89000 2105.24
other 52.72141224 310000 212.7
other 57.51522172 310000 212.7
RAC 30.5341555 908520 833.66
RAC 23.26654254 243445 1425.6
RAC 31.62391067 91000 1183.35
RAC 27.16423427 286885 1679.37
RAC 22.78564813 243445 1425.6
RAC 33.05433851 91000 1183.35
RAC 24.05508273 286885 1679.37
;
[color=#BF0000:2owyv1d9](仅列出部分数据)[/color:2owyv1d9]
proc nlp data=A;
max f;
parms a1=.1, b1=.1, c1=.1, d1=.1,a2=.1, b2=.1, c2=.1, d2=.1,a3=.1, b3=.1, c3=.1, d3=.1,a4=.1, b4=.1, c4=.1, d4=.1;
if pvment eq 'dgac' then f1=a1+b1*thickness+c1*ESAL+d1*rain;
if pvment eq 'ogac' then f2=a2+b2*thickness+c2*ESAL+d2*rain;
if pvment eq 'other' then f3=a3+b3*thickness+c3*ESAL+d3*rain;
if pvment eq 'dgac' then f4=a4+b4*thickness+c4*ESAL+d4*rain;
f=exp(f1)/(exp(f1)+exp(f2)+exp(f3)+exp(f4));
run;
运行的时候总是提示说:[color=#FF0000:2owyv1d9]ERROR: There are references to missing variables when the program code is executed for _OBS_= 1[/color:2owyv1d9]
在网上查了好久,也不知道怎么修改。希望能有人帮助,欢迎任何建议。本人无以为报,现在国外,可能查找资料比较方便,也只能提供这点感谢了~~。 |
|